Skip to content

Instantly share code, notes, and snippets.

@SippieCup
Created June 5, 2021 00:49
Show Gist options
  • Save SippieCup/310e077e872e962828447e59d5184723 to your computer and use it in GitHub Desktop.
Save SippieCup/310e077e872e962828447e59d5184723 to your computer and use it in GitHub Desktop.
Autodevops dual deployment overlay
include:
- template: Auto-DevOps.gitlab-ci.yml
.auto-deploy:
image: registry.gitlab.com/gitlab-org/cluster-integration/auto-deploy-image:v2.7.0
variables:
AUTO_DEVOPS_FORCE_DEPLOY_V2: 1
dependencies: []
.local: &local_template
extends: .auto-deploy
stage: production
script:
- auto-deploy check_kube_domain
- auto-deploy download_chart
- auto-deploy ensure_namespace
- auto-deploy initialize_tiller
- auto-deploy create_secret
- auto-deploy deploy
- auto-deploy delete canary
- auto-deploy delete rollout
- auto-deploy persist_environment_url
environment:
name: local
url: http://$CI_PROJECT_PATH_SLUG.$KUBE_INGRESS_BASE_DOMAIN
artifacts:
paths: [ environment_url.txt, tiller.log ]
when: always
local_manual:
<<: *local_template
allow_failure: false
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
when: manual
.production: &production_template
extends: .auto-deploy
stage: production
script:
- auto-deploy check_kube_domain
- auto-deploy download_chart
- auto-deploy ensure_namespace
- auto-deploy initialize_tiller
- auto-deploy create_secret
- auto-deploy deploy
- auto-deploy delete canary
- auto-deploy delete rollout
- auto-deploy persist_environment_url
environment:
name: production
url: http://$CI_PROJECT_PATH_SLUG.$KUBE_INGRESS_BASE_DOMAIN
artifacts:
paths: [environment_url.txt, tiller.log]
when: always
production:
<<: *production_template
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
when: manual
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment