diff options
| author | jannfis <jann@mistrust.net> | 2022-01-11 16:35:51 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-11 16:35:51 +0100 |
| commit | e1f65012575eac6cd46fc6fdfc2d1ef03ad9b930 (patch) | |
| tree | 7e4bd77d6e96ee77d8cd3f383165448c9ad01501 /cmd | |
| parent | 77a6e8f1f8afa1d5b5b5f440dd9341830e14f7ef (diff) | |
feat: Support manifestlist and multi-arch images (#341)
* feat: Support manifestlist and multi-arch images
Signed-off-by: jannfis <jann@mistrust.net>
* Add unit test
Signed-off-by: jannfis <jann@mistrust.net>
* Fix linter issue
Signed-off-by: jannfis <jann@mistrust.net>
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/test.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cmd/test.go b/cmd/test.go index 3ebf394..699137f 100644 --- a/cmd/test.go +++ b/cmd/test.go @@ -2,10 +2,13 @@ package main import ( "context" + "fmt" + "runtime" "github.com/argoproj-labs/argocd-image-updater/pkg/image" "github.com/argoproj-labs/argocd-image-updater/pkg/kube" "github.com/argoproj-labs/argocd-image-updater/pkg/log" + "github.com/argoproj-labs/argocd-image-updater/pkg/options" "github.com/argoproj-labs/argocd-image-updater/pkg/registry" "github.com/spf13/cobra" @@ -26,6 +29,7 @@ func newTestCommand() *cobra.Command { ignoreTags []string disableKubeEvents bool rateLimit int + platform string ) var runCmd = &cobra.Command{ Use: "test IMAGE", @@ -89,6 +93,15 @@ argocd-image-updater test nginx --allow-tags '^1.19.\d+(\-.*)*$' --update-strate AddField("image_name", img.ImageName). Infof("getting image") + vc.Options = options.NewManifestOptions() + if platform != "" { + os, arch, variant, err := image.ParsePlatform(platform) + if err != nil { + log.Fatalf("Platform %s: %v", platform, err) + } + vc.Options = vc.Options.WithPlatform(os, arch, variant) + } + if registriesConfPath != "" { if err := registry.LoadRegistryConfiguration(registriesConfPath, false); err != nil { log.Fatalf("could not load registries configuration: %v", err) @@ -168,6 +181,7 @@ argocd-image-updater test nginx --allow-tags '^1.19.\d+(\-.*)*$' --update-strate runCmd.Flags().BoolVar(&disableKubernetes, "disable-kubernetes", false, "whether to disable the Kubernetes client") runCmd.Flags().StringVar(&kubeConfig, "kubeconfig", "", "path to your Kubernetes client configuration") runCmd.Flags().StringVar(&credentials, "credentials", "", "the credentials definition for the test (overrides registry config)") + runCmd.Flags().StringVar(&platform, "platform", fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH), "limit images to given platform") runCmd.Flags().BoolVar(&disableKubeEvents, "disable-kubernetes-events", false, "Disable kubernetes events") runCmd.Flags().IntVar(&rateLimit, "rate-limit", 20, "specificy registry rate limit (overrides registry.conf)") return runCmd |
