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

use empty CHART_DIR string but do not break other commands

parent 8a165029
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# 1. CHART_NAME: the name of the helm chart. Should correspond to the name in # 1. CHART_NAME: the name of the helm chart. Should correspond to the name in
# Chart.yaml # Chart.yaml
# 2. CHART_DIR (optional): the directory where your helm chart is in you # 2. CHART_DIR (optional): the directory where your helm chart is in you
# repository. Defaults to '.' # repository. HAS TO END WITH A SLASH if you choose to override it.
variables: variables:
CHART_DIR: "" CHART_DIR: ""
...@@ -20,19 +20,19 @@ lint-helm: ...@@ -20,19 +20,19 @@ lint-helm:
name: alpine/helm:3.7.1 name: alpine/helm:3.7.1
entrypoint: ["/bin/sh", "-c"] entrypoint: ["/bin/sh", "-c"]
script: script:
- cd ${CHART_DIR} - cd ${CHART_DIR:-"."}
- helm dep update - helm dep update
- helm lint . - helm lint .
artifacts: artifacts:
paths: paths:
- '${CHART_DIR}/charts/**' - '${CHART_DIR}charts/**'
expire_in: 1 week expire_in: 1 week
# Even if lint fails, upload the charts/ folder as artifact # Even if lint fails, upload the charts/ folder as artifact
when: always when: always
rules: rules:
- changes: - changes:
- '${CHART_DIR}/*.yaml' - '${CHART_DIR}*.yaml'
- ${CHART_DIR}/templates/*.yaml - ${CHART_DIR}templates/*.yaml
package-chart: package-chart:
stage: package-helm-chart stage: package-helm-chart
...@@ -40,11 +40,11 @@ package-chart: ...@@ -40,11 +40,11 @@ package-chart:
name: alpine/helm:3.7.1 name: alpine/helm:3.7.1
entrypoint: ["/bin/sh", "-c"] entrypoint: ["/bin/sh", "-c"]
script: script:
- cd ${CHART_DIR} - cd ${CHART_DIR:-"."}
- helm package . - helm package .
artifacts: artifacts:
paths: paths:
- ${CHART_DIR}/${CHART_NAME}-* - ${CHART_DIR}${CHART_NAME}-*
expire_in: 1 week expire_in: 1 week
extends: extends:
- .chart_release_rules - .chart_release_rules
...@@ -55,7 +55,7 @@ release-helm: ...@@ -55,7 +55,7 @@ release-helm:
image: "rancher/curlimages-curl:7.73.0" image: "rancher/curlimages-curl:7.73.0"
stage: release-helm-chart stage: release-helm-chart
script: script:
- cd ${CHART_DIR} - cd ${CHART_DIR:-"."}
- if [ "$CI_COMMIT_BRANCH" == "main" ]; then export HELM_CHANNEL='stable'; else export HELM_CHANNEL='unstable'; fi - if [ "$CI_COMMIT_BRANCH" == "main" ]; then export HELM_CHANNEL='stable'; else export HELM_CHANNEL='unstable'; fi
- export CHART_FILE=$(ls ${CHART_NAME}-*.tgz) - 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" - 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"
......
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