Apply Pipeline
Introduction
The Apply Pipeline is the part of Cloud Platform that continuously deploys the environments repo into Cloud Platform’s Kubernetes cluster and AWS account. Service teams typically define their Kubernetes namespaces and AWS resources in the environments repo, and the Apply Pipeline is what gets it applied.
(Don’t confuse it with the application pipelines, which are created and managed by service teams. These deploy the Kubernetes resources which make up the application. The application in turn relies on the resources created by the Apply Pipeline - the namespace the application runs in and AWS services that it uses.)
How it operates
The Apply Pipeline is triggered when a Pull Request on the environments repo is merged to main
. The Apply Pipeline deploys the changes to whichever environments were changed in the PR.
Essentially it does:
kubectl -n your-namespace apply -f *.yaml
cd resources
terraform plan
terraform apply
It takes a minute to start the job and then usually around 1 to 2 minutes to run.
Viewing the Apply Pipeline
You can see the Apply Pipeline running in Concourse’s “Apply-namespace-changes-live” pipeline
Usage:
- When the apply pipeline starts, your PR will receive a comment containing a link to the apply job. If you follow this link, you will be able to follow the apply job as it logs out each step. This is a good habit as it allows you to verify that the resources applied correctly.
cloud-platform-concourse-bot comment:
eg. Your PR is applying in the build: https://concourse.cloud-platform.service.justice.gov.uk/teams/main/pipelines/environments-live/jobs/apply-namespace-changes-live/builds/1579
Alternatively you can:
- Sign in using your GitHub identity. (The first time, it takes you to a github.com page where you need to agree to Cloud Platform’s Concourse instance being allowed to view your GitHub identity.)
- Select the build corresponding to your PR merge (other people’s changes to environments also show up here). The latest build is at the top, but you can also identify yours by the merge commit hash.
- Select
task: apply-namespace-changes
to see the logs where terraform is applied.
Successes and failures
The colour of the header is green if the job was successful, or red for failure. A failing apply can disrupt other Service Teams who wish to apply their environment changes. So in this case, the Cloud Platform team will work quickly, hopefully with the PR author involved, to resolve or reverse changes, to resolve the failure.
Questions
If you have questions about the running of the Apply Pipeline, ask the team in #ask-cloud-platform.