Skip to content
Snippets Groups Projects
Commit 3749804e authored by Varac's avatar Varac
Browse files

Merge branch 'host-chart-publish-defaults' into 'main'

add helm package CI template

See merge request stackspin/stackspin!678
parents a566af2c fa9c4bc7
No related branches found
No related tags found
No related merge requests found
# Include this file if you want to package your helm chart to a helm registry.
# You'll need to set two variables:
#
# 1. CHART_NAME: the name of the helm chart. Should correspond to the name in
# Chart.yaml
# 2. CHART_DIR (optional): the directory where your helm chart is in you
# repository. HAS TO END WITH A SLASH if you choose to override it.
variables:
CHART_DIR: ""
.chart_release_rules:
rules:
- changes:
- ${CHART_DIR}Chart.yaml
lint-helm:
stage: lint-helm-chart
image:
name: alpine/helm:3.7.1
entrypoint: ["/bin/sh", "-c"]
script:
- cd ${CHART_DIR:-"."}
- helm dep update
- helm lint .
artifacts:
paths:
- '${CHART_DIR}charts/**'
expire_in: 1 week
# Even if lint fails, upload the charts/ folder as artifact
when: always
rules:
- changes:
- ${CHART_DIR}*.yaml
- ${CHART_DIR}templates/*.yaml
package-chart:
stage: package-helm-chart
image:
name: alpine/helm:3.7.1
entrypoint: ["/bin/sh", "-c"]
script:
- cd ${CHART_DIR:-"."}
- helm package .
artifacts:
paths:
- ${CHART_DIR}${CHART_NAME}-*
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:
- cd ${CHART_DIR:-"."}
- if [ "$CI_COMMIT_BRANCH" == "main" ]; then export HELM_CHANNEL='stable'; else export HELM_CHANNEL='unstable'; fi
- export CHART_FILE=$(ls ${CHART_NAME}-*.tgz)
- curl --fail --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.
Finish editing this message first!
Please register or to comment