diff --git a/pipelines/helm.yaml b/pipelines/helm.yaml new file mode 100644 index 0000000..f717d86 --- /dev/null +++ b/pipelines/helm.yaml @@ -0,0 +1,46 @@ +stages: + - build + - publish + +include: + - template: Security/Secret-Detection.gitlab-ci.yml + - project: 'developerdurp/yml' + ref: main + file: + - 'jobs/version.yml' + - 'jobs/helm.yml' + +secret_detection: + stage: .pre + rules: + - when: always + allow_failure: false + +version: + extends: .version + stage: .pre + rules: + - if: $CI_COMMIT_REF_NAME == 'main' + - if: $CI_COMMIT_BRANCH =~ '/^release/' + +helm-build: + extends: .helm-build + stage: build + needs: + - job: version + artifacts: true + rules: + - if: $CI_COMMIT_REF_NAME == 'main' + - if: $CI_COMMIT_BRANCH =~ '/^release/' + +helm: + extends: .helm-push + stage: publish + needs: + - job: helm-build + artifacts: false + - job: version + artifacts: true + rules: + - if: $CI_COMMIT_REF_NAME == 'main' + - if: $CI_COMMIT_BRANCH =~ '/^release/' diff --git a/scripts/helm-login.sh b/scripts/helm-login.sh new file mode 100644 index 0000000..65f9fb0 --- /dev/null +++ b/scripts/helm-login.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +#%%MULTILINE_YAML_START +#Helm login + +helm registry login ${CI_REGISTRY} -u gitlab-ci-token -p ${CI_JOB_TOKEN} \ No newline at end of file diff --git a/scripts/helm-push.sh b/scripts/helm-push.sh index 2dae5dc..2e78c63 100644 --- a/scripts/helm-push.sh +++ b/scripts/helm-push.sh @@ -2,7 +2,6 @@ #%%MULTILINE_YAML_START #Helm Push -helm plugin install https://github.com/chartmuseum/helm-push for chart in packages/*; do - helm cm-push ./$chart ${CI_PROJECT_NAME} -done + helm push ./$chart oci://$CI_REGISTRY/$CI_PROJECT_PATH +done \ No newline at end of file diff --git a/templates/helm.tpl.yml b/templates/helm.tpl.yml index e96c621..a3dc63e 100644 --- a/templates/helm.tpl.yml +++ b/templates/helm.tpl.yml @@ -1,6 +1,11 @@ -.helm-createchart: - image: registry.durp.info/dtzar/helm-kubectl +.helm-build: + image: dtzar/helm-kubectl script: - - ./scripts/helm-addrepo.sh + - ./scripts/variablecheck-version.sh - ./scripts/helm-package.sh + +.helm_push: + image: dtzar/helm-kubectl + script: + - ./scripts/helm-registry-login.sh - ./scripts/helm-push.sh