There are three players in this process:
The diagram below illustrates how the process is implemented using Jenkins CI.
Xray scans the build according to a defined Watch with a Fail Build Job Action.
You may define multiple Watches with a Fail Build Job Action, each with its own criteria (i.e. Artifact Filters and/or Issue Filters) that should trigger an alert. All of these Watches are applied each time a build is scanned. If Xray receives a scanBuild request, and there are no Watches defined with a Fail Build Job Action, Xray will always respond with an indication to fail the build job, even if no vulnerabilities are found in the build artifacts or their dependencies. |
Xray responds to the scanBuild request indicating that the build job should fail.
The response includes the details of all Alerts generated by all Watches that include a Fail Build Job Action. |
Xray's build integration allows you to manage your build jobs and configure them with appropriate actions if build artifacts or dependencies with vulnerabilities are found in your builds. While the default action (in Jenkins) is to simply stop the build, you can actually configure your pipeline to do other things like send email notifications or even run a different build job.
Xray supports CI/CD integration from version 1.6
For Xray to scan builds upon request by a CI server, you need to configure a Watch with the right filters that specify which artifacts and vulnerabilities should trigger an alert, and set a Fail Build Job Action for that Watch.
Xray CI/CD integration is supported for Jenkins CI, TeamCity, and Bamboo.
To configure a build job to request a scan, with the Jenkins Artifactory Plugin (v2.9.0 and above), you need to create a scanConfig
instance and and pass it to the xrayScan
method in the Jenkins Pipeline.
To scan build artifacts and dependencies for vulnerabilities with the TeamCity Artifactory Plugin, you need to enable the Xray scan on build and Fail build options, configured per build.
To scan build artifacts for vulnerabilities, with the Bamboo Artifactory Plugin, you need to add the Artifactory Xray Scan task to your plan. The task should follow a previous task which publishes the build-info to Artifactory.
To scan build artifacts for vulnerabilities in Azure DevOps or TFS, you need to add the Artifactory Xray Scan task after the Artifactory Publish BuildInfo task.
While Artifactory does not play an active part in this integration, and there is no explicit configuration needed, Artifactory does play a passive role in passing information between your CI server and JFrog Xray.
This feature is supported in Artifactory from v4.16 and above.
Watch this screencast to learn how to get the best of two worlds - developer productivity and safety, by scanning the results of every build for security vulnerabilities, license compliance issues and more with JFrog Xray.
<iframe width="560" height="315" src="https://www.youtube.com/embed/4JMOgImrQ_I" frameborder="0" allowfullscreen></iframe> |