Quick Start
Get started with cigen by creating your first universal CI configuration.
Prerequisites
Section titled “Prerequisites”- Cigen installed on your system
- A project with existing CI needs
- Basic familiarity with CI/CD concepts
Your First Configuration
Section titled “Your First Configuration”-
Create a cigen directory
Navigate to your project root and create the cigen configuration directory:
Terminal window mkdir .cigencd .cigen -
Create the main configuration file
.cigen/config.yml $schema: https://cigen.dev/schemas/v1/config-schema.jsonprovider: circlecioutput_path: .circlecioutput_filename: config.yml# Simple job that runs testsjobs:test:image: cimg/node:18.0steps:- run:name: Install dependenciescommand: npm install- run:name: Run testscommand: npm test# Workflow that runs the test jobworkflows:main:jobs:- test -
Generate your CI configuration
From your project root, run:
Terminal window cigen generate --config .cigen/This creates
.circleci/config.ymlwith a complete CircleCI configuration. -
Validate the generated configuration
Terminal window cigen validate --config .cigen/If you have the CircleCI CLI installed, this will also validate with
circleci config validate.
Add More Advanced Features
Section titled “Add More Advanced Features”-
Add multi-architecture builds
Multi-architecture job jobs:build_image:image: cimg/base:stablearchitectures: [amd64, arm64] # Creates build_image_amd64 and build_image_arm64requires: [test]steps:- run: docker build -t myapp:latest . -
Add intelligent caching
Automatic cache injection cache:node_modules:key_files: ['package.json', 'package-lock.json']paths: ['node_modules/']jobs:test:image: cimg/node:18.0cache: [node_modules] # Automatically injects cache restore/savesteps:- run: npm install- run: npm test -
Add job skipping for unchanged files
Smart job skipping source_file_groups:frontend: ['src/**/*.js', 'src/**/*.css', 'package.json']backend: ['api/**/*.py', 'requirements.txt']jobs:test_frontend:image: cimg/node:18.0source_files: '@frontend' # Only runs if frontend files changedsteps: [...]test_backend:image: cimg/python:3.9source_files: '@backend' # Only runs if backend files changedsteps: [...]
Understanding the Generated Output
Section titled “Understanding the Generated Output”When you run cigen generate, you get:
version: 2.1
jobs: test: docker: - image: cimg/node:18.0 steps: - run: name: Install dependencies command: npm install - run: name: Run tests command: npm test
build_image_amd64: docker: - image: cimg/base:stable resource_class: medium # ... architecture-specific configuration
build_image_arm64: docker: - image: cimg/base:stable resource_class: arm.medium # ... architecture-specific configuration
workflows: main: jobs: - test - build_image_amd64: requires: [test] - build_image_arm64: requires: [test]Next Steps
Section titled “Next Steps”- Learn about configuration options
- Explore CircleCI-specific features
- Read about advanced features like OR dependencies
- Check out real-world examples
Common Patterns
Section titled “Common Patterns”Approval Jobs
Section titled “Approval Jobs”jobs: approve_deploy: type: approval
deploy: image: cimg/base:stable requires: [approve_deploy] steps: [...]OR Dependencies (CircleCI)
Section titled “OR Dependencies (CircleCI)”jobs: deploy: requires_any: [manual_approval, automated_trigger] steps: [...]Cigen automatically creates shim jobs to make this work on CircleCI.
Environment-Specific Contexts
Section titled “Environment-Specific Contexts”jobs: deploy_production: image: deploy context: [production-secrets, aws-credentials] steps: [...]Maps directly to CircleCI contexts for secure environment variables.