In CI, after building image `api:1.4.2`, a script must update the tag in a GitOps repo and open a PR. How?
IntermediateScenarioScenarios: deployments, user management and fleet operations
Answer
Situation read → Edit YAML structurally, commit on a branch, push, and open a PR with the CLI.
What I'd do →
export NEW_TAG=1.4.2
git clone --depth 1 "https://x-access-token:${GH_TOKEN}@github.com/acme/gitops.git" && cd gitops
git switch -c "bump-api-$NEW_TAG"
yq -i '.image.tag = strenv(NEW_TAG)' apps/api/values-prod.yaml
git diff --quiet && { echo "already at $NEW_TAG"; exit 0; }
git -c user.name=ci-bot -c [email protected] commit -am "api: bump image to $NEW_TAG"
git push -u origin HEAD
gh pr create --title "api: $NEW_TAG to prod" --body "Automated bump from build $GITHUB_RUN_ID" --base main
yqwithstrenvkeeps formatting and avoids quoting bugs.git diff --quietmakes reruns harmless.
Why → GitOps requires the change to land through Git with review, not via kubectl set image.
Interview tip → Mention that tools like Argo CD Image Updater or Renovate can do this automatically.
More on Scenarios: deployments, user management and fleet operations
Write the core of a deploy script with release directories, an atomic symlink switch and rollback.IntermediateDeploy to 10 servers behind an AWS ALB one at a time, removing each from the target group during its deploy. Outline the script.AdvancedAfter a deploy, the health check fails intermittently. Your script must roll back automatically, but only if the failure persists. How?IntermediateImplement a blue/green switch on a single nginx host with a script.AdvancedOnboard 30 engineers: create accounts and install their SSH keys from their GitHub usernames, idempotently.IntermediateAn engineer leaves the company. Write the offboarding steps for Linux servers.Intermediate