jenkinsci / dependency-track-plugin

Main repository for the official Dependency-Track Jenkins plugin
https://dependencytrack.org/
Apache License 2.0
44 stars 27 forks source link

Implement Support for SBOM Quality Score Tool (sbomqs) #171

Closed msymons closed 9 months ago

msymons commented 1 year ago

Is your feature request related to a problem? Please describe.

A DT server with several hundred projects will often have a real variance in BOM quality. This might be caused by a number of things:

Describe the solution you'd like

Incorporate the sbomqs tool into the DT Jenkins plugin. This will allow for several pieces of functionality:

Additional context

Here is a screenshot showing labels in DT that have been created by sbomqs

sbomqs-tags

The tool will take care of removing old tags... important if (say) an upgrade of the tool that generates the BOM improves the score.

riteshnoronha commented 1 year ago

Thanks @msymons. I'm the creator of the tool, if you do decide to integrate this, please do reach out to me if u run into issues or concerns.

sephiroth-j commented 9 months ago

This function goes beyond what this plugin is intended for. It is not a generic SBOM plugin and does not call an external executable, for whatever reason.

You can do this yourself in your Jenkins pipeline.

  1. call sbomqs and capture the output: def out = sh(script: 'sbomqs score <sbom-file>', returnStdout: true).trim()
  2. extract the score from the captured output and store it in a variable: def score = Float.parseFloat(out.split(' ')[0])
  3. let the build fail if the score is to low: if (score < 9.0) { error 'sbom quality to low' }
  4. use the feature of setting tags to set the sbomqs-tag when uploading the sbom file: dependencyTrackPublisher artifact: '<sbom-file>', ..., projectProperties: [tags: ["sbomqs=${score}"]]