Detect in Jenkins Pipeline job

In pipeline jobs there are only steps. You can generate the Detect pipeline step as follows.

  1. Navigate to Jenkins > New Item.

  2. In the Enter an item name field, type the name for your new Pipeline project.

  3. Scroll down and click Pipeline.

  4. Click OK.

  5. On the resulting page, click the Pipeline tab.

  6. To help you generate Pipeline syntax, in the Pipeline section, click Pipeline Syntax to access the Pipeline Syntax page.

    1. On the Pipeline Syntax page, click the Sample Step drop-down menu under Steps, and select synopsys_detect: Synopsys Detect.

      1. Add some Detect properties.

      2. Click Generate Pipeline Script, and you will see a Pipeline Script statement that would call the step with that configuration. You may copy and paste the whole statement into your script, or pick up just the options you care about.

      3. Optionally, select the Return status code checkbox to return a status code.

      4. Optionally, select a Custom download strategy option.

  7. Add a Pipeline script and click Save.
    The following is a simple example of a basic script.

     

  8. Run the build.

  9. After completing the Jenkins Pipeline build with Synopsys Detect, you can view the complete scan results in your Black Duck instance.

In Jenkins pipelines, there are no post-build actions because post-build actions are a Freestyle job concept.

Improved pipeline implementation

Synopsys Detect for Jenkins versions 2.1.0 and later features a pipeline-first implementation, which makes full use of step contexts and includes the following features.

  • Synopsys Detect for Jenkins returns an exit code of 0 when run successfully in a pipeline, and throws an exception when it fails.

  • Synopsys Detect for Jenkins also has a new optional field when run in pipeline called returnStatus. If returnStatus is set to true, Synopsys Detect for Jenkins does not throw an exception error when Detect fails.  Instead, it logs an error and returns the non-zero error code.

In Synopsys Detect for Jenkins versions 2.1.0 and later, build failures throw an exception error from the Pipeline step, instead of modifying the build status.

©2023 Synopsys, Inc. All Rights Reserved