trustivan CLI, a single static binary, and runs
trustivan gate in a sh 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. Store it as a Jenkins Secret text credential with the idtrustivan-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 and never reads the agent’s Docker daemon. 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.com(the download) and to your TRUSTIVAN deployment.
The Jenkinsfile
Jenkinsfile
sh strings are single-quoted on purpose: the shell expands
$TRUSTIVAN_API_KEY, not Groovy, so the key is never interpolated into the
pipeline script. $BUILD_TAG 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>.
On an arm64 agent, use trustivan-linux-arm64 in all four places.
What it gates on
A failed scan is never treated as a pass. The default wait is 20 minutes; change
it with
--timeout 30m.
See the results
- The console log has the verdict, the policy and version, the scan id and
every rule, with
!beside the ones that fired. trustivan.sarifis archived on the build page. It is written before the verdict is acted on, so it exists for a blocked build too. With the Warnings Next Generation plugin installed,recordIssues tool: sarif(pattern: 'trustivan.sarif')in thepostblock shows the findings as a build report.- The dashboard has the scan and its findings under the asset.
Report without blocking
To let a new policy report before it is enforced, accept exit1 and nothing
else:
2 still fails the stage, so an outage is never read as a pass.
Troubleshooting
See also
trustivanCLI reference: every flag- CI pipelines: the same gate with
curl, and a certificate check withtls-check - Findings on pull requests with SARIF