From d1678a4b74110793a62291cc45395f982d31f162 Mon Sep 17 00:00:00 2001 From: Varac <varac@varac.net> Date: Thu, 19 May 2022 11:17:27 +0200 Subject: [PATCH] Merge the pre-install-delete-helmrelease and install-helmrelease jobs --- .gitlab-ci.yml | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9e0a49d4..b6f92c8f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,15 +21,10 @@ include: - Chart.yaml - .gitlab-ci.yml -.delete_helmrelease: - stage: install-helm-chart - script: - - cd ${CHART_DIR:-"."} - - ./fully-delete-helmrelease.sh "nc$CI_MERGE_REQUEST_IID" "nc$CI_MERGE_REQUEST_IID" - - kubectl delete namespace "nc$CI_MERGE_REQUEST_IID" - extends: - - .use_kubernetes - - .chart_changes_rules +.delete_helmrelease: &delete_helmrelease + - cd ${CHART_DIR:-"."} + - ./fully-delete-helmrelease.sh "nc$CI_MERGE_REQUEST_IID" "nc$CI_MERGE_REQUEST_IID" + - kubectl delete namespace "nc$CI_MERGE_REQUEST_IID" stages: - lint-helm-chart @@ -42,17 +37,13 @@ stages: variables: CHART_NAME: nextcloud-onlyoffice -pre-install-delete-helmrelease: - extends: - - .delete_helmrelease - # This job will fail if a helmrelease didn't exist (yet). For example in a - # first pipeline for an MR. - allow_failure: true - -# This will clean up helmreleases after MRs have been merged, or after some time post-install-delete-helmrelease: + stage: install-helm-chart + script: + - *delete_helmrelease extends: - - .delete_helmrelease + - .use_kubernetes + - .chart_changes_rules # Gets triggered by on_stop of install-helmrelease, or manually when: manual environment: @@ -64,11 +55,8 @@ install-helmrelease: needs: # This job contains the `helm dep` artifacts - job: lint-helm - # We can't install if there's still an installation from a previous run - # present. - - job: pre-install-delete-helmrelease script: - - cd ${CHART_DIR:-"."} + - *delete_helmrelease - cp values-local.yaml.example values-ci.yaml # This sets the domains to files-MR_ID.gitlab.stackspin.net and # office-MR_ID.gitlab.stackspin.net @@ -76,7 +64,6 @@ install-helmrelease: # Make sure TLS certificate secrets for different MRs do not clash - sed -i "s/files-cert/files-cert-nc$CI_MERGE_REQUEST_IID/" values-ci.yaml - sed -i "s/office-cert/office-cert-nc$CI_MERGE_REQUEST_IID/" values-ci.yaml - - kubectl get namespace "nc$CI_MERGE_REQUEST_IID" && kubectl delete namespace "nc$CI_MERGE_REQUEST_IID" - kubectl create namespace "nc$CI_MERGE_REQUEST_IID" - helm install -n nc$CI_MERGE_REQUEST_IID --wait "nc$CI_MERGE_REQUEST_IID" . -f values-ci.yaml environment: -- GitLab