Repository navigation
Conversation
Azure Pipelines users only had the generic "Anything else" snippet in docs/CI.md. Add examples/ci/azure-pipelines.yml, modelled on the GitLab job: it triggers on PRs and the default branch, installs secfoo with pip on Python 3.12, runs the api agent with --fail-on high and --max-cost 2.00, exports SARIF and JSONL, and publishes the files with PublishPipelineArtifact even when a gate fails. Add an "Azure Pipelines" section to docs/CI.md after GitLab CI that explains where to set the secret OPENAI_API_KEY variable, why it must be mapped into env: (Azure does not expose secrets to scripts), and what the exit codes mean. Fixes secfoo-com#173.
Collaborator
|
Thanks for this, and for the careful write-up. You independently reached the same conclusion we did about container jobs running as non-root. We're closing this PR only because #200 merged an Azure Pipelines example for #173 earlier today, 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
Thanks again for your work this week on #198, #199 and #202. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #173
What does this change, and why?
docs/CI.mdhad copy-paste setups for GitHub Actions, GitLab, Jenkins and pre-commit, but Azure Pipelines users only got the generic "Anything else" snippet (part of #110).examples/ci/azure-pipelines.yml(new), modelled onexamples/ci/gitlab-ci.yml:secfoo run --agent api ... --fail-on high --max-cost 2.00secfoo.sarifandsecfoo-findings.jsonlnext tosecfoo-result.jsonPublishPipelineArtifact@1andcondition: succeededOrFailed(), so the files are kept when a gate failssecfoo run's exit code so both exports always run before the step fails$(Build.ArtifactStagingDirectory), so they don't end up inside the scanned checkoutCodeAnalysisLogs, which I understand is what the SARIF SAST Scans Tab extension reads (not checked)docs/CI.md: new## Azure Pipelinessection after GitLab CI. It covers where to add the secretOPENAI_API_KEYpipeline variable, why it has to be mapped into the step'senv:(Azure does not expose secret variables to scripts automatically), what exit codes 0–3 mean, and that thepr:trigger only works for GitHub/Bitbucket repos (Azure Repos needs a build-validation branch policy). Azure is removed from the "Anything else" heading.Difference from the issue: the issue suggested a
python:3.12-slimcontainer. As far as I know, Azure container jobs don't run steps as root when the image has nosudo, so theapt-get install git/ systempip installused in the GitLab job would likely fail. I haven't tested this. The example uses the hostedubuntu-latestagent (git preinstalled) withUsePythonVersion@0pinned to 3.12 instead. Happy to switch to a container job if you prefer.Not done yet: I have not run this pipeline on an Azure DevOps organization, so I can't link a run or attach a screenshot of the uploaded
secfoo.sarif. That still has to be done before this meets the issue's "Done when" condition.Testing
Ran
pytestin a clean Linux container: the 4 remaining failure(s) also occur on the base branch without this change; no new failures are introduced.pytest testspassesruff check .passesThis PR was prepared with AI assistance (Claude) and reviewed by me before submitting.