هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
$ مستخدم عادي# بصلاحية root (أو مع sudo)
المهارات في هذا الفصل
- Git و CI/CD و GitOps — 6
Git — the source of truth
git keeps the full history of code and config; branches and pull requests let a team review every change.
- Used for: everything as code; GitOps; rollback with
git revert.
git switch -c feat/health-check
git add -p && git commit -m "Add /health endpoint"
git push -u origin feat/health-check
git log --oneline --graph -10Security checklist:
- Protect
main: required reviews and checks, no force push. - Sign commits (SSH or GPG) so GitHub shows Verified.
- A committed secret is leaked: rotate it, then clean history.
GitHub CLI — pull requests and Actions from the terminal
gh opens and reviews PRs, watches Actions runs, sets secrets and calls the GitHub API.
gh pr create --fill
gh run watch
gh run view --log-failed
gh secret set AZURE_CLIENT_ID --body "00000000-0000-0000-0000-000000000000"
gh api repos/OWNER/REPO/dependabot/alerts --jq '.[].security_advisory.severity'Security checklist:
- Smallest
permissions:forGITHUB_TOKENin workflows. - OIDC to clouds instead of long-lived secrets.
GitLab Runner — run GitLab CI jobs
gitlab-runner takes jobs from .gitlab-ci.yml and runs them with the shell, Docker or Kubernetes executor.
gitlab-runner register --url https://gitlab.com --token glrt-xxxx --executor docker --docker-image alpine:3.20 --non-interactive
gitlab-runner verify
journalctl -u gitlab-runner -fSecurity checklist:
- No
privileged = true(docker-in-docker) — build with kaniko or buildah. - Masked, protected CI variables; runners for untrusted projects separate.
Jenkins — the classic automation server
jenkins runs pipelines from a Jenkinsfile; still used in many companies, so you will meet it.
systemctl status jenkins
java -jar jenkins-cli.jar -s http://localhost:8080 -auth admin:API_TOKEN build shop/main -sSecurity checklist:
- 0 executors on the controller; builds only on agents.
- Update plugins often; SSO; never open it to the internet.
withCredentials+ single quotes inshso secrets do not leak into logs.
Argo CD — GitOps with a UI
argocd keeps clusters in sync with Git: an Application points to a path in a repo; drift shows as OutOfSync and can self-heal.
Flux — GitOps as controllers
flux installs controllers that pull Git, Helm and OCI sources and apply them; it can decrypt SOPS secrets.
flux bootstrap github --owner s0sta --repository fleet --path clusters/home --personal
flux get kustomizations
flux reconcile kustomization shop --with-sourceSecurity checklist:
- Encrypt secrets with SOPS (age or Key Vault) before commit.
- Check
--prunepaths carefully.
تذكّر
CI = build, test, scan, sign, push the image. CD (GitOps) = change a tag in Git; Argo CD or Flux deploys it. The pipeline never needs cluster-admin credentials.