62 lines
1.5 KiB
YAML
62 lines
1.5 KiB
YAML
stages:
|
|
- deploy
|
|
|
|
variables:
|
|
KUBERNETES_VERSION: 1.29.2
|
|
|
|
.deploy:
|
|
stage: deploy
|
|
image: alpine/k8s:${KUBERNETES_VERSION}
|
|
variables:
|
|
KUBE_CONTEXT:
|
|
DEPLOY_BRANCH:
|
|
rules:
|
|
- when: never
|
|
before_script:
|
|
- apk update && apk add gettext git
|
|
- export $(cat ${ENV} | xargs) > /dev/null
|
|
script:
|
|
- |
|
|
echo "Update infrastructure directory"
|
|
for manifest in $(find infrastructure -name *.yaml);
|
|
do envsubst < $manifest > $manifest.tmp;
|
|
mv $manifest.tmp $manifest;
|
|
done
|
|
- |
|
|
echo "Pushing updated manifests in ${DEPLOY_BRANCH} branch"
|
|
git config user.name "Bot Auto Deploy"
|
|
git config user.email "autodeploy@mediactivegroup.com"
|
|
git add --all
|
|
git commit -m "Bot Auto Commit"
|
|
git push --force https://project_access_token:${GITLAB_ACCESS_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git HEAD:${DEPLOY_BRANCH}
|
|
tags:
|
|
- flux
|
|
- k8s
|
|
|
|
deploy:staging:
|
|
extends:
|
|
- .deploy
|
|
variables:
|
|
KUBE_CONTEXT: ldc-web/cluster-k8s:dev-k8s-ldc-web
|
|
DEPLOY_BRANCH: deploy/staging
|
|
environment:
|
|
name: staging
|
|
rules:
|
|
- if: $CI_COMMIT_REF_NAME == "develop"
|
|
when: manual
|
|
allow_failure: true
|
|
- when: never
|
|
|
|
deploy:production:
|
|
extends:
|
|
- .deploy
|
|
variables:
|
|
KUBE_CONTEXT: ldc-web/cluster-k8s:prod-k8s-ldc-web
|
|
DEPLOY_BRANCH: deploy/production
|
|
environment:
|
|
name: production
|
|
rules:
|
|
- if: $CI_COMMIT_REF_NAME == "master"
|
|
when: manual
|
|
allow_failure: true
|
|
- when: never
|