Skip to content

docs: add CircleCI pipeline example and documentation - #216

Closed
Labu1 wants to merge 1 commit into
secfoo-com:mainfrom
Labu1:repodestek/issue-174
Closed

Labu1 wants to merge 1 commit into
secfoo-com:mainfrom
Labu1:repodestek/issue-174

Conversation

@Labu1

@Labu1 Labu1 commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Closes #174

What does this change, and why?

docs/CI.md had copy-paste setups for GitHub Actions, GitLab CI, Jenkins and pre-commit, but CircleCI users only got the generic "Anything else" snippet (part of #110).

  • New examples/ci/circleci-config.yml, modelled on examples/ci/gitlab-ci.yml: cimg/python:3.12, pip install secfoo, secfoo run --agent api ... --fail-on high --max-cost 2.00, then SARIF (secfoo.sarif) and JSONL (secfoo-findings.jsonl) exports, uploaded with store_artifacts together with secfoo-result.json.
  • CircleCI skips all later steps once a step fails, so the review step saves secfoo run's exit code to a file instead of failing straight away. The exports and store_artifacts still run, and a final step applies the code, so the artifacts are kept even when the --fail-on or --max-cost gate trips. The output folder is passed to --exclude so the scan doesn't read its own results.
  • New ## CircleCI section in docs/CI.md, after GitLab CI: where to set OPENAI_API_KEY (project environment variable or context, including the context: workflow syntax) and what exit codes 0-3 mean. CircleCI is removed from the "Anything else" heading.
  • One README line linking the example, next to the GitLab one.

Still to do before merge: the issue asks for one run on the CircleCI free plan against a small public repo (--depth quick --max-cost 0.50), with a link or screenshot showing the uploaded secfoo.sarif. That run hasn't been done yet. I'll add the link or screenshot here, or a maintainer can.

Testing

Ran pytest in a clean Linux container: the 4 remaining failure(s) also occur on the base branch without this change; no new failures are introduced.

  • pytest tests passes
  • ruff check . passes
  • Added/updated tests for the behavior change

This PR was prepared with AI assistance (Claude) and reviewed by me before submitting.

docs/CI.md had copy-paste setups for GitHub Actions, GitLab, Jenkins
and pre-commit, but CircleCI users only got the generic "Anything
else" snippet.

Add examples/ci/circleci-config.yml, modelled on the GitLab job: a
cimg/python:3.12 image, pip install secfoo, a gated `secfoo run --agent
api` with SARIF and JSONL exports, and store_artifacts for the outputs.
CircleCI skips later steps once one fails, so the exit code is saved
and applied in a final step after the artifacts are stored. Add a
CircleCI section to docs/CI.md covering project environment variables
vs. contexts for the API key and the exit codes, and link the example
from the README.

Fixes secfoo-com#174.
@Labu1
Labu1 requested a review from vsn411 as a code owner November 29, 2026 08:51
@vsn411

vsn411 commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator

Thanks for this! We're closing it only because #204 merged a CircleCI example for #174 a few days ago, so the two now conflict on both files.

Your version has two things the merged one doesn't, and we'd welcome a small follow-up PR on top of current main with them:

  1. Apply the exit code in a final step. Save secfoo run's code to a file, then exit with it in a last step, so the job fails visibly after the artifacts are stored.
  2. Pass the output folder to --exclude, so the scan never reads its own results.

#174 is still open for its last item, a real run on the CircleCI free plan with a link or screenshot showing secfoo.sarif. If you do that run, posting it on #174 would close the issue. Thanks again for #198, #199, #202 and #205 this week.

@vsn411 vsn411 closed this Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI example: CircleCI (examples/ci + docs/CI.md)

2 participants