Goal
A delivery path with no stored cloud credentials: four parallel quality and security jobs on every pull request, images built in ACR Tasks and scanned by digest, the digest committed to the GitOps repository, and production behind an approval and a manual sync.
- Quality and security gatesbackend, semgrep, frontend and iac jobs run in parallel on every pull request.Done
- Build in the cloud, scan by digestACR Tasks builds the images; Trivy scans repo@digest, the exact bytes that will run.Done
- Promotion by pull requestfeature, develop, staging and main map to the three environments.Done
- Approval gate for prodA GitHub environment needs a reviewer, then a manual Argo CD sync.Done
- Rehearsed rollbackrollback.yml restores the previous values with one commit.Done
Steps and commands
Run these in dev first. Every step has a check that proves it worked, so you are never guessing.
Open a pull request and read the checks
The four jobs run in parallel: backend (tests, Bandit, pip-audit), semgrep, frontend (lint, build, npm audit) and iac (Terraform validate, Checkov, Trivy config scan).
$ gh pr create --fill $ gh pr checksCheck: all four jobs are green before a merge is possible.Let the build job do its work
On a push, the job logs in to Azure with OIDC, builds both images in ACR Tasks, resolves each digest and scans repo@digest with Trivy.
$ gh run view $ az acr repository show-tags -n paktechacr --repository paktech-chat-api -o tableCheck: the new tag exists in the registry and the Trivy step passed.Watch the gitops job commit the digest
The job commits the new digest to the GitOps repository. For dev and staging, Argo CD syncs automatically.
$ kubectl -n paktech-chat-dev get pods -w $ kubectl get applications -n argocdCheck: new pods start before the old ones stop, and the application is Synced.Approve and promote to prod
The gitops job waits at the prod environment gate. After approval, read the two-line digest diff in Argo CD and sync by hand.
# GitHub: approve the pending prod deployment # Argo CD: App Diff -> read the digest change -> SyncCheck: the prod application is OutOfSync until you sync, then Healthy with the new digest.Rehearse the rollback
Run the manual rollback workflow for dev with one step back, then roll forward again.
# Actions -> rollback.yml -> Run workflow (environment dev, steps_back 1)Check: a commit restores the previous tag, new pods start before old ones stop, and the app keeps working.
Workflow
The path from a push to a running pod, with the gate where prod waits for a human.
- STEP 1PushPull request
- STEP 2ChecksFour parallel jobs
- STEP 3BuildACR Tasks, OIDC
- STEP 4ScanTrivy by digest
- STEP 5GitOps commitDigest to Git
- STEP 6Argo CDAuto, or manual in prod
Rollback: Run rollback.yml. It restores the previous values file in the GitOps repository, and Argo CD redeploys the old image. Argo CD polls every 3 minutes, so use a hard refresh to speed it up.
Diagram



Issues met
These are real, from the run. The surprises are the useful part.
Trade-offs
Why: Nothing is built on the runner, the image never leaves Azure on the way to the registry, and the digest comes straight from ACR.
It costs: Build logs live in two places and the build depends on ACR Tasks being available.
Why: Two deliberate human steps for the environment that matters, with a readable two-line diff in between.
It costs: Slower releases and a person who has to be there.
Why: A tag can be moved after it was scanned; a digest cannot. The scan, the commit and the running pod refer to the same bytes.
It costs: Less readable than tags, so the pipeline records both.