Filters
How to search
  • Plain words find names, texts and examples.
  • "two words" finds the exact phrase.
  • --name or -x finds an option.
  • #word looks only inside commands.
  • @grep finds lessons and labs that use grep.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Put ! before a word to leave it out. OR between words means one of them.
  • ↑ ↓ to move · Enter to open · Esc to close · / to search

Chapter 6Name in the course: Git, CI/CD and GitOps

Ship changes with Git, CI/CD and GitOps

Continuous integration builds and tests every change; continuous delivery puts it into production. In modern teams the last step is often GitOps: the cluster follows a Git repository. These 7 tools run that flow.

  • 6 Lessons
  • 10 Commands

$ run as a normal user# run as root (or with sudo)

Skills in this chapter

  • Git, CI/CD and GitOps — 7

6.1

Git — the start of every change

git keeps the history; branches and pull requests let the team review every change.

git switch -c feat/health-check
git commit -am "Add /health endpoint"
git push -u origin feat/health-check
git tag -a v1.4.0 -m "release 1.4.0" && git push --tags

Good practice:

  • Small pull requests; protected main; tags for releases.

Commands in this lesson

6.2

GitHub CLI — PRs and Actions from the terminal

gh opens PRs, watches pipeline runs and reads the logs of failed jobs.

gh pr create --fill
gh run watch
gh run view --log-failed
gh workflow run deploy.yml -f environment=staging

Commands in this lesson

6.3

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.

act -l
act pull_request -j test
act --secret-file .secrets

Commands in this lesson

6.4

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 jenkins

6.5

Argo CD and Flux — GitOps

argocd and flux watch a Git repo and make the cluster match it — deploy = merge a pull request; rollback = revert.

argocd app create shop --repo https://github.com/acme/gitops --path apps/shop/prod --dest-server https://kubernetes.default.svc --dest-namespace shop --sync-policy automated
argocd app get shop
flux get kustomizations
flux reconcile kustomization apps --with-source

6.6

Build a pipeline with clear stages

Every good pipeline has the same stages; fast checks first.

  1. Lint and unit test (make lint test) — fails in 1–2 minutes.
  2. Build the image once, tag it with the commit SHA.
  3. Push to the registry.
  4. Deploy to staging — change the tag in the GitOps repo.
  5. Smoke and load test staging (curl -f, k6).
  6. 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.

All commands in this chapter