debian-mirror-gitlab/lib/gitlab/ci/templates/Jobs/Deploy.gitlab-ci.yml

247 lines
6.7 KiB
YAML
Raw Normal View History

2019-10-12 21:52:04 +05:30
.auto-deploy:
2021-09-04 01:27:46 +05:30
image: "registry.gitlab.com/gitlab-org/cluster-integration/auto-deploy-image:v2.6.0"
2020-07-28 23:09:34 +05:30
dependencies: []
2020-05-24 23:13:21 +05:30
2019-07-07 11:18:12 +05:30
review:
2019-10-12 21:52:04 +05:30
extends: .auto-deploy
2019-07-07 11:18:12 +05:30
stage: review
script:
2019-10-12 21:52:04 +05:30
- 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 persist_environment_url
2019-07-07 11:18:12 +05:30
environment:
name: review/$CI_COMMIT_REF_NAME
url: http://$CI_PROJECT_ID-$CI_ENVIRONMENT_SLUG.$KUBE_INGRESS_BASE_DOMAIN
on_stop: stop_review
artifacts:
2020-07-28 23:09:34 +05:30
paths: [environment_url.txt, tiller.log]
when: always
2020-05-24 23:13:21 +05:30
rules:
- if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
when: never
2021-04-17 20:07:23 +05:30
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
2020-05-24 23:13:21 +05:30
when: never
- if: '$REVIEW_DISABLED'
when: never
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
2019-07-07 11:18:12 +05:30
stop_review:
2019-10-12 21:52:04 +05:30
extends: .auto-deploy
2019-07-07 11:18:12 +05:30
stage: cleanup
variables:
GIT_STRATEGY: none
script:
2019-10-12 21:52:04 +05:30
- auto-deploy initialize_tiller
- auto-deploy delete
2019-07-07 11:18:12 +05:30
environment:
name: review/$CI_COMMIT_REF_NAME
action: stop
allow_failure: true
2020-05-24 23:13:21 +05:30
rules:
- if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
when: never
2021-04-17 20:07:23 +05:30
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
2020-05-24 23:13:21 +05:30
when: never
- if: '$REVIEW_DISABLED'
when: never
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
when: manual
2019-07-07 11:18:12 +05:30
# Staging deploys are disabled by default since
# continuous deployment to production is enabled by default
# If you prefer to automatically deploy to staging and
# only manually promote to production, enable this job by setting
# STAGING_ENABLED.
staging:
2019-10-12 21:52:04 +05:30
extends: .auto-deploy
2019-07-07 11:18:12 +05:30
stage: staging
script:
2019-10-12 21:52:04 +05:30
- auto-deploy check_kube_domain
- auto-deploy download_chart
- auto-deploy ensure_namespace
- auto-deploy initialize_tiller
- auto-deploy create_secret
- auto-deploy deploy
2019-07-07 11:18:12 +05:30
environment:
name: staging
url: http://$CI_PROJECT_PATH_SLUG-staging.$KUBE_INGRESS_BASE_DOMAIN
2020-05-24 23:13:21 +05:30
rules:
- if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
when: never
2021-04-17 20:07:23 +05:30
- if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
2020-05-24 23:13:21 +05:30
when: never
- if: '$STAGING_ENABLED'
2019-07-07 11:18:12 +05:30
# Canaries are disabled by default, but if you want them,
# and know what the downsides are, you can enable this by setting
# CANARY_ENABLED.
canary:
2019-10-12 21:52:04 +05:30
extends: .auto-deploy
2019-07-07 11:18:12 +05:30
stage: canary
2020-05-30 21:06:31 +05:30
allow_failure: true
2019-07-07 11:18:12 +05:30
script:
2019-10-12 21:52:04 +05:30
- auto-deploy check_kube_domain
- auto-deploy download_chart
- auto-deploy ensure_namespace
- auto-deploy initialize_tiller
- auto-deploy create_secret
2021-09-04 01:27:46 +05:30
- auto-deploy deploy canary 50
2019-07-07 11:18:12 +05:30
environment:
name: production
url: http://$CI_PROJECT_PATH_SLUG.$KUBE_INGRESS_BASE_DOMAIN
2020-05-24 23:13:21 +05:30
rules:
- if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
when: never
2021-04-17 20:07:23 +05:30
- if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
2020-05-24 23:13:21 +05:30
when: never
- if: '$CANARY_ENABLED'
when: manual
2019-07-07 11:18:12 +05:30
.production: &production_template
2019-10-12 21:52:04 +05:30
extends: .auto-deploy
2019-07-07 11:18:12 +05:30
stage: production
script:
2019-10-12 21:52:04 +05:30
- 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 persist_environment_url
2019-07-07 11:18:12 +05:30
environment:
name: production
url: http://$CI_PROJECT_PATH_SLUG.$KUBE_INGRESS_BASE_DOMAIN
artifacts:
2020-07-28 23:09:34 +05:30
paths: [environment_url.txt, tiller.log]
when: always
2019-07-07 11:18:12 +05:30
production:
<<: *production_template
2020-05-24 23:13:21 +05:30
rules:
- if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
when: never
- if: '$STAGING_ENABLED'
when: never
- if: '$CANARY_ENABLED'
when: never
- if: '$INCREMENTAL_ROLLOUT_ENABLED'
when: never
- if: '$INCREMENTAL_ROLLOUT_MODE'
when: never
2021-04-17 20:07:23 +05:30
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
2019-07-07 11:18:12 +05:30
production_manual:
<<: *production_template
allow_failure: false
2020-05-24 23:13:21 +05:30
rules:
- if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
when: never
- if: '$INCREMENTAL_ROLLOUT_ENABLED'
when: never
- if: '$INCREMENTAL_ROLLOUT_MODE'
when: never
2021-04-17 20:07:23 +05:30
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $STAGING_ENABLED'
2020-05-24 23:13:21 +05:30
when: manual
2021-04-17 20:07:23 +05:30
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CANARY_ENABLED'
2020-05-24 23:13:21 +05:30
when: manual
2019-07-07 11:18:12 +05:30
2021-04-17 20:07:23 +05:30
# This job implements incremental rollout on for every push to the default branch.
2019-07-07 11:18:12 +05:30
.rollout: &rollout_template
2019-10-12 21:52:04 +05:30
extends: .auto-deploy
2019-07-07 11:18:12 +05:30
script:
2019-10-12 21:52:04 +05:30
- auto-deploy check_kube_domain
- auto-deploy download_chart
- auto-deploy ensure_namespace
- auto-deploy initialize_tiller
- auto-deploy create_secret
2021-09-04 01:27:46 +05:30
- auto-deploy deploy canary $ROLLOUT_PERCENTAGE
2019-10-12 21:52:04 +05:30
- auto-deploy persist_environment_url
2019-07-07 11:18:12 +05:30
environment:
name: production
url: http://$CI_PROJECT_PATH_SLUG.$KUBE_INGRESS_BASE_DOMAIN
artifacts:
2020-07-28 23:09:34 +05:30
paths: [environment_url.txt, tiller.log]
when: always
2019-07-07 11:18:12 +05:30
.manual_rollout_template: &manual_rollout_template
<<: *rollout_template
stage: production
2020-06-23 00:09:42 +05:30
resource_group: production
2020-05-30 21:06:31 +05:30
allow_failure: true
2020-05-24 23:13:21 +05:30
rules:
- if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
when: never
- if: '$INCREMENTAL_ROLLOUT_MODE == "timed"'
when: never
2021-04-17 20:07:23 +05:30
- if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
2020-05-24 23:13:21 +05:30
when: never
2021-01-29 00:20:46 +05:30
# $INCREMENTAL_ROLLOUT_ENABLED is for compatibility with pre-GitLab 11.4 syntax
2020-05-24 23:13:21 +05:30
- if: '$INCREMENTAL_ROLLOUT_MODE == "manual" || $INCREMENTAL_ROLLOUT_ENABLED'
when: manual
2019-07-07 11:18:12 +05:30
.timed_rollout_template: &timed_rollout_template
<<: *rollout_template
2020-05-24 23:13:21 +05:30
rules:
- if: '$CI_KUBERNETES_ACTIVE == null || $CI_KUBERNETES_ACTIVE == ""'
when: never
- if: '$INCREMENTAL_ROLLOUT_MODE == "manual"'
when: never
2021-04-17 20:07:23 +05:30
- if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
2020-05-24 23:13:21 +05:30
when: never
- if: '$INCREMENTAL_ROLLOUT_MODE == "timed"'
when: delayed
start_in: 5 minutes
2019-07-07 11:18:12 +05:30
timed rollout 10%:
<<: *timed_rollout_template
stage: incremental rollout 10%
variables:
ROLLOUT_PERCENTAGE: 10
timed rollout 25%:
<<: *timed_rollout_template
stage: incremental rollout 25%
variables:
ROLLOUT_PERCENTAGE: 25
timed rollout 50%:
<<: *timed_rollout_template
stage: incremental rollout 50%
variables:
ROLLOUT_PERCENTAGE: 50
timed rollout 100%:
<<: *timed_rollout_template
<<: *production_template
stage: incremental rollout 100%
variables:
ROLLOUT_PERCENTAGE: 100
rollout 10%:
<<: *manual_rollout_template
variables:
ROLLOUT_PERCENTAGE: 10
rollout 25%:
<<: *manual_rollout_template
variables:
ROLLOUT_PERCENTAGE: 25
rollout 50%:
<<: *manual_rollout_template
variables:
ROLLOUT_PERCENTAGE: 50
rollout 100%:
<<: *manual_rollout_template
<<: *production_template
allow_failure: false