From 8f1d889a6cfdcc453178e169861ec3b6dad186f1 Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Boll Date: Fri, 20 Dec 2024 13:01:52 +0100 Subject: [PATCH] Refactor makefile, add helm generic mk file --- .github/workflows/services-pr-check.yml | 8 ++++++-- frontend/Makefile | 3 ++- frontend/pipeline.yaml | 4 ++-- helm-cmd.mk | 5 +++++ run_pipeline.sh | 1 - 5 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 helm-cmd.mk diff --git a/.github/workflows/services-pr-check.yml b/.github/workflows/services-pr-check.yml index 8fffaa41a..3c40f4b6f 100644 --- a/.github/workflows/services-pr-check.yml +++ b/.github/workflows/services-pr-check.yml @@ -30,7 +30,7 @@ - opened - synchronize - reopened - + jobs: service_cluster_pr_check: permissions: @@ -70,8 +70,12 @@ with: kubelogin-version: 'v0.1.3' + - name: 'Install helm diff' + run: | + helm plugin install https://github.com/databus23/helm-diff + - name: 'Deploy Frontend' - env: + env: PRINCIPAL_ID: ${{ secrets.GHA_PRINCIPAL_ID }} run: | ./run_pipeline.sh dev ./frontend/pipeline.yaml deploy -c public -d diff --git a/frontend/Makefile b/frontend/Makefile index a2dd7bef3..d24fa2a90 100644 --- a/frontend/Makefile +++ b/frontend/Makefile @@ -1,4 +1,5 @@ -include ../setup-env.mk +-include ../helm-cmd.mk ifndef COMMIT COMMIT := $(shell git rev-parse --short=7 HEAD) @@ -52,7 +53,7 @@ deploy: TENANT_ID=$(shell az account show --query tenantId --output tsv) && \ kubectl create namespace aro-hcp --dry-run=client -o json | kubectl apply -f - && \ kubectl label namespace aro-hcp "istio.io/rev=$${ISTO_VERSION}" --overwrite=true && \ - helm diff --install ${HELM_DRY_RUN} aro-hcp-frontend-dev \ + ${HELM_CMD} aro-hcp-frontend-dev \ deploy/helm/frontend/ \ --set azure.clientId=$${SECRET_STORE_MI_CLIENT_ID} \ --set azure.tenantId=$${TENANT_ID} \ diff --git a/frontend/pipeline.yaml b/frontend/pipeline.yaml index ab4d1dc8b..a8ecd902e 100644 --- a/frontend/pipeline.yaml +++ b/frontend/pipeline.yaml @@ -11,8 +11,8 @@ resourceGroups: command: make deploy dryRun: variables: - - name: HELM_DRY_RUN - value: "--suppress-secrets" + - name: DRY_RUN + value: "true" variables: - name: ARO_HCP_IMAGE_ACR configRef: svcAcrName diff --git a/helm-cmd.mk b/helm-cmd.mk new file mode 100644 index 000000000..1183f23a3 --- /dev/null +++ b/helm-cmd.mk @@ -0,0 +1,5 @@ +ifdef DRY_RUN +HELM_CMD ?= helm diff --install --suppress-secrets +else +HELM_CMD ?= helm upgrade --install +endif diff --git a/run_pipeline.sh b/run_pipeline.sh index 718052fb3..b0354dd48 100755 --- a/run_pipeline.sh +++ b/run_pipeline.sh @@ -111,7 +111,6 @@ fi make -s -C ${PROJECT_ROOT_DIR}/tooling/templatize templatize TEMPLATIZE="${PROJECT_ROOT_DIR}/tooling/templatize/templatize" -helm plugin install https://github.com/databus23/helm-diff CONFIG_FILE=${CONFIG_FILE:-${PROJECT_ROOT_DIR}/config/config.yaml} $TEMPLATIZE pipeline run \