Claude Code in CI/CD pipelines
Running Claude Code unattended in CI: -p print mode, --output-format json with --json-schema and reading structured_output, failing on exit codes and missing output, CLAUDE.md as CI project context versus --bare, prior findings and existing tests in context, and the GitHub Actions and GitLab CI/CD integrations.
Integrate Claude Code into CI/CD pipelines
~8 min read · 10 practice questions ·
What the exam expects
- Run Claude Code in a pipeline with
-pso the job does not hang waiting for interactive input. - Produce machine-parseable findings with
--output-format jsonplus--json-schema, read them fromstructured_output, and fail the job on a non-zero exit or a missing field. - Give CI-invoked Claude Code project context (review criteria, testing standards, fixtures) through a committed CLAUDE.md, and know that
--bareskips it. - Avoid duplicate output on reruns by passing prior findings and asking only for new or unaddressed issues, and avoid duplicate test suggestions by passing the existing tests.
- Wire Claude Code into GitHub Actions or GitLab CI/CD, with the review run independent of the session that wrote the code.
Key terms: print mode (-p/--print: one non-interactive run that prints a response and exits); structured_output (the JSON field holding schema-validated output); bare mode (--bare: skips auto-discovery of CLAUDE.md, hooks, skills, MCP servers and more); claude_args (the GitHub Action input that passes CLI flags); automation mode (the Action running from a prompt input without an @claude mention).
Key facts
- Detail
-p/--print
- Detail
text(default),json,stream-json
--json-schema- Detail
- Validated JSON after the workflow; print mode only
- Detail
structured_output;resultholds the text
- Detail
- Field is absent; check before use
- Detail
- 0 on success, non-zero when the run fails
--bare skips- Detail
- Hooks, skills, commands, subagents, plugins, MCP, auto memory, CLAUDE.md
--bare future- Detail
- Recommended for scripts; future default for
-p
--max-turns- Detail
- Print mode only; no limit by default; errors at the limit
- Detail
CLAUDE.mdin the repository root
- Detail
error_max_structured_output_retries
- Why does a CI step that calls
claude "..."without-ptime out? - When is
structured_outputmissing from a--json-schemarun? - Where should review criteria live so both the GitHub Action and local sessions use them?
- What does
--bareskip, and how do you restore project conventions?
The questions are free to read. Answers with their sources and self-grading are included with the pack.
Keep reading with the Claude Certified Architect - Foundations pack
- Core concepts
- Exam traps
- Worked scenario
The pack includes:
- All 30 lessons of the Claude Certified Architect - Foundations guide, with reading progress
- Interactive decision walks and step-by-step sequence steppers
- Inline practice questions and one-click topic practice (10 questions for this lesson)
- An official source cited for every claim
- An AI tutor that answers from the guide
- Unlimited timed practice exams
Practice for the Claude Certified Architect - Foundations exam
Certifyforce is an independent study resource and is not affiliated with, endorsed by or sponsored by Anthropic. Claude is a trademark of Anthropic.