-
-
Couldn't load subscription status.
- Fork 6
feat: add missing build-time SBOMs #895
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
e20dda2
feat: generate SBOMs at build time for OPA, statsd_exporter and kafka
dervoeti 20ec9ba
fix: remove circular dependencies in Airflow SBOM
dervoeti 306b756
fix: kafka: ignore test components in SBOM
dervoeti 924bb56
fix: kafka: missing patchfile for kafka 3.8.0
dervoeti 05b7e5b
fix: no need to cleanup builder image
dervoeti 576553f
fix: add comment about cyclonedx-gomod to statsd_exporter as well
dervoeti 605c0a6
fix: undo merge errors
dervoeti a49d0d3
fix: casing to make linter happy
dervoeti cca93e2
fix: indenting and alphabetical sorting of packages
dervoeti c721b5d
fix: re-added line to remove sourcecode after build of statsd_exporter
dervoeti cdcf49c
fix: merge RUN layers in statsd_exporter
dervoeti d30b0e1
fix: place SBOM files closer to the application they are for
dervoeti 2b3d70a
fix: update gradle cyclonedx plugin to version 1.10.0
dervoeti acb8c56
fix: remove unnecessary curl flags, because we have a curlrc file
dervoeti fc9d2d1
fix: fixed variable substitution
dervoeti 07cb2f6
feat: pinned versions of python packages
dervoeti c459c49
fix: fixes to adapt upstream changes
dervoeti 8dcdd7f
fix: use GOPATH for invoking cyclonedx-gomod
dervoeti 5662fef
feat: add comment on how to obtain skipped projects in Kafka build
dervoeti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| diff --git a/build.gradle b/build.gradle | ||
| index 32e6e8f..13a0def 100644 | ||
| --- a/build.gradle | ||
| +++ b/build.gradle | ||
| @@ -48,6 +48,47 @@ plugins { | ||
| // artifacts - see https://github.com/johnrengelman/shadow/issues/901 | ||
| id 'com.github.johnrengelman.shadow' version '8.1.0' apply false | ||
| id 'com.diffplug.spotless' version '6.14.0' apply false // 6.14.1 and newer require Java 11 at compile time, so we can't upgrade until AK 4.0 | ||
| + id 'org.cyclonedx.bom' version '1.10.0' | ||
| +} | ||
| + | ||
| +cyclonedxBom { | ||
| + // Specified the type of project being built. Defaults to 'library' | ||
| + projectType = "application" | ||
| + // Specified the version of the CycloneDX specification to use. Defaults to '1.5' | ||
| + schemaVersion = "1.5" | ||
| + // Boms destination directory. Defaults to 'build/reports' | ||
| + destination = file("build/reports") | ||
| + // The file name for the generated BOMs (before the file format suffix). Defaults to 'bom' | ||
| + outputName = "bom" | ||
| + // The file format generated, can be xml, json or all for generating both. Defaults to 'all' | ||
| + outputFormat = "json" | ||
| + includeConfigs = ["runtimeClasspath"] | ||
| + // Exclude test components. This list needs to be checked and, if it changed, updated for every new Kafka version. | ||
| + // The list can be obtained by running `gradle projects | grep upgrade-system-tests` | ||
| + skipProjects = [ | ||
| + 'upgrade-system-tests-0100', | ||
| + 'upgrade-system-tests-0101', | ||
| + 'upgrade-system-tests-0102', | ||
| + 'upgrade-system-tests-0110', | ||
| + 'upgrade-system-tests-10', | ||
| + 'upgrade-system-tests-11', | ||
| + 'upgrade-system-tests-20', | ||
| + 'upgrade-system-tests-21', | ||
| + 'upgrade-system-tests-22', | ||
| + 'upgrade-system-tests-23', | ||
| + 'upgrade-system-tests-24', | ||
| + 'upgrade-system-tests-25', | ||
| + 'upgrade-system-tests-26', | ||
| + 'upgrade-system-tests-27', | ||
| + 'upgrade-system-tests-28', | ||
| + 'upgrade-system-tests-30', | ||
| + 'upgrade-system-tests-31', | ||
| + 'upgrade-system-tests-32', | ||
| + 'upgrade-system-tests-33', | ||
| + 'upgrade-system-tests-34', | ||
| + 'upgrade-system-tests-35', | ||
| + 'upgrade-system-tests-36' | ||
| + ] | ||
| } | ||
|
|
||
| ext { | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| diff --git a/build.gradle b/build.gradle | ||
| index 92082fe..e3d6c72 100644 | ||
| --- a/build.gradle | ||
| +++ b/build.gradle | ||
| @@ -48,6 +48,48 @@ plugins { | ||
| // artifacts - see https://github.com/johnrengelman/shadow/issues/901 | ||
| id 'com.github.johnrengelman.shadow' version '8.1.0' apply false | ||
| id 'com.diffplug.spotless' version '6.14.0' apply false // 6.14.1 and newer require Java 11 at compile time, so we can't upgrade until AK 4.0 | ||
| + id 'org.cyclonedx.bom' version '1.10.0' | ||
| +} | ||
| + | ||
| +cyclonedxBom { | ||
| + // Specified the type of project being built. Defaults to 'library' | ||
| + projectType = "application" | ||
| + // Specified the version of the CycloneDX specification to use. Defaults to '1.5' | ||
| + schemaVersion = "1.5" | ||
| + // Boms destination directory. Defaults to 'build/reports' | ||
| + destination = file("build/reports") | ||
| + // The file name for the generated BOMs (before the file format suffix). Defaults to 'bom' | ||
| + outputName = "bom" | ||
| + // The file format generated, can be xml, json or all for generating both. Defaults to 'all' | ||
| + outputFormat = "json" | ||
| + includeConfigs = ["runtimeClasspath"] | ||
| + // Exclude test components. This list needs to be checked and, if it changed, updated for every new Kafka version. | ||
| + // The list can be obtained by running `gradle projects | grep upgrade-system-tests` | ||
| + skipProjects = [ | ||
| + 'upgrade-system-tests-0100', | ||
| + 'upgrade-system-tests-0101', | ||
| + 'upgrade-system-tests-0102', | ||
| + 'upgrade-system-tests-0110', | ||
| + 'upgrade-system-tests-10', | ||
| + 'upgrade-system-tests-11', | ||
| + 'upgrade-system-tests-20', | ||
| + 'upgrade-system-tests-21', | ||
| + 'upgrade-system-tests-22', | ||
| + 'upgrade-system-tests-23', | ||
| + 'upgrade-system-tests-24', | ||
| + 'upgrade-system-tests-25', | ||
| + 'upgrade-system-tests-26', | ||
| + 'upgrade-system-tests-27', | ||
| + 'upgrade-system-tests-28', | ||
| + 'upgrade-system-tests-30', | ||
| + 'upgrade-system-tests-31', | ||
| + 'upgrade-system-tests-32', | ||
| + 'upgrade-system-tests-33', | ||
| + 'upgrade-system-tests-34', | ||
| + 'upgrade-system-tests-35', | ||
| + 'upgrade-system-tests-36', | ||
| + 'upgrade-system-tests-37' | ||
| + ] | ||
| } | ||
|
|
||
| ext { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # Enable error handling and unset variable checking | ||
| set -eu | ||
| set -o pipefail | ||
|
|
||
| # Check if $1 (VERSION) is provided | ||
| if [ -z "${1-}" ]; then | ||
| echo "Please provide a value for VERSION as the first argument." | ||
| exit 1 | ||
| fi | ||
|
|
||
| VERSION="$1" | ||
| PATCH_DIR="patches/$VERSION" | ||
|
|
||
| # Check if version-specific patches directory exists | ||
| if [ ! -d "$PATCH_DIR" ]; then | ||
| echo "Patches directory '$PATCH_DIR' does not exist." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Create an array to hold the patches in sorted order | ||
| declare -a patch_files=() | ||
|
|
||
| echo "Applying patches from ${PATCH_DIR}" now | ||
|
|
||
| # Read the patch files into the array | ||
| while IFS= read -r -d $'\0' file; do | ||
| patch_files+=("$file") | ||
| done < <(find "$PATCH_DIR" -name "*.patch" -print0 | sort -zV) | ||
|
|
||
| echo "Found ${#patch_files[@]} patches, applying now" | ||
|
|
||
| # Iterate through sorted patch files | ||
| for patch_file in "${patch_files[@]}"; do | ||
| echo "Applying $patch_file" | ||
| # We can not use Git here, as we are not within a Git repo | ||
| patch --directory "." --strip=1 < "$patch_file" || { | ||
| echo "Failed to apply $patch_file" | ||
| exit 1 | ||
| } | ||
| done | ||
|
|
||
| echo "All patches applied successfully." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,22 +64,36 @@ ARG TARGETOS | |
| ENV GOARCH=$TARGETARCH | ||
| ENV GOOS=$TARGETOS | ||
|
|
||
| # go - used to build OPA | ||
| # gzip, tar - used to unpack the OPA source | ||
| # git - needed by the cyclonedx-gomod tool to determine the version of OPA | ||
| # golang - used to build OPA | ||
| RUN microdnf update && \ | ||
| microdnf install \ | ||
| go \ | ||
| git \ | ||
| golang \ | ||
| gzip \ | ||
| tar && \ | ||
| microdnf clean all | ||
|
|
||
| # We use version 1.7.0, since a newer version of cyclonedx-gomod is not compatible with the version of Golang (>= 1.23.1) | ||
| RUN go install github.com/CycloneDX/cyclonedx-gomod/cmd/[email protected] | ||
| RUN curl "https://repo.stackable.tech/repository/packages/opa/opa_${PRODUCT}.tar.gz" -o opa.tar.gz && \ | ||
| tar -zxvf opa.tar.gz && \ | ||
| mv opa-${PRODUCT} opa | ||
| mv "opa-${PRODUCT}" opa | ||
|
|
||
| WORKDIR /opa | ||
|
|
||
| RUN go build -o opa -buildmode=exe | ||
| RUN <<EOF | ||
| # Unfortunately, we need to create a dummy Git repository to allow cyclonedx-gomod to determine the version of OPA | ||
| git init | ||
| git add go.mod | ||
| git config --global user.email "[email protected]" | ||
| git config --global user.name "dummy" | ||
| git commit -m "dummy" | ||
| git tag "${PRODUCT}" | ||
| go build -o opa -buildmode=exe | ||
| ~/go/bin/cyclonedx-gomod app -json -output-version 1.5 -output "opa_${PRODUCT}.cdx.json" -packages -files | ||
| EOF | ||
|
|
||
| FROM stackable/image/vector | ||
|
|
||
|
|
@@ -98,6 +112,7 @@ LABEL name="Open Policy Agent" \ | |
| COPY opa/licenses /licenses | ||
|
|
||
| COPY --from=opa-builder --chown=${STACKABLE_USER_UID}:0 /opa/opa /stackable/opa/opa | ||
| COPY --from=opa-builder --chown=${STACKABLE_USER_UID}:0 /opa/opa_${PRODUCT}.cdx.json /stackable/opa/ | ||
| COPY --from=opa-bundle-builder --chown=${STACKABLE_USER_UID}:0 /opa-bundle-builder/target/release/stackable-opa-bundle-builder /stackable/opa-bundle-builder | ||
| COPY --from=multilog-builder --chown=${STACKABLE_USER_UID}:0 /daemontools/admin/daemontools/command/multilog /stackable/multilog | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,19 +11,33 @@ microdnf update | |
|
|
||
| # Tar and gzip are used to unpack the statsd_exporter source | ||
| # Golang is used to build statsd_exporter | ||
| # Git is needed by the cyclonedx-gomod tool to determine the version of statsd_exporter | ||
| microdnf install \ | ||
| tar \ | ||
| gzip \ | ||
| git \ | ||
| golang | ||
|
|
||
| microdnf clean all | ||
| rm -rf /var/cache/yum | ||
|
|
||
| export GOPATH=/go_cache | ||
| # We use version 1.7.0, since a newer version of cyclonedx-gomod is not compatible with the version of Golang (>= 1.23.1) | ||
| go install github.com/CycloneDX/cyclonedx-gomod/cmd/[email protected] | ||
dervoeti marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| curl "https://repo.stackable.tech/repository/packages/statsd_exporter/statsd_exporter-${PRODUCT}.src.tar.gz" | tar -xzC . | ||
| ( | ||
| cd "statsd_exporter-${PRODUCT}" || exit | ||
|
|
||
| # Unfortunately, we need to create a dummy Git repository to allow cyclonedx-gomod to determine the version of statsd_exporter | ||
| git init | ||
| git add go.mod | ||
| git config --global user.email "[email protected]" | ||
| git config --global user.name "dummy" | ||
| git commit -m "dummy" | ||
| git tag "${PRODUCT}" | ||
| go build -o ../statsd_exporter | ||
| $GOPATH/bin/cyclonedx-gomod app -json -output-version 1.5 -output ../statsd_exporter-${PRODUCT}.cdx.json -packages -files | ||
| ) | ||
| rm -rf "statsd_exporter-${PRODUCT}" | ||
dervoeti marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| EOF | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.