Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package updatecli for openSUSE:Factory checked in at 2024-12-30 12:51:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/updatecli (Old) and /work/SRC/openSUSE:Factory/.updatecli.new.1881 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "updatecli" Mon Dec 30 12:51:09 2024 rev:10 rq:1233559 version:0.91.0 Changes: -------- --- /work/SRC/openSUSE:Factory/updatecli/updatecli.changes 2024-12-20 23:12:29.585105118 +0100 +++ /work/SRC/openSUSE:Factory/.updatecli.new.1881/updatecli.changes 2024-12-30 12:51:29.463529269 +0100 @@ -1,0 +2,8 @@ +Fri Dec 27 12:37:49 UTC 2024 - opensuse_buildserv...@ojkastl.de + +- Update to version 0.91.0: + * feat: add version filter regex-semver (#3347) + * feat(autodiscovery): support kubernetes cronjob (#3346) + * deps: bump updatecli version to v0.90.0 (#3338) + +------------------------------------------------------------------- Old: ---- updatecli-0.90.0.obscpio New: ---- updatecli-0.91.0.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ updatecli.spec ++++++ --- /var/tmp/diff_new_pack.NU8Z57/_old 2024-12-30 12:51:30.783583451 +0100 +++ /var/tmp/diff_new_pack.NU8Z57/_new 2024-12-30 12:51:30.787583614 +0100 @@ -17,7 +17,7 @@ Name: updatecli -Version: 0.90.0 +Version: 0.91.0 Release: 0 Summary: A Declarative Dependency Management tool License: Apache-2.0 ++++++ _service ++++++ --- /var/tmp/diff_new_pack.NU8Z57/_old 2024-12-30 12:51:30.819584928 +0100 +++ /var/tmp/diff_new_pack.NU8Z57/_new 2024-12-30 12:51:30.823585092 +0100 @@ -3,7 +3,7 @@ <param name="url">https://github.com/updatecli/updatecli</param> <param name="scm">git</param> <param name="exclude">.git</param> - <param name="revision">v0.90.0</param> + <param name="revision">v0.91.0</param> <param name="versionformat">@PARENT_TAG@</param> <param name="versionrewrite-pattern">v(.*)</param> <param name="changesgenerate">enable</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.NU8Z57/_old 2024-12-30 12:51:30.843585913 +0100 +++ /var/tmp/diff_new_pack.NU8Z57/_new 2024-12-30 12:51:30.847586077 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/updatecli/updatecli</param> - <param name="changesrevision">01a8f7dbca9185b45bcfef4527dd6d0027394b8c</param></service></servicedata> + <param name="changesrevision">6718b8e9bd1952bcae80dff5118d5298fa9112b5</param></service></servicedata> (No newline at EOF) ++++++ updatecli-0.90.0.obscpio -> updatecli-0.91.0.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/updatecli-0.90.0/.github/ISSUE_TEMPLATE/1-bug-report.yml new/updatecli-0.91.0/.github/ISSUE_TEMPLATE/1-bug-report.yml --- old/updatecli-0.90.0/.github/ISSUE_TEMPLATE/1-bug-report.yml 2024-12-20 10:23:46.000000000 +0100 +++ new/updatecli-0.91.0/.github/ISSUE_TEMPLATE/1-bug-report.yml 2024-12-23 16:43:12.000000000 +0100 @@ -38,7 +38,7 @@ description: | examples: - **OS**: Ubuntu 20.04 - - **updatecli**: v0.89.0 + - **updatecli**: v0.90.0 value: | - OS: - updatecli: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/updatecli-0.90.0/README.adoc new/updatecli-0.91.0/README.adoc --- old/updatecli-0.90.0/README.adoc 2024-12-20 10:23:46.000000000 +0100 +++ new/updatecli-0.91.0/README.adoc 2024-12-23 16:43:12.000000000 +0100 @@ -52,7 +52,7 @@ Once you have the three files locally, you can execute the following command ``` -cosign verify-blob --certificate-identity-regexp "https://github.com/updatecli/updatecli" --certificate-oidc-issuer 'https://token.actions.githubusercontent.com' --cert https://github.com/updatecli/updatecli/releases/download/v0.89.0/checksums.txt.pem --signature https://github.com/updatecli/updatecli/releases/download/v0.89.0/checksums.txt.sig checksums.txt +cosign verify-blob --certificate-identity-regexp "https://github.com/updatecli/updatecli" --certificate-oidc-issuer 'https://token.actions.githubusercontent.com' --cert https://github.com/updatecli/updatecli/releases/download/v0.90.0/checksums.txt.pem --signature https://github.com/updatecli/updatecli/releases/download/v0.90.0/checksums.txt.sig checksums.txt ``` A successful output looks like @@ -76,7 +76,7 @@ **Verify Container signature** ``` -cosign verify --certificate-identity-regexp "https://github.com/updatecli/updatecli" --certificate-oidc-issuer "https://token.actions.githubusercontent.com" ghcr.io/updatecli/updatecli:v0.89.0 +cosign verify --certificate-identity-regexp "https://github.com/updatecli/updatecli" --certificate-oidc-issuer "https://token.actions.githubusercontent.com" ghcr.io/updatecli/updatecli:v0.90.0 ``` == Documentation diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/updatecli-0.90.0/pkg/plugins/autodiscovery/kubernetes/kubernetes.go new/updatecli-0.91.0/pkg/plugins/autodiscovery/kubernetes/kubernetes.go --- old/updatecli-0.90.0/pkg/plugins/autodiscovery/kubernetes/kubernetes.go 2024-12-20 10:23:46.000000000 +0100 +++ new/updatecli-0.91.0/pkg/plugins/autodiscovery/kubernetes/kubernetes.go 2024-12-23 16:43:12.000000000 +0100 @@ -17,56 +17,48 @@ if data == nil { return manifests } - for i, container := range data.Spec.Containers { - containerName := container.Name - if containerName == "" { - containerName = container.Image - } - - manifest, err := k.generateContainerManifest( - fmt.Sprintf("$.spec.containers[%d].image", i), - containerName, - container.Image, - relativeFile, - "") - - if err != nil { - logrus.Debugln(err) - continue - } - - if manifest == nil { - continue - } - - manifests = append(manifests, manifest) + list := []struct { + cs []containerSpec + key string + }{ + { + cs: data.Spec.Containers, + key: "$.spec.containers[%d].image", + }, + { + cs: data.Spec.Template.Spec.Containers, + key: "$.spec.template.spec.containers[%d].image", + }, + { + cs: data.Spec.JobTemplateSpec.Spec.Template.Spec.Containers, + key: "$.spec.jobTemplate.spec.template.spec.containers[%d].image", + }, } + for _, v := range list { + for i, container := range v.cs { + containerName := container.Name + if containerName == "" { + containerName = container.Image + } + + manifest, err := k.generateContainerManifest( + fmt.Sprintf(v.key, i), + containerName, + container.Image, + relativeFile, + "") + if err != nil { + logrus.Debugln(err) + continue + } + + if manifest == nil { + continue + } - for i, container := range data.Spec.Template.Spec.Containers { - - containerName := container.Name - if containerName == "" { - containerName = container.Image - } - - manifest, err := k.generateContainerManifest( - fmt.Sprintf("$.spec.template.spec.containers[%d].image", i), - containerName, - container.Image, - relativeFile, - "") - - if err != nil { - logrus.Debugln(err) - continue + manifests = append(manifests, manifest) } - - if manifest == nil { - continue - } - - manifests = append(manifests, manifest) } return manifests } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/updatecli-0.90.0/pkg/plugins/autodiscovery/kubernetes/kubernetesSpec.go new/updatecli-0.91.0/pkg/plugins/autodiscovery/kubernetes/kubernetesSpec.go --- old/updatecli-0.90.0/pkg/plugins/autodiscovery/kubernetes/kubernetesSpec.go 2024-12-20 10:23:46.000000000 +0100 +++ new/updatecli-0.91.0/pkg/plugins/autodiscovery/kubernetes/kubernetesSpec.go 2024-12-23 16:43:12.000000000 +0100 @@ -10,6 +10,14 @@ type podTemplateSpec struct { Containers []containerSpec `yaml:"containers,omitempty"` Template podControllerSpec `yaml:"template,omitempty"` + // cronJob + JobTemplateSpec jobTemplateSpec `yaml:"jobTemplate,omitempty"` +} + +type jobTemplateSpec struct { + Spec struct { + Template podControllerSpec `yaml:"template,omitempty"` + } `yaml:"spec,omitempty"` } type podControllerSpec struct { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/updatecli-0.90.0/pkg/plugins/autodiscovery/kubernetes/test/main_test.go new/updatecli-0.91.0/pkg/plugins/autodiscovery/kubernetes/test/main_test.go --- old/updatecli-0.90.0/pkg/plugins/autodiscovery/kubernetes/test/main_test.go 2024-12-20 10:23:46.000000000 +0100 +++ new/updatecli-0.91.0/pkg/plugins/autodiscovery/kubernetes/test/main_test.go 2024-12-23 16:43:12.000000000 +0100 @@ -205,10 +205,37 @@ - addprefix: 'ghcr.io/updatecli/updatecli:' `}, }, + { + name: "cronjob", + rootDir: "testdata/cronjob", + digest: false, + flavor: kubernetes.FlavorKubernetes, + expectedPipelines: []string{`name: 'deps: bump container image "updatecli"' +sources: + updatecli: + name: 'get latest container image tag for "ghcr.io/updatecli/updatecli"' + kind: 'dockerimage' + spec: + image: 'ghcr.io/updatecli/updatecli' + tagfilter: '^v\d*(\.\d*){2}$' + versionfilter: + kind: 'semver' + pattern: '>=v0.67.0' +targets: + updatecli: + name: 'deps: bump container image "ghcr.io/updatecli/updatecli" to {{ source "updatecli" }}' + kind: 'yaml' + spec: + file: 'cronjob.yaml' + key: "$.spec.jobTemplate.spec.template.spec.containers[0].image" + sourceid: 'updatecli' + transformers: + - addprefix: 'ghcr.io/updatecli/updatecli:' +`}, + }, } for _, tt := range testdata { - t.Run(tt.name, func(t *testing.T) { digest := tt.digest pod, err := kubernetes.New( @@ -235,5 +262,4 @@ } }) } - } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/updatecli-0.90.0/pkg/plugins/autodiscovery/kubernetes/test/testdata/cronjob/cronjob.yaml new/updatecli-0.91.0/pkg/plugins/autodiscovery/kubernetes/test/testdata/cronjob/cronjob.yaml --- old/updatecli-0.90.0/pkg/plugins/autodiscovery/kubernetes/test/testdata/cronjob/cronjob.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/updatecli-0.91.0/pkg/plugins/autodiscovery/kubernetes/test/testdata/cronjob/cronjob.yaml 2024-12-23 16:43:12.000000000 +0100 @@ -0,0 +1,19 @@ +apiVersion: batch/v1 +kind: CronJob +metadata: + name: hello +spec: + schedule: "* * * * *" + jobTemplate: + spec: + template: + spec: + containers: + - name: "updatecli" + image: "ghcr.io/updatecli/updatecli:v0.67.0" + imagePullPolicy: IfNotPresent + args: + - "99d" + command: + - "sleep" + restartPolicy: OnFailure diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/updatecli-0.90.0/pkg/plugins/autodiscovery/kubernetes/utils.go new/updatecli-0.91.0/pkg/plugins/autodiscovery/kubernetes/utils.go --- old/updatecli-0.90.0/pkg/plugins/autodiscovery/kubernetes/utils.go 2024-12-20 10:23:46.000000000 +0100 +++ new/updatecli-0.91.0/pkg/plugins/autodiscovery/kubernetes/utils.go 2024-12-23 16:43:12.000000000 +0100 @@ -2,7 +2,6 @@ import ( "fmt" - "io" "io/fs" "os" "path/filepath" @@ -13,7 +12,6 @@ // searchKubernetesFiles will look, recursively, for every files with an extension .yaml or .yml from a root directory. func searchKubernetesFiles(rootDir string, files []string) ([]string, error) { - kubernetesFiles := []string{} logrus.Debugf("Looking for Kubernetes file(s) in %q", rootDir) @@ -39,14 +37,13 @@ return nil }) - if err != nil { return nil, err } logrus.Debugf("%d Kubernetes file(s) found", len(kubernetesFiles)) for _, foundFile := range kubernetesFiles { - kubernetesFile := filepath.Base(filepath.Dir(foundFile)) + kubernetesFile := filepath.Base(foundFile) logrus.Debugf(" * %q", kubernetesFile) } @@ -60,24 +57,12 @@ manifestFile := filepath.Base(filepath.Dir(filename)) logrus.Debugf("%s file %q found in %q", logPrefix, manifestFile, filepath.Dir(filename)) - if _, err := os.Stat(filename); err != nil { - return nil, err - } - - v, err := os.Open(filename) - if err != nil { - return nil, err - } - - defer v.Close() - - content, err := io.ReadAll(v) + content, err := os.ReadFile(filename) if err != nil { return nil, err } err = goyaml.Unmarshal(content, data) - if err != nil { return nil, err } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/updatecli-0.90.0/pkg/plugins/autodiscovery/kubernetes/utils_test.go new/updatecli-0.91.0/pkg/plugins/autodiscovery/kubernetes/utils_test.go --- old/updatecli-0.90.0/pkg/plugins/autodiscovery/kubernetes/utils_test.go 2024-12-20 10:23:46.000000000 +0100 +++ new/updatecli-0.91.0/pkg/plugins/autodiscovery/kubernetes/utils_test.go 2024-12-23 16:43:12.000000000 +0100 @@ -24,6 +24,7 @@ name: "case: all", path: "test/testdata", expectedResults: []string{ + "test/testdata/cronjob/cronjob.yaml", "test/testdata/kustomize/deployment.yaml", "test/testdata/latest/pod.yaml", "test/testdata/prow/prow.yaml", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/updatecli-0.90.0/pkg/plugins/utils/version/filter.go new/updatecli-0.91.0/pkg/plugins/utils/version/filter.go --- old/updatecli-0.90.0/pkg/plugins/utils/version/filter.go 2024-12-20 10:23:46.000000000 +0100 +++ new/updatecli-0.91.0/pkg/plugins/utils/version/filter.go 2024-12-23 16:43:12.000000000 +0100 @@ -17,16 +17,17 @@ SEMVERVERSIONKIND string = "semver" // LATESTVERSIONKIND specifies that we are looking for the latest version of an array LATESTVERSIONKIND string = "latest" + // REGEXSEMVERVERSIONKIND use regex to extract versions and semantic version to find version + REGEXSEMVERVERSIONKIND string = "regex/semver" ) -var ( - // SupportedKind holds a list of supported version kind - SupportedKind []string = []string{ - REGEXVERSIONKIND, - SEMVERVERSIONKIND, - LATESTVERSIONKIND, - } -) +// SupportedKind holds a list of supported version kind +var SupportedKind []string = []string{ + REGEXVERSIONKIND, + SEMVERVERSIONKIND, + LATESTVERSIONKIND, + REGEXSEMVERVERSIONKIND, +} // Filter defines parameters to apply different kind of version matching based on a list of versions type Filter struct { @@ -36,6 +37,8 @@ Pattern string `yaml:",omitempty"` // strict enforce strict versioning rule. Only used for semantic versioning at this time Strict bool `yaml:",omitempty"` + // specifies the regex pattern, only used for regex/semver. Output of the first capture group will be used. + Regex string `yaml:",omitempty"` } // Init returns a new (copy) valid instantiated filter @@ -75,7 +78,6 @@ // Search returns a value matching pattern func (f *Filter) Search(versions []string) (Version, error) { - logrus.Infof("Searching for version matching pattern %q", f.Pattern) foundVersion := Version{} @@ -127,6 +129,35 @@ } return s.FoundVersion, nil + case REGEXSEMVERVERSIONKIND: + re, err := regexp.Compile(f.Regex) + if err != nil { + return foundVersion, err + } + + // Create a slice of versions using regex pattern + var parsedVersions []string + for i := 0; i < len(versions); i++ { + v := versions[i] + found := re.FindStringSubmatch(v) + if len(found) > 1 { + parsedVersions = append(parsedVersions, found[1]) + } + + } + + s := Semver{ + Constraint: f.Pattern, + Strict: f.Strict, + } + + err = s.Search(parsedVersions) + if err != nil { + return foundVersion, err + } + + return s.FoundVersion, nil + default: return foundVersion, &ErrUnsupportedVersionKindPattern{Pattern: f.Pattern, Kind: f.Kind} } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/updatecli-0.90.0/pkg/plugins/utils/version/filter_test.go new/updatecli-0.91.0/pkg/plugins/utils/version/filter_test.go --- old/updatecli-0.90.0/pkg/plugins/utils/version/filter_test.go 2024-12-20 10:23:46.000000000 +0100 +++ new/updatecli-0.91.0/pkg/plugins/utils/version/filter_test.go 2024-12-23 16:43:12.000000000 +0100 @@ -142,6 +142,37 @@ want: Version{}, wantErr: &ErrNoVersionFoundForPattern{Pattern: "^updatecli-4.(\\d*)$"}, }, + { + name: "Passing case with regex/semver", + filter: Filter{ + Kind: REGEXSEMVERVERSIONKIND, + Regex: "^updatecli-(\\d*\\.\\d*\\.\\d*)$", + }, + versions: []string{"updatecli-1.0.0", "updatecli-2.0.0", "updatecli-1.1.0"}, + want: Version{ + ParsedVersion: "2.0.0", + OriginalVersion: "2.0.0", + }, + }, + { + name: "Passing case with regex/semver", + filter: Filter{ + Kind: REGEXSEMVERVERSIONKIND, + Regex: "^updatecli-\\d*\\.\\d*\\.\\d*$", + }, + versions: []string{"updatecli-1.0.0", "updatecli-2.0.0", "updatecli-1.1.0"}, + want: Version{}, + wantErr: errors.New("versions list empty"), + }, + { + name: "Passing case with regex/semver", + filter: Filter{ + Kind: REGEXSEMVERVERSIONKIND, + }, + versions: []string{"updatecli-1.0.0", "updatecli-2.0.0", "updatecli-1.1.0"}, + want: Version{}, + wantErr: errors.New("versions list empty"), + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ++++++ updatecli.obsinfo ++++++ --- /var/tmp/diff_new_pack.NU8Z57/_old 2024-12-30 12:51:31.235602004 +0100 +++ /var/tmp/diff_new_pack.NU8Z57/_new 2024-12-30 12:51:31.239602168 +0100 @@ -1,5 +1,5 @@ name: updatecli -version: 0.90.0 -mtime: 1734686626 -commit: 01a8f7dbca9185b45bcfef4527dd6d0027394b8c +version: 0.91.0 +mtime: 1734968592 +commit: 6718b8e9bd1952bcae80dff5118d5298fa9112b5 ++++++ vendor.tar.gz ++++++ /work/SRC/openSUSE:Factory/updatecli/vendor.tar.gz /work/SRC/openSUSE:Factory/.updatecli.new.1881/vendor.tar.gz differ: char 5, line 1