From 30f87ce796e31ffc01c86abdc85c1e363db6e075 Mon Sep 17 00:00:00 2001 From: Kyle Squizzato Date: Thu, 29 Aug 2024 03:26:51 -0700 Subject: [PATCH] Update helm-push targets to support pushing to non-OCI Signed-off-by: Kyle Squizzato --- Makefile | 17 ++++++++++++++--- config/dev/deployment.yaml | 6 +++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index a48301467..2827ea95b 100644 --- a/Makefile +++ b/Makefile @@ -248,12 +248,23 @@ helm-push: helm-package chart_version=$$(echo $$base | grep -o "v\{0,1\}[0-9]\+\.[0-9]\+\.[0-9].*"); \ chart_name="$${base%-"$$chart_version"}"; \ echo "Verifying if chart $$chart_name, version $$chart_version already exists in $(REGISTRY_REPO)"; \ - chart_exists=$$($(HELM) pull $(REGISTRY_REPO)/$$chart_name --version $$chart_version --destination /tmp 2>&1 | grep "not found" || true); \ + chart_exists=$$($(HELM) pull --repo $(REGISTRY_REPO) $$chart_name --version $$chart_version --destination /tmp 2>&1 | grep "not found" || true); \ if [ -z "$$chart_exists" ]; then \ echo "Chart $$chart_name version $$chart_version already exists in the repository."; \ else \ - echo "Pushing $$chart to $(REGISTRY_REPO)"; \ - $(HELM) push "$$chart" $(REGISTRY_REPO); \ + if [ $(REGISTRY_REPO) == "oci://*" ]; then \ + echo "Pushing $$chart to $(REGISTRY_REPO)"; \ + $(HELM) push "$$chart" $(REGISTRY_REPO); \ + else \ + if [ ! $$REGISTRY_USERNAME ] && [ ! $$REGISTRY_PASSWORD ]; then \ + echo "REGISTRY_USERNAME and REGISTRY_PASSWORD must be populated to push the chart to an HTTPS repository"; \ + exit 1; \ + else \ + $(HELM) repo add hmc $(REGISTRY_REPO); \ + echo "Pushing $$chart to $(REGISTRY_REPO)"; \ + $(HELM) cm-push "$$chart" $(REGISTRY_REPO) --username $$REGISTRY_USERNAME --password $$REGISTRY_PASSWORD; \ + fi; \ + fi; \ fi; \ done diff --git a/config/dev/deployment.yaml b/config/dev/deployment.yaml index a24db4c3e..58ba18e32 100644 --- a/config/dev/deployment.yaml +++ b/config/dev/deployment.yaml @@ -5,13 +5,13 @@ metadata: spec: template: aws-standalone-cp config: - region: us-west-2 + region: us-east-2 publicIP: true controlPlaneNumber: 1 workersNumber: 1 controlPlane: - amiID: ami-0989c067ff3da4b27 + amiID: ami-02f3416038bdb17fb instanceType: t3.small worker: - amiID: ami-0989c067ff3da4b27 + amiID: ami-02f3416038bdb17fb instanceType: t3.small