Blue Green Deployments
Background
Section titled “Background”The runner deployment follows the blue green deployment style.
The Deployer was created as a way to automate this process through the slack controlled command /runner.
Supported shards
Section titled “Supported shards”privateshared-gitlab-orgsaas-linux-large-amd64saas-linux-xlarge-amd64saas-linux-2xlarge-amd64saas-linux-medium-amd64-gpu-standardsaas-linux-medium-amd64saas-linux-small-amd64saas-linux-small-arm64saas-linux-medium-arm64saas-linux-large-arm64saas-macos-stagingsaas-macos-medium-m1saas-macos-large-m2pro
For a list of all shards see deployer/bin/ci.
Glossary
Section titled “Glossary”chef-repo: https://gitlab.com/gitlab-com/gl-infra/chef-repo where all chef configuration is located.terraform: https://ops.gitlab.net/gitlab-com/gl-infra/config-mgmt where all the terraform code is located.deployment: Referring ifblueorgreenis active, it can also be both.
Chef roles
Section titled “Chef roles”See runner-manager* list under chef-repo/roles
Deployment Example
Section titled “Deployment Example”WARNING: NEVER DEPLOY THE WHOLE RUNNER FLEET AT ONCE, ONLY DEPLOY EITHER THE BLUE OR THE GREEN
We will give an example of how to deploy from 17.0.0~pre.88.g761ae5dd-1 to 17.7.0~pre.103.g896916a8-1 on
the private shard.
-
Identify the active deployment via the ci-runners:: Deployment overview dashboard, let’s assume the active deployment is
blue. -
Open a merge request to
chef-repoto update the version for thegreendeployment. :point_right: https://gitlab.com/gitlab-com/gl-infra/chef-repo/-/merge_requests/5383- Make sure the merge request has the
~deployand~group::hosted runnerslabels.
- Make sure the merge request has the
-
Make sure that the package for version
17.7.0~pre.103.g896916a8-1is published -
Gather approval from the EOC via #production
@sre-oncall I'm going to perform GitLab Runner version upgrade on two shards.Details in https://gitlab.com/gitlab-com/gl-infra/chef-repo/-/merge_requests/5383.May I proceed? If yes, please approve the Merge Request. -
Get the merge request merged.
-
Wait for the CI to upload changes to the Chef Server.
-
Execute the chatops command in the
#productionchannel:/runner run start private greenThis will enable and execute
chef-clienton thegreendeployment to install17.7.0~pre.103.g896916a8-1and start thegitlab-runnerservice -
Wait for new deployments to start executing jobs, monitor in Kibana’s Runner index.
-
When
greendeployment is active and healthy trigger a graceful shutdown to thebluedeployment to stop thegitlab-runnerprocess and wait for all jobs to finish.To do this, execute the chatops command in the
#productionchannel:/runner run stop private blueThis will start draining the runner and deleting the machines so this command will take a while to run!
-
Continue to monitor ci-runners::Incident Support::runner-manager grafana dashboard.
Deficiencies
Section titled “Deficiencies”- Deactivated deployment instances stay around. Destroy deactivated deployment :point_right: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/36777
- Remove double concurrency window during deployment :point_right: https://gitlab.com/gitlab-com/gl-infra/reliability/-/issues/13844