diff --git a/api/types/v1alpha1/srl_version.go b/api/types/v1alpha1/srl_version.go index dce2e32..d19a96e 100644 --- a/api/types/v1alpha1/srl_version.go +++ b/api/types/v1alpha1/srl_version.go @@ -29,9 +29,9 @@ func parseVersionString(s string) (*SrlVersion, error) { return &SrlVersion{"0", "", "", "", ""}, nil } - // https://regex101.com/r/eWS6Ms/1 + // https://regex101.com/r/eWS6Ms/3 re := regexp.MustCompile( - `^v?(?P\d{1,3})\.(?P\d{1,2})\.?(?P\d{1,2})?-?(?P\d{1,10})?-?(?P\S+)?`, + `(?P\d{1,3})\.(?P\d{1,2})\.?(?P\d{1,2})?-?(?P\d{1,10})?-?(?P\S+)?`, ) v := re.FindStringSubmatch(s) diff --git a/api/types/v1alpha1/srl_version_test.go b/api/types/v1alpha1/srl_version_test.go index 071072e..4dc3058 100644 --- a/api/types/v1alpha1/srl_version_test.go +++ b/api/types/v1alpha1/srl_version_test.go @@ -63,6 +63,11 @@ func TestParseVersionString(t *testing.T) { got: "0.0.0-34652", want: &SrlVersion{"0", "0", "0", "34652", ""}, }, + { + desc: "version_0.0.0-34652", + got: "version_0.0.0-34652", + want: &SrlVersion{"0", "0", "0", "34652", ""}, + }, { desc: "latest", got: "latest", diff --git a/api/types/v1alpha1/srlinux_types_test.go b/api/types/v1alpha1/srlinux_types_test.go index b07c300..ca001b8 100644 --- a/api/types/v1alpha1/srlinux_types_test.go +++ b/api/types/v1alpha1/srlinux_types_test.go @@ -95,7 +95,7 @@ func TestGetImageVersion(t *testing.T) { { desc: "invalid version is present", spec: &SrlinuxSpec{ - Version: "abc21.11.1", + Version: "abc", Config: &NodeConfig{Image: "ghcr.io/nokia/srlinux:somever"}, }, err: ErrVersionParse, @@ -110,7 +110,7 @@ func TestGetImageVersion(t *testing.T) { { desc: "version is not present, invalid image tag is given", spec: &SrlinuxSpec{ - Config: &NodeConfig{Image: "ghcr.io/nokia/srlinux:21"}, + Config: &NodeConfig{Image: "ghcr.io/nokia/srlinux:somesrl"}, }, err: ErrVersionParse, }, diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index 839d3da..1033201 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -17,4 +17,4 @@ kind: Kustomization images: - name: controller newName: ghcr.io/srl-labs/srl-controller - newTag: 0.4.4 + newTag: 0.4.5