DevOps.Academy
CoursesCurriculumInterview prepPricing
◔My learningSign in
DevOps.Academy

Free, hands-on DevOps lessons. Made with care in India.

System status

Learn

All coursesLinux roadmapCurriculumInterview questionsCheat sheetsMy learning

Academy

PricingCertificates

Legal

PrivacyTermsContact

devops.rajeev.pro

CI/CD Pipelines · revision

CI/CD Pipelines cheat sheet

Recall first: read each stage's one-line summary and try to remember its commands. Then open the stage to check yourself.

12 stages24 commands

01CI/CD conceptsCI checks each change; continuous delivery keeps a tested release ready, while continuous deployment releases it automatically. Build once, then promote the same artifact through environments.
  • false && echo deployed

    Show that && runs the next command only after success

  • true && echo deployed

    Show the success path through a shell command chain

Remember

  • A pipeline is a repeatable sequence of checks and delivery steps.
  • Build once and promote the same artifact instead of rebuilding per environment.

Watch for Delivery means a release is ready; deployment means it has actually been released.

Open the lesson: What a pipeline is for →
02GitHub Actions basicsA GitHub Actions event starts a workflow; jobs run on runners and contain ordered steps. Keep triggers narrow and validate workflow YAML before relying on it.
  • actionlint

    Check GitHub Actions workflow files for common errors

  • npm run lint && npm test

    Run the repository checks in sequence

Remember

  • Jobs can run in parallel unless needs creates a dependency.
  • A step runs in the job's runner environment and can pass outputs to later steps.

Watch for A workflow file can parse while still containing an invalid action input or expression.

Open the lesson: GitHub Actions: your first real pipeline →
03Workflow detailsUse expressions and outputs to pass values, matrices to test combinations, caches to reuse dependencies, and artifacts to hand built files between jobs.
  • docker ps --filter name=ci-postgres --format '{{.Names}}\t{{.Status}}'

    Verify the service container used by an integration test is running

  • actionlint

    Validate workflow syntax after changing workflow details

Remember

  • A cache speeds repeated work; an artifact preserves a file produced by a run.
  • A matrix creates multiple jobs from a set of input values.

Watch for A cache is disposable acceleration, not a reliable place to keep build outputs.

Open the lesson: Workflow details: expressions, matrices, caches and artifacts →
04Secrets & environmentsPut sensitive values in the platform's secret store, gate production with an environment, and grant GITHUB_TOKEN only the permissions a job needs. Prefer OIDC over long-lived cloud keys.
  • gh secret list

    List repository secrets without displaying their values

  • gh secret set PAYMENTS_API_KEY --env production

    Store a secret scoped to the production environment

Remember

  • Secret values are write-only in GitHub's UI and CLI.
  • Environment protection rules can require approval before a job receives environment secrets.

Watch for Never echo a secret or place its value in workflow YAML, arguments or logs.

Open the lesson: Secrets, environments and OIDC: deploy without leaking keys →
05Testing in pipelinesRun cheap, fast checks before slower integration tests, then require the right status checks before merge. A green pipeline should mean the intended checks actually ran.
  • npm run test:coverage

    Run the test suite with its coverage check

  • node --test --experimental-test-coverage --test-coverage-lines=80 'test/*.test.js'

    Run Node's test runner with an 80 percent line-coverage threshold

Remember

  • Unit tests isolate code; integration tests exercise real component boundaries.
  • Required status checks block merging until selected jobs pass.

Watch for A required check with a different job name can leave a pull request blocked indefinitely.

Open the lesson: Testing in pipelines: lint, unit, integration and the gate →
06Build & publishBuild a small, cached, non-root image once in CI and publish it with an identity that traces back to the source revision. Tags are convenient labels; digests identify immutable content.
  • docker build -t shop-api:dev .

    Build the application image from the Dockerfile in the current folder

  • docker run -d --name shop -p 3300:3000 -e APP_VERSION=1.0.42-e3b0c44 shop-api:dev

    Start the built image and provide its version at runtime

Remember

  • A multi-stage build keeps compilers and build tools out of the runtime image.
  • Pin a deployment to a digest when you need immutable image identity.

Watch for Do not rebuild separately for staging and production; promote the same tested artifact.

Open the lesson: Build and publish: images you can trust and find again →
07DeployDeploy the tested artifact to its target, verify health, and make rollback a deliberate operation. Static sites, SSH releases and Kubernetes each need a target-specific switch-back.
  • kubectl rollout status deployment/shop-api --timeout=120s

    Wait for the Kubernetes deployment to complete or fail

  • kubectl rollout undo deployment/shop-api

    Restore the previous Deployment revision

Remember

  • An atomic symlink switch makes an SSH release rollback the same operation in reverse.
  • Kubernetes readiness checks keep an unready replacement from receiving traffic.

Watch for A deployment command returning success does not replace a health check against the new release.

Open the lesson: Deploy: static sites, servers over SSH, Kubernetes, and rollbacks →
08JenkinsJenkins uses a controller to schedule work and agents to execute it. Define the pipeline in a Jenkinsfile, keep plugins controlled, and move repeated pipeline logic into a shared library.
  • docker volume create jenkins_home

    Create persistent storage for a local Jenkins instance

  • docker run -d --name jenkins -p 8080:8080 -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts-jdk21

    Start the Jenkins LTS container with persistent home storage

Remember

  • Agents run the job workload; the controller coordinates it.
  • Plugins execute inside Jenkins and have dependencies and security updates to manage.

Watch for Don't expose the Jenkins controller publicly with default credentials or an unrestricted agent setup.

Open the lesson: Jenkins: the controller, agents, Jenkinsfile and shared libraries →
09Other CI toolsGitLab CI, CircleCI and Buildkite use different YAML shapes for the same ideas: jobs, ordering, reusable steps, caches, artifacts, approvals and execution environments.
  • circleci config validate

    Validate a CircleCI configuration file locally

  • git push gitlab main

    Push the branch to the configured GitLab remote

Remember

  • CircleCI organizes executors, commands, jobs and workflows.
  • Buildkite's agents execute steps on infrastructure you operate.

Watch for A locally valid config still needs a real hosted run to prove credentials and runner access.

Open the lesson: Other CI tools: GitLab CI, CircleCI and Buildkite →
10GitOpsWith GitOps, Git declares the desired cluster state and a controller pulls changes into the cluster. A revert in the config repository can roll back the desired version.
  • kustomize build . | kubeconform -strict -summary -

    Render the manifests and validate their Kubernetes schemas

  • git log --oneline -2

    Review recent configuration commits

Remember

  • Push deployment sends changes to a cluster; pull deployment lets an in-cluster controller fetch them.
  • The config repository is the source of truth for desired state.

Watch for Don't edit a GitOps-managed object by hand and expect the change to persist; reconciliation can overwrite it.

Open the lesson: GitOps: Git says what runs, the cluster makes it so →
11Pipeline securityA pipeline can reach source, secrets and production, so reduce its permissions and scan what it builds. Pin third-party actions, avoid untrusted expression interpolation, and attest artifacts.
  • npm audit --audit-level=high --omit=dev

    Report production dependency vulnerabilities at high severity or above

  • docker run --rm --network host anchore/syft:v1.18.1 localhost:5050/shop-api:1.0.44 -q

    Generate a software bill of materials for the image

Remember

  • Treat pull-request titles, branch names and other contributor-controlled values as untrusted input.
  • An SBOM inventories components; provenance records how an artifact was produced.

Watch for Pinning an action to a tag is weaker than pinning it to a reviewed commit SHA.

Open the lesson: Pipeline security: your CI is a production system →
12Scaling pipelinesAs repositories grow, reuse whole workflows or step groups, isolate self-hosted runners, and measure bottlenecks before optimizing. Monorepo filters should build every affected component.
  • git diff --name-only main...HEAD

    List files changed on the current branch relative to main

  • ./affected.sh

    Run the lesson's affected-component check

Remember

  • Reusable workflows share a workflow; composite actions package a sequence of steps.
  • Self-hosted runners can access private networks, so isolate and clean them between jobs.

Watch for Path filters that miss a shared dependency can skip a required build.

Open the lesson: Scaling pipelines: reuse, your own runners, speed and cost →
← Back to the CI/CD Pipelines course