trustivan CLI, a single static binary, and runs
trustivan gate in the step’s script. 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. Add it as a secured repository or deployment variable namedTRUSTIVAN_API_KEY. 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; a private registry needs a credential stored in TRUSTIVAN first. See Scan a private registry image.
The pipeline
bitbucket-pipelines.yml
$TRUSTIVAN_API_KEY, which is where the CLI reads it. $BITBUCKET_PIPELINE_UUID
is the idempotency key, so re-running a failed step reuses its scan instead of
queueing a second one. capture-on: always keeps the SARIF file on a blocked
build, which is the build it matters for. To pin a CLI release, replace
latest/download with download/<tag> in both URLs.
What it gates on
Bitbucket fails the step on both. A failed scan is never treated as a pass. The
default wait is 20 minutes; change it with
--timeout 30m, and keep it below
the step’s max-time.
See the results
- The step log has the verdict, the policy and version, the scan id and
every rule, with
!beside the ones that fired. - The step’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.
Report without blocking
Accept exit1 and nothing else, so an outage still fails the step:
Troubleshooting
See also
trustivanCLI reference: every flag- CI pipelines: the same gate with
curl, and a certificate check withtls-check - Jira: open an issue for a blocking verdict