Skip to content
Snippets Groups Projects
Verified Commit 4e1d1b20 authored by Maarten de Waard's avatar Maarten de Waard :angel:
Browse files

add helm chart build and publish pipeline

parent 52316f27
No related branches found
No related tags found
1 merge request!80Resolve "Automatically push helm chart to chart repository"
Pipeline #10269 passed
---
image:
name: alpine/helm:3.7.1
entrypoint: ["/bin/sh", "-c"]
# A Gitlab CI job template for building docker images using kaniko.
#
......@@ -25,9 +28,9 @@
stages:
- build
default:
image: "${CI_REGISTRY_IMAGE}/${KANIKO_BUILD_IMAGENAME}:${CI_COMMIT_REF_SLUG}"
- lint-helm-chart
- package-helm-chart
- release-helm-chart
build-wp-cli:
stage: build
......@@ -60,3 +63,49 @@ build-wp:
when: on_success
- if: '$CI_COMMIT_TAG'
when: on_success
# Only package a new chart once the version number has been updated
.chart_release_rules:
rules:
- changes:
- Chart.yaml
lint-helm:
stage: lint-helm-chart
script:
- helm dep update
- helm lint .
artifacts:
paths:
- 'charts/**'
expire_in: 1 week
# Even if lint fails, upload the charts/ folder as artifact
when: always
allow_failure: true
rules:
- changes:
- '*.yaml'
- templates/*.yaml
package-chart:
stage: package-helm-chart
script:
- helm package .
artifacts:
paths:
- wordpress-*
expire_in: 1 week
extends:
- .chart_release_rules
# Push helm chart. Charts on the `main` branch are pushed to `stable`, others
# are pushed to the `unstable` channel.
release-helm:
image: "rancher/curlimages-curl:7.73.0"
stage: release-helm-chart
script:
- if [ "$CI_COMMIT_BRANCH" == "main" ]; then export HELM_CHANNEL='stable'; else export HELM_CHANNEL='unstable'; fi
- export CHART_FILE=$(ls wordpress-*.tgz)
- curl --request POST --user gitlab-ci-token:$CI_JOB_TOKEN --form "chart=@${CHART_FILE}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/api/${HELM_CHANNEL}/charts"
extends:
- .chart_release_rules
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment