Skip to content
Snippets Groups Projects
Commit 7221bb07 authored by Remi  PLANEL's avatar Remi PLANEL
Browse files

add gitlab-ci

parent b7789224
No related branches found
No related tags found
No related merge requests found
Pipeline #154406 failed
stages:
- build
build:
stage: build
image: harbor.pasteur.fr/kube-system/helm-kubectl:3.12.0
script:
- echo "Building helm chart"
- CHART_VERSION=$(helm show chart . | grep version | cut -d' ' -f2)
- CHART_NAME=$(helm show chart . | grep name | cut -d' ' -f2)
- echo $CHART_NAME
- echo $CHART_VERSION
- |
if [ "main" == "${CI_COMMIT_REF_SLUG}" ]; then
export CHANNEL="stable"
else
export CHANNEL="${CI_COMMIT_REF_SLUG}"
fi
echo $CHANNEL
- export CHART_RELEASE_NAME="${CHART_NAME}-${CHART_VERSION}.tgz"
- echo $CHART_RELEASE_NAME
- helm package .
- HTTP_CODE=$(curl -o /dev/null --silent -Iw '%{http_code}' "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/${CHANNEL}/charts/${CHART_RELEASE_NAME}")
- |
if [ $HTTP_CODE == "200" ]; then
echo "Shouln't publish this version as version ${CHART_VERSION}:"
echo "It already is in the package registry, please increase its version number"
exit 5
else
echo "Version not already published, continuing publication process"
fi
- curl --request POST --user gitlab-ci-token:$CI_JOB_TOKEN --form "chart=@${CHART_RELEASE_NAME}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/api/${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