CI/CD4 min read· 3 practice problems

CI/CD deploy failed or shipped the old version: check by stage (trigger, build, push, rollout)

When a pipeline never runs, goes red, or ends green with the old version still live, find which stage broke — trigger, build, registry push, deploy credentials or rollout — and the one command to check first at each stage.

On this page
  1. Short answer: first find which stage broke
  2. 30-second diagnosis: did it run, and where did it stop?
  3. Trigger: there is no run at all
  4. Build and push: find the first error line
  5. Deploy step: authentication or authorization?
  6. Rollout and "green but old version"
  7. What not to do
  8. The order to work in
  9. Quick diagnostic checklist

Short answer: first find which stage broke

CI/CD failures look alike from the outside, but where you should look depends entirely on the stage that broke. A pipeline almost always goes wrong at one of six stages, and each stage has one command or log to check first.

  1. Trigger — the workflow never ran
  2. Build and test — a red run; you need the failing step
  3. Registry push — the image push is rejected on auth or permissions
  4. Deploy step — cluster credentials, RBAC or an empty secret
  5. Rollout and health — the deploy was accepted but new pods never become Ready
  6. Green but old version — everything passed and users still see the old build

30-second diagnosis: did it run, and where did it stop?

gh run list --workflow deploy.yml --branch main --limit 5
gh run view 9876543210
X main Deploy · 9876543210
Triggered via push about 3 minutes ago

JOBS
✓ build in 1m52s (ID 27011112222)
X deploy in 38s (ID 27011113333)
  ✓ Set up job
  ✓ Log in to registry
  X Push image
  • No run for the commit you just pushed → trigger stage
  • A step marked X → its name tells you the stage. Run gh run view 9876543210 --log-failed to see only the failed step's log
  • All ✓ but nothing changed → rollout or "green but old version"

Trigger: there is no run at all

Usually the branches or paths filter under on: push does not match this commit, the commit message contains [skip ci], or another workflow pushed with GITHUB_TOKEN. Events created with GITHUB_TOKEN do not start new workflow runs, except workflow_dispatch and repository_dispatch. If you renamed the default branch, check that no filter still names the old one.

Build and push: find the first error line

In a build log the cause is the first error line, not the last line. If dependencies install from scratch every time, see Docker build cache not used; if a cache installs the wrong packages, see CI cache restores the wrong dependency graph. Typical push-stage messages:

denied: requested access to the resource is denied   # Docker Hub: login or repository name
denied: permission_denied: write_package             # GHCR: no packages: write in permissions
no basic auth credentials                            # ECR: login step missing or token expired

Deploy step: authentication or authorization?

error: You must be logged in to the server (Unauthorized)
Error from server (Forbidden): deployments.apps "checkout" is forbidden: User "system:serviceaccount:ci:deployer" cannot patch resource "deployments" in API group "apps" in the namespace "prod"

Unauthorized means the kubeconfig or token itself is wrong or expired; Forbidden means you authenticated but RBAC does not allow the action. If it fails only on tag releases or fork pull requests, suspect environment protection rules or secrets not being passed to forks.

Rollout and "green but old version"

kubectl rollout status deploy/checkout -n prod --timeout=180s
kubectl get deploy checkout -n prod -o jsonpath='{.spec.template.spec.containers[0].image}'

If the deploy step only runs kubectl apply and does not wait, or the image tag did not change so no new ReplicaSet is created, the pipeline is green while the old version keeps running. The full checklist is in GitHub Actions succeeded but the rollout failed. If the job never even starts and sits in Queued, see self-hosted runner stuck in queued.

What not to do

  • Hitting Re-run again and again without a cause — the same inputs break in the same place.
  • Making the deploy account cluster-admin to clear a permission error — grant only the resources and verbs it needs (get, patch).

The order to work in

  1. Check with gh run list that a run exists (if not, the trigger filters)
  2. Use gh run view --log-failed to find the failed step and its first error line
  3. For push and deploy errors, use the message to separate authentication (Unauthorized) from permissions (Forbidden, denied)
  4. If everything is green, check rollout status and the image tag actually running

To practise the trigger-stage trap as a problem, start with Publish workflow never starts.

Quick diagnostic checklist

  • Check with gh run list --branch main that the commit you pushed actually has a run.
  • If there is no run, check the branches and paths filters under on: push and any [skip ci] in the commit message.
  • Remember that pushes made with GITHUB_TOKEN do not start new workflow runs.
  • Open only the failed step's log with gh run view <run-id> --log-failed and find the first error line.
  • On denied or no basic auth credentials, check the registry login and push permissions.
  • Treat Unauthorized as a kubeconfig or token problem and Forbidden as an RBAC permission problem.
  • If everything is green but nothing changed, check kubectl rollout status and the image tag actually running.
  • If the job never leaves Queued, start with the runner's labels and status.

Practice with this guide

Reviewed problems about the same failure. Write the cause, recovery, and prevention yourself, then compare with the model answer.

Read next