CircleCI Pocketbook

CircleCI Pocket Book — Uplatz

50 deep-dive flashcards • Wide layout • Fewer scrolls • Full CI/CD pipeline coverage • YAML-ready examples

Section 1 — Fundamentals of CircleCI

1) What is CircleCI?

CircleCI is a modern continuous integration and continuous delivery (CI/CD) platform that automates software builds, tests, and deployments. It integrates deeply with GitHub, Bitbucket, and GitLab. CircleCI provides Docker-native support, caching, parallelism, orbs, and workflows to streamline development pipelines across environments and languages.

# CircleCI config structure
.circleci/
  config.yml

2) CircleCI vs Other CI/CD Tools

Compared to Jenkins, GitHub Actions, and Travis CI, CircleCI offers: fast Docker layer caching, optimized parallelism, flexible workflows, and hosted runners. It excels in performance-critical pipelines and microservices-based deployments. Native support for containers and Kubernetes gives it an edge for modern cloud-native teams.

3) Core Concepts: Job, Step, Workflow

Jobs: A collection of steps to execute.
Steps: Individual commands like checkout, run, save_cache.
Workflows: Define how jobs are triggered, ordered, and connected.
CircleCI YAML starts with a version key and defines jobs, workflows, and optionally orbs.

version: 2.1
jobs:
  build:
    docker:
      - image: cimg/node:lts
    steps:
      - checkout
      - run: npm install
      - run: npm test
workflows:
  build_and_test:
    jobs:
      - build

4) Docker Executor vs Machine Executor

Docker executor is fast and lightweight, spins up containers quickly. Ideal for stateless builds. Machine executor provides a VM with root access, suited for projects requiring full OS-level customization.

executor:
  docker:
    - image: cimg/python:3.10
# or
  machine:
    image: ubuntu-2204:current

5) CircleCI Orbs

Orbs are reusable, shareable packages of CircleCI config—includes jobs, commands, and executors. You can import popular orbs (e.g., node, slack, aws-s3) to reduce boilerplate.

orbs:
  node: circleci/node@5.0.2
  slack: circleci/slack@4.12.5

jobs:
  build:
    executor: node/default
    steps:
      - checkout
      - node/install-packages

6) Artifacts, Caching & Workspaces

Artifacts are test reports or build outputs. Caching speeds up installs. Workspaces persist files between jobs. Always cache dependencies like node_modules, .venv, or ~/.m2.

- save_cache:
    paths:
      - ~/.cache/pip
    key: v1-deps-{{ checksum "requirements.txt" }}

- persist_to_workspace:
    root: .
    paths:
      - dist

7) Parallelism & Matrix Jobs

CircleCI supports test splitting and matrix builds to reduce CI time. Define parallel containers or matrix values using parameters.

parameters:
  node-version:
    type: string
    default: "18"

jobs:
  test:
    docker:
      - image: cimg/node:<< parameters.node-version >>

8) Deployments & Environments

Trigger deployment jobs conditionally using filters for branches or tags. Use contexts to store env secrets securely (e.g., AWS keys, Firebase tokens).

jobs:
  deploy:
    steps:
      - run: ./scripts/deploy.sh

workflows:
  deploy_on_main:
    jobs:
      - deploy:
          filters:
            branches:
              only: main

9) Notifications: Slack, Email, Webhooks

Use the slack orb or custom webhook calls to notify channels on success/failure. Also configure email alerts per job or team member.

- slack/notify:
    event: fail
    template: basic_fail_1

10) Q&A — “Why choose CircleCI for my pipeline?”

Answer: CircleCI offers rapid builds with parallelism and caching, declarative YAML, Docker-native CI, and excellent observability. It fits teams that prioritize speed, modular workflows, and seamless VCS integration. Plus, reusable orbs reduce config noise, and flexible executor choices allow hybrid container + VM pipelines.