Jenkins Integration

This guide explains how to integrate Wisec into your Jenkins pipelines using the two-stage setup: notarization + policy enforcement.

1. Prerequisites

  • A Wisec account and project.
  • Your Project ID from the dashboard.
  • Your Agent Signing Key (private key) generated from Settings → Signing Keys.
  • Jenkins with the Credentials Plugin installed.

2. Configure Jenkins Credentials

Manage Jenkins > Credentials > System > Global credentials - add the following:

IDKindValue
WISEC_PROJECT_IDSecret textYour numeric project ID
AGENT_PRIVATE_KEY_HEXSecret textYour Ed25519 private key
WISEC_API_ENDPOINTSecret texthttps://api.wisec.io/api/v1/events

3. Two-stage setup

The agent works in two independent stages with distinct roles. Wisec Notify notarizes the build early alongside your build (and never blocks); Wisec Gate enforces your policies at the end after CVE analysis completes.

The Wisec Gate stage is required for policy enforcement. Policies (secrets, CVE, risk score…) are evaluated and recorded by Wisec Notify, but they only ever block your pipeline through the gate. If you omit the gate stage, a build that violates a block policy will still pass. Keep the gate if you rely on policies; Wisec Notify alone gives you notarization only.

groovy
pipeline {
    agent any

    environment {
        WISEC_PROJECT_ID      = credentials('WISEC_PROJECT_ID')
        AGENT_PRIVATE_KEY_HEX = credentials('AGENT_PRIVATE_KEY_HEX')
        WISEC_API_ENDPOINT    = credentials('WISEC_API_ENDPOINT')
    }

    stages {
        stage('Checkout') {
            steps { checkout scm }
        }

        // Stage 1 - Submit build record (non-blocking, runs early)
        stage('Wisec Notify') {
            steps {
                sh '''
                    curl -fsSLO https://wisec-downloads.s3.fr-par.scw.cloud/wisec-agent-v1.5.0-linux-amd64
                    curl -fsSL https://wisec-downloads.s3.fr-par.scw.cloud/wisec-agent-v1.5.0-linux-amd64.sha256 | sha256sum -c -
                    mv wisec-agent-v1.5.0-linux-amd64 wisec-agent
                    chmod +x wisec-agent && ./wisec-agent && rm -f wisec-agent
                '''
            }
        }

        stage('Build') {
            steps { sh 'echo "Your build command"' }
        }

        stage('Test') {
            steps { sh 'echo "Your test command"' }
        }

        // Stage 2 - Policy gate (blocking, runs last)
        stage('Wisec Gate') {
            environment {
                WISEC_GATE_TIMEOUT = '120'
                WISEC_STRICT       = 'false'
            }
            steps {
                sh '''
                    curl -fsSLO https://wisec-downloads.s3.fr-par.scw.cloud/wisec-agent-v1.5.0-linux-amd64
                    curl -fsSL https://wisec-downloads.s3.fr-par.scw.cloud/wisec-agent-v1.5.0-linux-amd64.sha256 | sha256sum -c -
                    mv wisec-agent-v1.5.0-linux-amd64 wisec-agent
                    chmod +x wisec-agent && ./wisec-agent --gate && rm -f wisec-agent
                '''
            }
        }
    }
}

Gate environment variables

VariableDefaultDescription
WISEC_GATE_TIMEOUT120Max seconds to wait for analysis to complete
WISEC_STRICTfalseIf true, fails the gate when analysis times out. If false, passes silently - your CI is never broken by a Wisec outage

Policies evaluated in the gate

Post-analysis policies (cve_severity, risk_threshold) are evaluated once the CVE scan completes. Configure them in Dashboard → Policies.

4. Gitleaks (secret scanning)

groovy
        stage('Wisec Notify') {
            steps {
                sh '''
                    curl -fsSL https://github.com/gitleaks/gitleaks/releases/download/v8.30.1/gitleaks_8.30.1_linux_x64.tar.gz | tar xz
                    chmod +x gitleaks && mv gitleaks /usr/local/bin/
                    curl -fsSLO https://wisec-downloads.s3.fr-par.scw.cloud/wisec-agent-v1.5.0-linux-amd64
                    curl -fsSL https://wisec-downloads.s3.fr-par.scw.cloud/wisec-agent-v1.5.0-linux-amd64.sha256 | sha256sum -c -
                    mv wisec-agent-v1.5.0-linux-amd64 wisec-agent
                    chmod +x wisec-agent && ./wisec-agent && rm -f wisec-agent
                '''
            }
        }

5. SARIF report import

groovy
        stage('Wisec Notify') {
            environment {
                WISEC_SCAN_REPORT_PATH = "${WORKSPACE}/results.sarif"
            }
            steps {
                sh '''
                    curl -fsSLO https://wisec-downloads.s3.fr-par.scw.cloud/wisec-agent-v1.5.0-linux-amd64
                    curl -fsSL https://wisec-downloads.s3.fr-par.scw.cloud/wisec-agent-v1.5.0-linux-amd64.sha256 | sha256sum -c -
                    mv wisec-agent-v1.5.0-linux-amd64 wisec-agent
                    chmod +x wisec-agent && ./wisec-agent && rm -f wisec-agent
                '''
            }
        }

6. Binding the proof to the delivered artifact (optional)

By default, the provenance identifies the build by its source commit. To have it name the file you deliver, run the agent after the build and set WISEC_BINARY_PATH to that file. The installation guide explains what this changes, and its limits. Container images your build pushes can be named as well, with WISEC_IMAGE_DIGESTS (agent v1.3.0 or later): see Container images.

groovy
        stage('Build') {
            steps { sh 'make build' }   // produces dist/myapp
        }

        stage('Wisec Notify') {
            environment {
                WISEC_BINARY_PATH = 'dist/myapp'
            }
            steps {
                sh '''
                    curl -fsSLO https://wisec-downloads.s3.fr-par.scw.cloud/wisec-agent-v1.5.0-linux-amd64
                    curl -fsSL https://wisec-downloads.s3.fr-par.scw.cloud/wisec-agent-v1.5.0-linux-amd64.sha256 | sha256sum -c -
                    mv wisec-agent-v1.5.0-linux-amd64 wisec-agent
                    chmod +x wisec-agent && ./wisec-agent && rm -f wisec-agent
                '''
            }
        }

The Wisec Notify stage simply moves after Build; the Wisec Gate stage stays at the end of the pipeline, unchanged.

To check it worked, open the attestation from the dashboard: its subject reads artifact sha256:…. If it reads source commit …, the agent did not find the file.