Skip to content

Feature Request: Fail build on Dependency-Track policy violations #18

@janitza-jafi

Description

@janitza-jafi

What’s missing?
Add a new Gradle task, policyCheck, that uploads the SBOM (or waits for an existing upload), polls the Dependency-Track API for policy results, and fails the build when violations matching a user-defined status list are found.

Desired behaviour

dependencyTrackCompanion {
    policyCheck {
        timeout.set(60.seconds)          // wait for DT to finish evaluation
        failOn.set(listOf(FAIL, WARN))   // default = [FAIL]
    }
}
  • timeout – max wait for policy evaluation (default 0 s).
  • failOn – list of violation states that should break the build (INFO, WARN, FAIL; default FAIL).

Acceptance criteria

  1. Task succeeds when no matching violations exist.
  2. Task fails (exit 1) if at least one matching violation is present.
  3. Console shows a short summary: counts per status plus links to the project.

Happy to contribute a PR if this fits the roadmap!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions