summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorjannfis <jann@mistrust.net>2020-08-09 17:38:04 +0200
committerGitHub <noreply@github.com>2020-08-09 17:38:04 +0200
commit6fb47b022c6d31e43cd068fec692c86924880238 (patch)
treee7692149da6a845d56498ef9b82ac816d9193a6a /cmd
parentf762bc0b767e52d9cf406080901dded2ef4f602c (diff)
refactor: Make version constraints parametrizable (#21)
Diffstat (limited to 'cmd')
-rw-r--r--cmd/main.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/cmd/main.go b/cmd/main.go
index 261562d..6ac3962 100644
--- a/cmd/main.go
+++ b/cmd/main.go
@@ -12,6 +12,7 @@ import (
"github.com/argoproj-labs/argocd-image-updater/pkg/argocd"
"github.com/argoproj-labs/argocd-image-updater/pkg/client"
"github.com/argoproj-labs/argocd-image-updater/pkg/health"
+ "github.com/argoproj-labs/argocd-image-updater/pkg/image"
"github.com/argoproj-labs/argocd-image-updater/pkg/log"
"github.com/argoproj-labs/argocd-image-updater/pkg/registry"
"github.com/argoproj-labs/argocd-image-updater/pkg/version"
@@ -99,17 +100,17 @@ func updateApplication(argoClient *argocd.ArgoCD, kubeClient *client.KubernetesC
imgCtx.Tracef("List of available tags found: %v", tags.Tags())
- var versConstraint string
+ var vc image.VersionConstraint
if updateableImage.ImageTag != nil {
- versConstraint = updateableImage.ImageTag.TagName
- imgCtx.Debugf("Using version constraint '%s' when looking for a new tag", versConstraint)
+ vc.Constraint = updateableImage.ImageTag.TagName
+ imgCtx.Debugf("Using version constraint '%s' when looking for a new tag", vc.Constraint)
} else {
imgCtx.Debugf("Using no version constraint when looking for a new tag")
}
// Get the latest available tag matching any constraint that might be set
// for allowed updates.
- latest, err := applicationImage.GetNewestVersionFromTags(versConstraint, tags)
+ latest, err := applicationImage.GetNewestVersionFromTags(&vc, tags)
if err != nil {
imgCtx.Errorf("Unable to find newest version from available tags: %v", err)
result.NumErrors += 1