There is no Jenkins plugin. The recipe downloads the 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:read and verdicts:request, plus findings:read for the SARIF file. Store it as a Jenkins Secret text credential with the id trustivan-api-key. See Scopes.
  • An enabled policy in the organization, or a policy id to pass with --policy. Without one the verdict request answers 409. 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 curl and sha256sum, and outbound HTTPS to github.com (the download) and to your TRUSTIVAN deployment.

The Jenkinsfile

Jenkinsfile
The 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.sarif is 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 the post block 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 exit 1 and nothing else:
Exit 2 still fails the stage, so an outage is never read as a pass.

Troubleshooting

See also