Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: retrieve build-system metadata from build environment #546

Merged
merged 8 commits into from
Dec 16, 2024

Conversation

jeremylong
Copy link
Contributor

Allows the gradle plugin to retrieve the build-system URL from the environment variables present in most CI systems. By default, this feature is disabled. However, for those who would like to include this information in the generated bom they can configure:

cyclonedxBom {
    includeBuildSystem = true
}

This will attempt to retrieve the build job URL from the CI's environment variables for several CI systems (Jenkins, GitHub Actions, Drone, Jenkins, Circle CI, and Travis CI). If not found, the build-system meta-data is not populated. If you are using an different CI system not listed, you can configure the feature to use alternative environment variables and even a pattern of multiple environment variables:

cyclonedxBom {
    includeBuildSystem = true
    buildSystemEnvironmentVariable = 'MY_CUSTOM_CI_URL'
}

Using multiple environment variables can be achieved using the following (note that you must use single quotes to prevent gradle from interpolating the variables):

cyclonedxBom {
    includeBuildSystem = true
    buildSystemEnvironmentVariable = '${SERVER}/build/${BUILD_ID}'
}

Signed-off-by: Jeremy Long <jeremy.long@gmail.com>
@jeremylong jeremylong requested a review from a team as a code owner December 5, 2024 13:53
Signed-off-by: Jeremy Long <jeremy.long@gmail.com>
Signed-off-by: Jeremy Long <jeremy.long@gmail.com>
Signed-off-by: Jeremy Long <jeremy.long@gmail.com>
Signed-off-by: Jeremy Long <jeremy.long@gmail.com>
@jeremylong
Copy link
Contributor Author

I did not make this a configurable field, as in my use cases we want to be able to track back to the actual build that produced the SBOM.

Copy link
Contributor

@barblin barblin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great 👍 , just left some comments.

Signed-off-by: Jeremy Long <jeremy.long@gmail.com>
Copy link
Contributor

@barblin barblin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

Copy link
Member

@skhokhlov skhokhlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this feature. Left few considerations about the implementation.

Signed-off-by: Jeremy Long <jeremy.long@gmail.com>
@skhokhlov skhokhlov merged commit 66c8d9d into CycloneDX:master Dec 16, 2024
7 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants