diff options
Diffstat (limited to 'lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml')
-rw-r--r-- | lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml | 95 |
1 files changed, 59 insertions, 36 deletions
diff --git a/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml b/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml index a96595b33a5..72547c1b407 100644 --- a/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml +++ b/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml @@ -25,8 +25,9 @@ # level, or manually added below. # # Continuous deployment to production is enabled by default. -# If you want to deploy to staging first, or enable incremental rollouts, -# set STAGING_ENABLED or INCREMENTAL_ROLLOUT_ENABLED environment variables. +# If you want to deploy to staging first, set STAGING_ENABLED environment variable. +# If you want to enable incremental rollout, either manual or time based, +# set INCREMENTAL_ROLLOUT_TYPE environment variable to "manual" or "timed". # If you want to use canary deployments, set CANARY_ENABLED environment variable. # # If Auto DevOps fails to detect the proper buildpack, or if you want to @@ -61,6 +62,10 @@ stages: - staging - canary - production + - incremental rollout 10% + - incremental rollout 25% + - incremental rollout 50% + - incremental rollout 100% - performance - cleanup @@ -282,11 +287,6 @@ stop_review: variables: - $REVIEW_DISABLED -# Keys that start with a dot (.) will not be processed by GitLab CI. -# Staging and canary jobs are disabled by default, to enable them -# remove the dot (.) before the job name. -# https://docs.gitlab.com/ee/ci/yaml/README.html#hidden-keys - # Staging deploys are disabled by default since # continuous deployment to production is enabled by default # If you prefer to automatically deploy to staging and @@ -368,6 +368,7 @@ production: - $STAGING_ENABLED - $CANARY_ENABLED - $INCREMENTAL_ROLLOUT_ENABLED + - $INCREMENTAL_ROLLOUT_MODE production_manual: <<: *production_template @@ -383,11 +384,11 @@ production_manual: except: variables: - $INCREMENTAL_ROLLOUT_ENABLED + - $INCREMENTAL_ROLLOUT_MODE # This job implements incremental rollout on for every push to `master`. .rollout: &rollout_template - stage: production script: - check_kube_domain - install_dependencies @@ -405,52 +406,77 @@ production_manual: artifacts: paths: [environment_url.txt] -rollout 10%: +.manual_rollout_template: &manual_rollout_template <<: *rollout_template - variables: - ROLLOUT_PERCENTAGE: 10 + stage: production when: manual + # This selectors are backward compatible mode with $INCREMENTAL_ROLLOUT_ENABLED (before 11.4) only: refs: - master kubernetes: active variables: + - $INCREMENTAL_ROLLOUT_MODE == "manual" - $INCREMENTAL_ROLLOUT_ENABLED + except: + variables: + - $INCREMENTAL_ROLLOUT_MODE == "timed" -rollout 25%: +.timed_rollout_template: &timed_rollout_template <<: *rollout_template - variables: - ROLLOUT_PERCENTAGE: 25 - when: manual + when: delayed + start_in: 5 minutes only: refs: - master kubernetes: active variables: - - $INCREMENTAL_ROLLOUT_ENABLED + - $INCREMENTAL_ROLLOUT_MODE == "timed" + +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%: - <<: *rollout_template + <<: *manual_rollout_template variables: ROLLOUT_PERCENTAGE: 50 - when: manual - only: - refs: - - master - kubernetes: active - variables: - - $INCREMENTAL_ROLLOUT_ENABLED rollout 100%: + <<: *manual_rollout_template <<: *production_template - when: manual allow_failure: false - only: - refs: - - master - kubernetes: active - variables: - - $INCREMENTAL_ROLLOUT_ENABLED # --------------------------------------------------------------------------- @@ -689,9 +715,6 @@ rollout 100%: helm version --client tiller -version - helm init --client-only - helm plugin install https://github.com/adamreese/helm-local - curl -L -o /usr/bin/kubectl "https://storage.googleapis.com/kubernetes-release/release/v${KUBERNETES_VERSION}/bin/linux/amd64/kubectl" chmod +x /usr/bin/kubectl kubectl version --client @@ -800,9 +823,9 @@ rollout 100%: function initialize_tiller() { echo "Checking Tiller..." - helm local start - helm local status export HELM_HOST=":44134" + tiller -listen ${HELM_HOST} -alsologtostderr > /dev/null 2>&1 & + echo "Tiller is listening on ${HELM_HOST}" if ! helm version --debug; then echo "Failed to init Tiller." |