Company: CapitalOne | Difficulty: Medium
You are setting up a GitOps pipeline. repo-a contains the application source code, and repo-b contains the Kubernetes configuration (values.yaml).
When code is pushed to repo-a, the pipeline must:
- Build a Docker image tagged with the Short Git SHA.
- Automatically update
repo-bto use this new image tag.
Edit the existing workflow file at /home/interview/repo-a/.github/workflows/promote.yml to complete the pipeline.
- Calculate SHA: Finish the step to extract the first 7 characters of
$GITHUB_SHAinto an environment variable namedSHORT_SHA. - Build: Build a Docker image named
apptagged with${{ env.SHORT_SHA }}. - Checkout Infrastructure: Configure the
checkoutstep to cloneinterview/repo-binto a directory namedinfra. - Promote: Inside the
infradirectory:- Update
values.yamlso that thetagkey reflects the newSHORT_SHA. - Commit the change with the message:
Update tag to <SHORT_SHA>.
- Update