devops: added configuration and commands for generating and pushing kubernetes manifests in the gitlab ci pipeline.
This commit is contained in:
parent
e560622033
commit
6dd9c27813
@ -1,4 +1,5 @@
|
||||
Generate and Push Kubernetes Manifests:
|
||||
image: rbvtopudding/devops:latest
|
||||
stage: deploy
|
||||
before_script:
|
||||
- |
|
||||
@ -9,17 +10,26 @@ Generate and Push Kubernetes Manifests:
|
||||
else
|
||||
export ENVIRONMENT="dev";
|
||||
fi
|
||||
|
||||
script:
|
||||
- helm dependency update ${HELM_CHART_PATH}
|
||||
- rm -rf .k8s/${ENVIRONMENT}/manifests
|
||||
- mkdir -p .k8s/${ENVIRONMENT}/manifests
|
||||
- |
|
||||
helm template \
|
||||
--values ${HELM_CHART_VALUES_PATH} \
|
||||
${HELM_CHART_EXTRA_OPTS} \
|
||||
${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 config --global user.name "$CI_PROJECT_NAME"
|
||||
- git config --global user.email "${CI_COMMIT_AUTHOR_EMAIL}"
|
||||
- |
|
||||
echo ${CI_PROJECT_URL} | \
|
||||
sed 's/https:\/\///' | \
|
||||
xargs -I## git remote add remote_origin "https://oauth2:${COMMIT_TOKEN}@##.git"
|
||||
- git add --all
|
||||
- git commit -m "[${ENVIRONMENT}] manifests updated, [ci skip]"
|
||||
- git push -o ci.skip
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user