diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 88b6c64f86f172d30cf9ea5aef3a02011a0f2e92..eb503381b9c9691ac2b8052dcaa9a2b59b647c5b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -63,44 +63,13 @@ unittest: script: - helm unittest -f 'tests/**/*.yaml' . -version_test: - stage: test - rules: - - if: '$CI_COMMIT_TAG' - script: | - # Installing helm... - dnf install -y diffutils wget tar - wget https://get.helm.sh/helm-v3.15.3-linux-386.tar.gz - tar -zxvf helm-v3.15.3-linux-386.tar.gz - mv linux-386/helm /usr/local/bin/helm - rm helm-v3.15.3-linux-386.tar.gz - rm -rf linux-386 - - # Check if the tag already exists in harbor to avoid overrides. - if helm pull oci://registry.cern.ch/monit/cern-it-monitoring-kubernetes --version $CI_COMMIT_TAG; then - # Command was successful (exit code 0), so the tag exists - echo "The tag $TAG already exists in harbor. Please update it." - exit 1 # Exit with non-zero status to indicate tag exists - else - # Command failed (non-zero exit code), so the tag does not exist - echo "The tag $TAG does not exist in harbor. All ok..." - exit 0 # Exit with 0 status - fi - helm_deploy: stage: deploy - needs: - - version_test + image: registry.cern.ch/docker.io/alpine/helm:3 rules: - if: '$CI_COMMIT_TAG' script: | - dnf install -y diffutils wget tar - wget https://get.helm.sh/helm-v3.15.3-linux-386.tar.gz - tar -zxvf helm-v3.15.3-linux-386.tar.gz - mv linux-386/helm /usr/local/bin/helm - rm helm-v3.15.3-linux-386.tar.gz - rm -rf linux-386 sed -i "s/^version:.*/version: ${CI_COMMIT_TAG}/" Chart.yaml helm package . - echo $REGISTRY_PASSWORD | helm registry login https://registry.cern.ch/v2/ -u $REGISTRY_USER --password-stdin + echo ${REGISTRY_PASSWORD} | helm registry login registry.cern.ch -u $REGISTRY_USER --password-stdin helm push cern-it-monitoring-kubernetes-$CI_COMMIT_TAG.tgz oci://registry.cern.ch/monit