Foundations: web, servers, containersLesson 13 of 13
How a Pipeline Runs
CI/CD means defining the build → test → deploy process for a code change in advance and running it automatically. Follow one generic pipeline, not tied to any product, from start to finish. Syncing deploys to Git in Kubernetes is covered in Helm and GitOps.
Current stageIdle → start
Image tagNone
Prod version1.4.1
RequestResponse / reportWatchAppears in a later step
What you will learn
- What starts a pipeline (triggers)
- What build and test each leave behind
- Why to use an immutable tag instead of latest
- Why the same artifact is promoted through each environment
- If an earlier stage fails, later stages do not run
Common approaches in Kubernetes
| Concept | Generic pipeline | In Kubernetes |
|---|---|---|
| Trigger | Manual, code change, schedule, external call | A repo webhook runs CI, and a GitOps tool watches Git changes and syncs the cluster (for example Argo CD) |
| Stages and jobs | Stages run in order, jobs in a stage run in parallel | Whether the rest stop when one job fails depends on tool settings |
| Artifact | Store the image with its tag in a registry | Push the image to a registry (for example Harbor) and write its tag or digest in the manifest |
| Production approval | Many places require approval | Use a manual approval stage or merge request approval as the gate |
| Rollback | You need earlier deploy records to roll back | Roll back to a previous revision with kubectl rollout undo, or with GitOps revert the Git commit |
Try it yourself
git log -1 --format='%H %s' # Commit the pipeline built
docker image inspect <image> --format '{{.RepoDigests}}' # Digest of the stored artifact
kubectl get deploy <name> -n <namespace> -o jsonpath='{.spec.template.spec.containers[*].image}{"\n"}' # Same image in dev, stg, prod?
kubectl rollout history deploy/<name> -n <namespace> # Deploy history
kubectl rollout status deploy/<name> -n <namespace> # Did the deploy finish?
Check yourself
Further reading: Deployment rollback · Argo CD · Tekton · Helm and GitOps