devops: add ci/cd configuration for generating and pushing kubernetes helm charts to a local repository.

This commit is contained in:
Rebecca Valente 2025-07-08 11:47:40 -03:00
parent 0dbc6286c2
commit 7a870dafcd

View File

@ -0,0 +1,23 @@
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}