31 lines
904 B
YAML
31 lines
904 B
YAML
Generate and Push Kubernetes Manifests:
|
|
stage: deploy
|
|
before_script:
|
|
- |
|
|
if test ${CI_COMMIT_REF_NAME} = "main"; then
|
|
export ENVIRONMENT="prd";
|
|
elif test ${CI_COMMIT_REF_NAME} = "staging"; then
|
|
export ENVIRONMENT="stg";
|
|
else
|
|
export ENVIRONMENT="dev";
|
|
fi
|
|
script:
|
|
- helm dependency update ${HELM_CHART_PATH}
|
|
- rm -rf .k8s/${ENVIRONMENT}/manifests
|
|
- mkdir -p .k8s/${ENVIRONMENT}/manifests
|
|
- |
|
|
helm template \
|
|
${HELM_CHART_NAME} \
|
|
${HELM_CHART_PATH} \
|
|
--output-dir /tmp/manifests
|
|
- mv /tmp/manifests/${HELM_CHART_NAME}/templates/*.yaml .k8s/${ENVIRONMENT}/manifests/
|
|
- rm -rf /tmp/manifests/${HELM_CHART_NAME}
|
|
- git add .k8s/${ENVIRONMENT}/manifests
|
|
- git commit -m "[${ENVIRONMENT}] manifests updated, [ci skip]"
|
|
- git push -o ci.skip
|
|
only:
|
|
- main
|
|
- staging
|
|
- develop
|
|
|