trustivan CLI, a single static binary, and runs
trustivan gate as a command step. The gate requests a scan, waits for it, asks
for a verdict and exits 1 when the policy blocks the build.
Prerequisites
- An API key with
scans:create,scans:readandverdicts:request, plusfindings:readfor the SARIF file. Buildkite agents are yours, so expose it to the step asTRUSTIVAN_API_KEYfrom the agent’senvironmenthook or a secrets plugin, never frompipeline.yml. See Scopes. - An enabled policy in the organization, or a policy id to pass with
--policy. Without one the verdict request answers409. See Gate a pipeline on a policy. - The image already pushed to a registry TRUSTIVAN can pull from. TRUSTIVAN pulls it itself, so a registry the agent can reach but TRUSTIVAN cannot will fail the scan. A private registry needs a credential stored in TRUSTIVAN first; see Scan a private registry image.
- A Linux agent with
curlandsha256sum, and outbound HTTPS togithub.comand to your TRUSTIVAN deployment.
The pipeline
.buildkite/pipeline.yml
$ is doubled. Buildkite interpolates $VAR in pipeline.yml when the
pipeline is uploaded, and $$ is how a dollar reaches the shell intact; with
single dollars, $base would be replaced by an empty string before the step
runs. $BUILDKITE_BUILD_ID is the idempotency key, so a retried request inside
one build reuses its scan instead of queueing a second one. To pin a CLI
release, replace latest/download with download/<tag>.
What it gates on
Buildkite fails the job on both. A failed scan is never treated as a pass. The
default wait is 20 minutes; change it with
--timeout 30m.
To let a new policy report before it is enforced, mark exit 1 as a soft
failure, so a block shows on the job and does not fail the build, while exit
2 still does:
See the results
- The job log has the verdict, the policy and version, the scan id and
every rule, with
!beside the ones that fired. - The job’s Artifacts tab has
trustivan.sarif, which any SARIF 2.1.0 viewer opens. - The dashboard has the scan and its findings under the asset.
Troubleshooting
See also
trustivanCLI reference: every flag- CI pipelines: the same gate with
curl, and a certificate check withtls-check - PagerDuty: page on a blocking verdict