Integrate agents with Jenkins/Hudson (Shell)
You can create a Veracode SCA agent that scans your repositories as an automated task in your Jenkins pipeline.
The Veracode Jenkins Plugin automates the upload and scan tasks of your Jenkins build pipeline and returns Veracode SCA findings as part of a Veracode Static Analysis.
Prerequisites
Depending on the build and package managers your repositories use, your agent host has specific requirements depending on the language scanned. To view the requirements, see the code language in Finding and fixing vulnerabilities.
Install the Credentials Binding Plugin
To integrate Veracode Software Composition Analysis with Jenkins securely, install the Credentials Binding Plugin for binding your API token to the environment variable for the Veracode SCA API token.
Create your authentication token
By default, the agent you create is only visible to members of the workspace in which you created the agent. To allow visibility, invite teams to your workspace.
To complete this task:
- In the Veracode Platform, select Scans & Analysis > Software Composition Analysis.
- Select Agent-Based Scan.
- Select a workspace.
- Select Agents > Actions > Create > Jenkins/Hudson.
- Select Create Agent & Generate Token.
- Copy the value in the token field. You use the token to authenticate with Veracode SCA during scans.
Bind your Jenkins environment variable
To complete this task:
- In Jenkins, go to Credentials > Jenkins > Global credentials > Add credentials.
- From the Kind dropdown list, select Secret text.
- From the Scope dropdown list, select Global.
- In the Secret field, enter your Veracode SCA API token.
- In the ID field, enter
SRCCLR_API_TOKEN. - Select OK.
Configure your Jenkins job for scanning
To complete this task:
-
In Jenkins, select the job you want to scan.
-
Select Configure.
-
Select Build Environment.
-
Select Use secret text(s) or file(s).
-
Under Bindings, select Add > Secret text.
-
For Variable, enter
SRCCLR_API_TOKEN. -
Select SRCCLR_API_TOKEN.
-
In the build section, select Add build step > Execute shell. You can include the shell as a pre- or post-build step.
-
Add this command to the shell command box:
curl -sSL https://sca-downloads.veracode.com/ci.sh | sh -
Save your build.
Results:
The next time your job runs, Veracode SCA scans your code.