$ run as a normal user# run as root (or with sudo)
Skills in this chapter
- Git, CI/CD and GitOps — 7
Git — the start of every change
git keeps the history; branches and pull requests let the team review every change.
GitHub CLI — PRs and Actions from the terminal
gh opens PRs, watches pipeline runs and reads the logs of failed jobs.
act — test GitHub Actions locally
act runs your workflow in Docker on your machine, so you do not push 20 times to fix a pipeline.
GitLab Runner and Jenkins — pipelines in companies
gitlab-runner runs .gitlab-ci.yml jobs; jenkins runs Jenkinsfile pipelines. You meet both in many companies.
gitlab-runner register --url https://gitlab.com --token glrt-xxxx --executor docker --docker-image alpine:3.20 --non-interactive
gitlab-runner verify
systemctl status jenkinsArgo CD and Flux — GitOps
argocd and flux watch a Git repo and make the cluster match it — deploy = merge a pull request; rollback = revert.
Build a pipeline with clear stages
Every good pipeline has the same stages; fast checks first.
- Lint and unit test (
make lint test) — fails in 1–2 minutes. - Build the image once, tag it with the commit SHA.
- Push to the registry.
- Deploy to staging — change the tag in the GitOps repo.
- Smoke and load test staging (
curl -f,k6). - Promote the same image to production (PR or manual approval).
Remember
A pipeline that takes more than 10 minutes makes people skip it. Cache, run jobs in parallel, and keep slow tests on a schedule.