CircleCI Pipeline Patterns#
CircleCI pipelines are defined in .circleci/config.yml. The configuration model uses workflows to orchestrate jobs, jobs to define execution units, and steps to define commands within a job. Every job runs inside an executor – a Docker container, Linux VM, macOS VM, or Windows VM.
Config Structure and Executors#
A minimal config defines a job and a workflow:
version: 2.1
executors:
go-executor:
docker:
- image: cimg/go:1.22
resource_class: medium
working_directory: ~/project
jobs:
build:
executor: go-executor
steps:
- checkout
- run:
name: Build application
command: go build -o myapp ./cmd/myapp
workflows:
main:
jobs:
- buildNamed executors let you reuse environment definitions across jobs. The resource_class controls CPU and memory – small (1 vCPU/2GB), medium (2 vCPU/4GB), large (4 vCPU/8GB), xlarge (8 vCPU/16GB). Choose the smallest class that avoids OOM kills to keep costs down.