From 7a870dafcd30d94769350fd329af679462b3bb0b Mon Sep 17 00:00:00 2001 From: Rebecca Valente Date: Tue, 8 Jul 2025 11:47:40 -0300 Subject: [PATCH] devops: add ci/cd configuration for generating and pushing kubernetes helm charts to a local repository. --- ...and-push-to-local-repository.gitlab-ci.yml | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 jobs/helm-chart-generate-and-push-to-local-repository.gitlab-ci.yml diff --git a/jobs/helm-chart-generate-and-push-to-local-repository.gitlab-ci.yml b/jobs/helm-chart-generate-and-push-to-local-repository.gitlab-ci.yml new file mode 100644 index 0000000..bf26964 --- /dev/null +++ b/jobs/helm-chart-generate-and-push-to-local-repository.gitlab-ci.yml @@ -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} +