summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorjannfis <jann@mistrust.net>2020-08-12 08:20:56 +0200
committerGitHub <noreply@github.com>2020-08-12 08:20:56 +0200
commit7670c645c2f94117e3abe492f2ba02a65108b44b (patch)
tree0123f1013b2e1b62a3680aaed9f96c3415c49f00 /cmd
parent962e9c1863a7474a1c4441b43ffd8c0b42ed2fbf (diff)
refactor: Make registry client mockable and provide first set of unit tests (#42)
* refactor: Redesign of registry client * More unit tests * Sneak in some GH actions related change
Diffstat (limited to 'cmd')
-rw-r--r--cmd/main.go20
1 files changed, 19 insertions, 1 deletions
diff --git a/cmd/main.go b/cmd/main.go
index de9a0ad..6667092 100644
--- a/cmd/main.go
+++ b/cmd/main.go
@@ -100,8 +100,26 @@ func updateApplication(argoClient *argocd.ArgoCD, kubeClient *client.KubernetesC
vc.SortMode = updateableImage.GetParameterUpdateStrategy(curApplication.Application.Annotations)
+ ep, err := registry.GetRegistryEndpoint(updateableImage.RegistryURL)
+ if err != nil {
+ imgCtx.Errorf("Could not get registry endpoint: %v", err)
+ continue
+ }
+
+ err = ep.SetEndpointCredentials(kubeClient)
+ if err != nil {
+ imgCtx.Errorf("Could not set registry endpoint credentiasl: %v", err)
+ continue
+ }
+
+ regClient, err := registry.NewClient(ep)
+ if err != nil {
+ imgCtx.Errorf("Could not create registry client: %v", err)
+ continue
+ }
+
// Get list of available image tags from the repository
- tags, err := rep.GetTags(applicationImage, kubeClient, &vc)
+ tags, err := rep.GetTags(applicationImage, regClient, &vc)
if err != nil {
imgCtx.Errorf("Could not get tags from registry: %v", err)
result.NumErrors += 1