1---2name: devops-cicd3description: Use when writing, reviewing or debugging CI/CD pipelines for self-hosted infrastructure - GitHub Actions (workflows, reusable workflows, composite actions, matrix, concurrency, caching, environments with required reviewers, OIDC instead of stored secrets, pinning actions by SHA or lockfile, permissions least privilege, self-hosted runners), GitLab CI (rules, needs, includes and components, environments, resource_group, protected variables, runners and executors), pointers for Jenkins / Forgejo-Gitea Actions / Woodpecker, pipeline design (build once promote many, quality gates, speed), image builds in CI (BuildKit cache, multi-arch, provenance/SBOM/signing), deploy strategies and rollback, release automation and pipeline troubleshooting. Not for GitOps controllers, Helm or Kustomize (devops-gitops-packaging), Dockerfile and registry craft (devops-docker), secret stores (devops-secrets), language-specific CI gates (framework experts), repo commit/release flow (commit agent) or a supply-chain audit (fuse-security:security-expert).4versions:5 github-actions-runner: "2.338.2 (actions/runner release 2026-10-26)"6 github-hosted-runner-labels: "ubuntu-latest = ubuntu-24.04; ubuntu-26.04 and ubuntu-24.04-arm available"7 gitlab: "19.5 released (19.6 upcoming); GitLab Runner 19.5.3 (2026-11-06)"8 actions-pinned-in-templates: "checkout v7.0.1, upload-artifact v7.0.2, setup-node v7.1.0, docker/build-push-action v7.4.0, actions/attest v4.2.2"9user-invocable: true10references:11 - references/github-actions-workflows.md12 - references/github-actions-security.md13 - references/gitlab-ci.md14 - references/other-ci-systems.md15 - references/pipeline-design.md16 - references/image-build-ci.md17 - references/deploy-strategies-release.md18 - references/pipeline-secrets.md19 - references/destructive-pipeline-actions.md20 - references/troubleshooting.md21 - references/templates/github-ci.yml22 - references/templates/github-reusable-workflow.yml23 - references/templates/github-composite-action.yml24 - references/templates/github-oidc-deploy.yml25 - references/templates/github-image-build-push.yml26 - references/templates/github-release.yml27 - references/templates/gitlab-ci.yml28 - references/templates/gitlab-component.yml29related-skills:30 - devops-gitops-packaging31 - devops-docker32 - devops-secrets33 - devops-kubernetes34 - devops-iac35 - devops-ansible36 - devops-observability37 - devops-sre-ops38metadata:39 source: https://skillmd.com/skills/fusengine/devops-cicd40---4142<objective>43Covers designing, writing and troubleshooting CI/CD pipelines: GitHub Actions and44GitLab CI in depth, pointers for Jenkins, Forgejo/Gitea Actions and Woodpecker,45build-once-promote-many design, container image builds in CI, deployment46strategies, release automation, rollback and pipeline secrets. Does not cover47GitOps controllers and packaging (devops-gitops-packaging), Dockerfile and48registry practice (devops-docker), secret stores (devops-secrets), language CI49gates (framework experts) or supply-chain audits (fuse-security:security-expert).50</objective>5152# DevOps CI/CD5354## Agent Workflow (MANDATORY)5556Before ANY pipeline change, spawn in parallel, one `Agent` call each with a `name`:57581. **fuse-ai-pilot:explore-codebase** - find existing workflows (`.github/workflows`, `.gitlab-ci.yml`, `Jenkinsfile`, `.woodpecker`), scripts they call, runners/labels in use, environments, how deploys reach the target592. **fuse-ai-pilot:research-expert** - verify the keyword, action version and runner image for the platform version in use at docs.github.com / docs.gitlab.com603. **mcp__context7__query-docs** - confirm action inputs and CLI flags6162Then read the platform state read-only (`gh run list`, `gh workflow list`, `gh api .../environments`, CI Lint, runner status). After writing files, run **fuse-ai-pilot:sniper**; run `actionlint` on GitHub workflows when installed.6364## Versions (checked 2026-11-10)6566| Item | Version | Source |67|------|---------|--------|68| actions/runner | 2.338.2 (2026-10-26) | `gh api repos/actions/runner/releases/latest` |69| GitHub-hosted labels | `ubuntu-latest` = 24.04; `ubuntu-24.04`, `ubuntu-22.04`, `ubuntu-26.04`, `ubuntu-slim`, `*-arm` | https://docs.github.com/en/actions/reference/runners/github-hosted-runners |70| actions/checkout | v7.0.1 (2026-07-20) | `gh api` |71| upload / download-artifact | v7.0.2 / v8.0.2 (2026-10-07) | `gh api` |72| actions/cache | v6.1.0 (2026-06-26) | `gh api` |73| actions/setup-node | v7.1.0 (2026-10-08) | `gh api` |74| docker/{setup-buildx, build-push, login, metadata, setup-qemu} | v4.4.1 / v7.4.0 / v4.8.0 / v6.2.0 / v4.4.0 | `gh api` |75| actions/attest | v4.2.2 (2026-08-04); `attest-build-provenance` v4 is a wrapper | `gh api`, README |76| sigstore/cosign-installer | v4.1.3 (2026-11-04) | `gh api` |77| actionlint | v1.7.12 (2026-03-30), not installed locally | `gh api` |78| GitLab | 19.5 (19.6 upcoming); Runner 19.5.3 | docs release notes, GitLab.com releases API |79| Jenkins / Forgejo / Woodpecker | 2.590 (LTS 2.580.2) / 17.0.1 (LTS 15.0.11) / 3.20.1 | [other-ci-systems.md](references/other-ci-systems.md) |8081Docs examples often lag the latest action majors: use the SHA/tag from the release, and re-check with `gh api repos/<owner>/<action>/releases/latest` and `gh api repos/<owner>/<action>/commits/<tag> --jq .sha` before pinning.8283## Overview8485| Area | Decision in one line |86|------|----------------------|87| **Artifact** | Build once, promote the same immutable artifact (image digest) through every environment |88| **Permissions** | `permissions: {}` at the top, widen per job; `GITHUB_TOKEN` read-only by default |89| **Actions** | Pin third-party actions by full SHA or lockfile; Dependabot raises bumps |90| **Credentials** | OIDC federation, bound to repo + environment claims; no long-lived cloud/SSH keys in CI |91| **Production** | Environment with required reviewers (GitHub) / protected environment + manual job (GitLab), serialised, never auto-cancelled |92| **Runners** | Ephemeral or private-only; never self-hosted on public repos; separate runner group for deploys |93| **Speed** | Parallel jobs, DAG (`needs`), lockfile-keyed cache, external BuildKit cache, cancel redundant PR runs |94| **Deploy model** | CI hands off to GitOps when a controller owns the cluster; otherwise push with a short-lived credential |9596## Critical Rules97981. **Read before writing** - inspect existing workflows, runners, environments and what the deploy step actually touches992. **Pin and constrain** - SHA/lockfile pins, `permissions`, `timeout-minutes` on every job1003. **No untrusted `${{ }}` in `run:`** - pass through `env:`; never check out PR code under `pull_request_target`/`workflow_run`1014. **Production and destructive pipeline actions are proposed, not run** - deploy, forced re-run, rollback, deleting environments/releases/tags/artifacts, unregistering runners: ACTION / EFFECT / PROOF / WAIT-FOR-GO in [destructive-pipeline-actions.md](references/destructive-pipeline-actions.md)1025. **Never print a secret value** - names only; stores and rotation are `devops-secrets`1036. **Never invent a keyword, input or version** - cite the docs page or release; unknown = "not verified"1047. **Troubleshoot in order** - run, class, log, reproduce, one change, prove ([troubleshooting.md](references/troubleshooting.md))105106## Architecture107108```109repo/110├── .github/111│ ├── workflows/ci.yml # PR + main: lint, test matrix, build, upload artifact112│ ├── workflows/image.yml # build/push by digest, SBOM, provenance, sign113│ ├── workflows/deploy.yml # workflow_dispatch, environment gate, OIDC114│ ├── workflows/release.yml # tag -> draft release115│ └── actions/setup-project/ # composite action116└── .gitlab-ci.yml # or: stages, rules, needs, environments, components117```118119## Reference Guide120121### Concepts122123| Topic | Reference | When to Consult |124|-------|-----------|-----------------|125| **GitHub workflows** | [github-actions-workflows.md](references/github-actions-workflows.md) | Triggers, matrix, concurrency, reusable workflows, cache, environments |126| **GitHub security** | [github-actions-security.md](references/github-actions-security.md) | permissions, pinning, OIDC, injection, self-hosted runners |127| **GitLab CI** | [gitlab-ci.md](references/gitlab-ci.md) | rules, needs, components/inputs, environments, runners |128| **Other CI** | [other-ci-systems.md](references/other-ci-systems.md) | Jenkins, Forgejo/Gitea Actions, Woodpecker |129| **Pipeline design** | [pipeline-design.md](references/pipeline-design.md) | Stages, gates, branching, speed, flaky tests |130| **Image build** | [image-build-ci.md](references/image-build-ci.md) | BuildKit cache, multi-arch, provenance, SBOM, signing |131| **Deploy and release** | [deploy-strategies-release.md](references/deploy-strategies-release.md) | Rolling/blue-green/canary, versioning, rollback, migrations |132| **Pipeline secrets** | [pipeline-secrets.md](references/pipeline-secrets.md) | Scoping, masking, leaks |133| **Destructive actions** | [destructive-pipeline-actions.md](references/destructive-pipeline-actions.md) | Any prod deploy, re-run, rollback, delete, unregister |134| **Troubleshooting** | [troubleshooting.md](references/troubleshooting.md) | Red, queued, skipped or slow pipelines |135136### Templates137138| Template | When to Use |139|----------|-------------|140| [github-ci.yml](references/templates/github-ci.yml) | PR/main CI: lint, matrix tests, artifact |141| [github-reusable-workflow.yml](references/templates/github-reusable-workflow.yml) | Shared `workflow_call` job with typed inputs and secrets |142| [github-composite-action.yml](references/templates/github-composite-action.yml) | Shared steps as `action.yml` |143| [github-oidc-deploy.yml](references/templates/github-oidc-deploy.yml) | Gated production deploy with OIDC to OpenBao/Vault |144| [github-image-build-push.yml](references/templates/github-image-build-push.yml) | Multi-arch build, GHCR push, attestation, cosign |145| [github-release.yml](references/templates/github-release.yml) | Tag push to draft GitHub Release |146| [gitlab-ci.yml](references/templates/gitlab-ci.yml) | rules + needs + environments + protected prod job |147| [gitlab-component.yml](references/templates/gitlab-component.yml) | Versioned component with `spec:inputs` |148149## Quick Reference150151```bash152gh workflow list; gh run list --limit 10 # read-only state153gh run view <id> --log-failed # why it failed154gh api repos/<o>/<r>/environments --jq '.environments[].name'155gh api repos/actions/checkout/commits/v7.0.1 --jq .sha # SHA to pin156actionlint .github/workflows/*.yml # when installed157gh workflow run deploy.yml -f image-digest=sha256:... # PRODUCTION: only after the user's go158```159160## Best Practices161162### DO163- Give every workflow `permissions`, `concurrency` and a `timeout-minutes` per job164- Hand deploys to GitOps (`devops-gitops-packaging`) where a controller exists165- Keep CI steps as scripts/make targets that run locally166- Record the previous artifact digest before each production deploy167168### DON'T169- Rebuild per environment, deploy `latest`, or store cloud/SSH keys as long-lived CI secrets170- Run self-hosted persistent runners on public repositories171- Use `pull_request_target` with a PR checkout172- Set `cancel-in-progress: true` on deploy jobs