From 8a4c33433f2825144355008c24be0a7850ebe54c Mon Sep 17 00:00:00 2001 From: Nacho Barrientos <nacho.barrientos@cern.ch> Date: Tue, 18 Mar 2025 10:07:22 +0100 Subject: [PATCH 1/3] Stop performing a version existence check registry.cern.ch/monit has been configured so all tags are immutable hence this is not necessary anymore. --- .gitlab-ci.yml | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 88b6c64..4d69778 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -63,34 +63,8 @@ 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 rules: - if: '$CI_COMMIT_TAG' script: | -- GitLab From 40510831f6f9938f7a3f5d763cbb49e76a7b786c Mon Sep 17 00:00:00 2001 From: Nacho Barrientos <nacho.barrientos@cern.ch> Date: Tue, 18 Mar 2025 10:13:06 +0100 Subject: [PATCH 2/3] Use alpine/helm to push the chart to registry.cern.ch --- .gitlab-ci.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4d69778..05df6fb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -65,16 +65,11 @@ unittest: helm_deploy: stage: deploy + 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 https://registry.cern.ch/v2/ -u $REGISTRY_USER --password-stdin helm push cern-it-monitoring-kubernetes-$CI_COMMIT_TAG.tgz oci://registry.cern.ch/monit -- GitLab From 362152209c67e2d917bc2f65e30c5dae0a909934 Mon Sep 17 00:00:00 2001 From: Nacho Barrientos <nacho.barrientos@cern.ch> Date: Tue, 18 Mar 2025 10:14:54 +0100 Subject: [PATCH 3/3] Use default entrypoint of registry.cern.ch (defaults v2) --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 05df6fb..eb50338 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -71,5 +71,5 @@ helm_deploy: script: | 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 -- GitLab