summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorjannfis <jann@mistrust.net>2020-08-11 10:27:13 +0200
committerGitHub <noreply@github.com>2020-08-11 10:27:13 +0200
commit001e4b490c3683834e5449ca09f407ff7ae7d38e (patch)
treeea52ab610a0bfc219e79c5ad15cb879b84d95344 /cmd
parent69358a4469698d01b1330b0364b440c5dac5a6ae (diff)
fix: Only fetch metadata when it is required by update-strategy (#32)
* fix: Only fetch metadata when it is required by update-strategy * Update CHANGELOG
Diffstat (limited to 'cmd')
-rw-r--r--cmd/main.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/cmd/main.go b/cmd/main.go
index a78196c..d87e93d 100644
--- a/cmd/main.go
+++ b/cmd/main.go
@@ -90,16 +90,6 @@ func updateApplication(argoClient *argocd.ArgoCD, kubeClient *client.KubernetesC
continue
}
- // Get list of available image tags from the repository
- tags, err := rep.GetTags(applicationImage, kubeClient)
- if err != nil {
- imgCtx.Errorf("Could not get tags from registry: %v", err)
- result.NumErrors += 1
- continue
- }
-
- imgCtx.Tracef("List of available tags found: %v", tags.Tags())
-
var vc image.VersionConstraint
if updateableImage.ImageTag != nil {
vc.Constraint = updateableImage.ImageTag.TagName
@@ -110,6 +100,16 @@ func updateApplication(argoClient *argocd.ArgoCD, kubeClient *client.KubernetesC
vc.SortMode = updateableImage.GetParameterUpdateStrategy(curApplication.Application.Annotations)
+ // Get list of available image tags from the repository
+ tags, err := rep.GetTags(applicationImage, kubeClient, &vc)
+ if err != nil {
+ imgCtx.Errorf("Could not get tags from registry: %v", err)
+ result.NumErrors += 1
+ continue
+ }
+
+ imgCtx.Tracef("List of available tags found: %v", tags.Tags())
+
// Get the latest available tag matching any constraint that might be set
// for allowed updates.
latest, err := applicationImage.GetNewestVersionFromTags(&vc, tags)