Skip to content

Commit 95e38af

Browse files
authored
Update cargo-cyclonedx and enable Renovate to update it (#783)
* Update cargo-cyclonedx and enable Renovate to update it This adds the necessary annotations (together with our custom renovate config) to be able to update versions in our Dockerfiles as long as they are ENV <something>_VERSION and they have a comment telling renovate what to update * Update cargo-cyclonedx and add more renovate annotations * Fix name of SBOM with new generator version * Update changelog
1 parent 03c70a4 commit 95e38af

File tree

6 files changed

+65
-45
lines changed

6 files changed

+65
-45
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ All notable changes to this project will be documented in this file.
2121

2222
- ci: Rename local actions, adjust action inputs and outputs, add definition
2323
README file ([#819]).
24+
- Update cargo-cyclonedx to 0.5.5 and build CycloneDX 1.5 files ([#783])
2425

2526
### Removed
2627

@@ -38,6 +39,7 @@ All notable changes to this project will be documented in this file.
3839

3940
- hbase: link to phoenix server jar ([#811]).
4041

42+
[#783]: https://github.com/stackabletech/docker-images/pull/783
4143
[#797]: https://github.com/stackabletech/docker-images/pull/797
4244
[#802]: https://github.com/stackabletech/docker-images/pull/802
4345
[#809]: https://github.com/stackabletech/docker-images/pull/809

renovate.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
33
"extends": [
4-
"local>stackabletech/.github:renovate-config",
4+
"github>stackabletech/.github:renovate-config",
55
"docker:pinDigests"
66
]
77
}

shared/copy_artifacts.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
# Copy over the binary
44
cp "$1" /app
55

6-
# And now try to find a BOM file named like the binary + .cdx.xml and copy it over as well if it exists
6+
# And now try to find a BOM file named like the binary + _bin.cdx.xml and copy it over as well if it exists
77
base=$(basename "$1")
8-
find /src/rust/ -type f -name "$base.cdx.xml" -exec cp {} /app \;
8+
find /src/rust/ -type f -name "${base}_bin.cdx.xml" -exec cp {} /app \;

stackable-base/Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@
66
FROM registry.access.redhat.com/ubi9/ubi-minimal@sha256:1b6d711648229a1c987f39cfdfccaebe2bd92d0b5d8caa5dbaa5234a9278a0b2 AS product-utils-builder
77

88
# Find the latest version here: https://github.com/stackabletech/config-utils/tags
9+
# renovate: datasource=github-tags packageName=stackabletech/config-utils
910
ENV CONFIG_UTILS_VERSION=0.2.0
1011
# This SHOULD be kept in sync with operator-templating and other tools to reduce build times
1112
# Find the latest version here: https://doc.rust-lang.org/stable/releases.html
13+
# renovate: datasource=github-releases packageName=rust-lang/rust
1214
ENV RUST_DEFAULT_TOOLCHAIN_VERSION=1.80.1
1315
# Find the latest version here: https://crates.io/crates/cargo-cyclonedx
14-
# IMPORTANT: Do not update until https://github.com/stackabletech/docker-images/pull/783 is merged
15-
ENV CARGO_CYCLONEDX_CRATE_VERSION=0.4.0
16+
# renovate: datasource=crate packageName=cargo-cyclonedx
17+
ENV CARGO_CYCLONEDX_CRATE_VERSION=0.5.5
1618
# Find the latest version here: https://crates.io/crates/cargo-auditable
19+
# renovate: datasource=crate packageName=cargo-auditable
1720
ENV CARGO_AUDITABLE_CRATE_VERSION=0.6.4
1821

1922
RUN <<EOF
@@ -33,7 +36,7 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --defaul
3336
git clone --depth 1 --branch "${CONFIG_UTILS_VERSION}" https://github.com/stackabletech/config-utils
3437
cd ./config-utils
3538
. "$HOME/.cargo/env"
36-
cargo auditable --quiet build --release && cargo cyclonedx --output-pattern package --all --output-cdx
39+
cargo auditable --quiet build --release && cargo cyclonedx --all --spec-version 1.5 --describe binaries
3740
EOF
3841

3942
# Find the latest version at https://catalog.redhat.com/software/containers/ubi9/ubi-minimal/615bd9b4075b022acc111bf5?container-tabs=gti
@@ -159,10 +162,11 @@ fi
159162
EOF
160163

161164
COPY --from=product-utils-builder --chown=stackable:stackable /config-utils/target/release/config-utils /stackable/config-utils
162-
COPY --from=product-utils-builder --chown=stackable:stackable /config-utils/config-utils.cdx.xml /stackable/config-utils.cdx.xml
165+
COPY --from=product-utils-builder --chown=stackable:stackable /config-utils/config-utils_bin.cdx.xml /stackable/config-utils.cdx.xml
163166
ENV PATH="${PATH}:/stackable"
164167

165168
# These labels have mostly been superceded by the OpenContainer spec annotations below but it doesn't hurt to include them
169+
# http://label-schema.org/rc1/
166170
LABEL maintainer="info@stackable.tech"
167171
LABEL vendor="Stackable GmbH"
168172

ubi8-rust-builder/Dockerfile

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,17 @@ LABEL maintainer="Stackable GmbH"
1111

1212
# This SHOULD be kept in sync with operator-templating and other tools to reduce build times
1313
# Find the latest version here: https://doc.rust-lang.org/stable/releases.html
14+
# renovate: datasource=github-releases packageName=rust-lang/rust
1415
ENV RUST_DEFAULT_TOOLCHAIN_VERSION=1.80.1
1516
# Find the latest version here: https://crates.io/crates/cargo-cyclonedx
16-
# IMPORTANT: Do not update until https://github.com/stackabletech/docker-images/pull/783 is merged
17-
ENV CARGO_CYCLONEDX_CRATE_VERSION=0.4.0
17+
# renovate: datasource=crate packageName=cargo-cyclonedx
18+
ENV CARGO_CYCLONEDX_CRATE_VERSION=0.5.5
1819
# Find the latest version here: https://crates.io/crates/cargo-auditable
20+
# renovate: datasource=crate packageName=cargo-auditable
1921
ENV CARGO_AUDITABLE_CRATE_VERSION=0.6.4
2022
# Find the latest version here: https://github.com/protocolbuffers/protobuf/releases
2123
# Upload any newer version to nexus with ./.scripts/upload_new_protoc_version.sh
24+
# renovate: datasource=github-releases packageName=protocolbuffers/protobuf
2225
ENV PROTOC_VERSION=27.3
2326

2427
# Sets the default shell to Bash with strict error handling and robust pipeline processing.
@@ -73,8 +76,11 @@ WORKDIR /
7376
# IMPORTANT
7477
# If you change the toolchain version here, make sure to also change the "rust_version"
7578
# property in operator-templating/config/rust.yaml
76-
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain $RUST_DEFAULT_TOOLCHAIN_VERSION \
77-
&& . "$HOME/.cargo/env" && cargo --quiet install cargo-cyclonedx@$CARGO_CYCLONEDX_CRATE_VERSION cargo-auditable@$CARGO_AUDITABLE_CRATE_VERSION
79+
RUN <<EOF
80+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain "$RUST_DEFAULT_TOOLCHAIN_VERSION"
81+
. "$HOME/.cargo/env"
82+
cargo --quiet install "cargo-cyclonedx@$CARGO_CYCLONEDX_CRATE_VERSION" "cargo-auditable@$CARGO_AUDITABLE_CRATE_VERSION"
83+
EOF
7884

7985
# Build artifacts will be available in /app.
8086
RUN mkdir /app
@@ -84,20 +90,21 @@ COPY shared/copy_artifacts.sh /
8490
ONBUILD WORKDIR /src
8591
ONBUILD COPY . /src
8692

87-
ONBUILD RUN . "$HOME/.cargo/env" && cargo auditable --quiet build --release --workspace && cargo cyclonedx --output-pattern package --all --output-cdx
93+
ONBUILD RUN <<EOF
94+
. "$HOME/.cargo/env"
95+
cargo auditable --quiet build --release --workspace
96+
cargo cyclonedx --all --spec-version 1.5 --describe binaries
8897

89-
# Copy the "interesting" files into /app.
90-
ONBUILD RUN find /src/target/release \
91-
-regextype egrep \
92-
# The interesting binaries are all directly in ${BUILD_DIR}.
93-
-maxdepth 1 \
94-
# Well, binaries are executable.
95-
-executable \
96-
# Well, binaries are files.
97-
-type f \
98-
# Filter out tests.
99-
! -regex ".*\-[a-fA-F0-9]{16,16}$" \
100-
# Copy the matching files into /app.
101-
-exec /copy_artifacts.sh {} \;
98+
# -maxdepth 1: The interesting binaries are all directly in ${BUILD_DIR}.
99+
# -regex filters out tests
100+
# - exec copies matching files to /app
101+
find /src/target/release \
102+
-regextype egrep \
103+
-maxdepth 1 \
104+
-executable \
105+
-type f \
106+
! -regex ".*\-[a-fA-F0-9]{16,16}$" \
107+
-exec /copy_artifacts.sh {} \;
102108

103-
ONBUILD RUN echo "The following files will be copied to the runtime image: $(ls /app)"
109+
echo "The following files will be copied to the runtime image: $(ls /app)"
110+
EOF

ubi9-rust-builder/Dockerfile

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@ LABEL maintainer="Stackable GmbH"
88

99
# This SHOULD be kept in sync with operator-templating and other tools to reduce build times
1010
# Find the latest version here: https://doc.rust-lang.org/stable/releases.html
11+
# renovate: datasource=github-releases packageName=rust-lang/rust
1112
ENV RUST_DEFAULT_TOOLCHAIN_VERSION=1.80.1
1213
# Find the latest version here: https://crates.io/crates/cargo-cyclonedx
13-
# IMPORTANT: Do not update until https://github.com/stackabletech/docker-images/pull/783 is merged
14-
ENV CARGO_CYCLONEDX_CRATE_VERSION=0.4.0
14+
# renovate: datasource=crate packageName=cargo-cyclonedx
15+
ENV CARGO_CYCLONEDX_CRATE_VERSION=0.5.5
1516
# Find the latest version here: https://crates.io/crates/cargo-auditable
17+
# renovate: datasource=crate packageName=cargo-auditable
1618
ENV CARGO_AUDITABLE_CRATE_VERSION=0.6.4
1719
# Find the latest version here: https://github.com/protocolbuffers/protobuf/releases
1820
# Upload any newer version to nexus with ./.scripts/upload_new_protoc_version.sh
21+
# renovate: datasource=github-releases packageName=protocolbuffers/protobuf
1922
ENV PROTOC_VERSION=27.3
2023

2124
# Sets the default shell to Bash with strict error handling and robust pipeline processing.
@@ -72,8 +75,11 @@ WORKDIR /
7275
# IMPORTANT
7376
# If you change the toolchain version here, make sure to also change the "rust_version"
7477
# property in operator-templating/config/rust.yaml
75-
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain $RUST_DEFAULT_TOOLCHAIN_VERSION \
76-
&& . "$HOME/.cargo/env" && cargo --quiet install cargo-cyclonedx@$CARGO_CYCLONEDX_CRATE_VERSION cargo-auditable@$CARGO_AUDITABLE_CRATE_VERSION
78+
RUN <<EOF
79+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain "$RUST_DEFAULT_TOOLCHAIN_VERSION"
80+
. "$HOME/.cargo/env"
81+
cargo install --quiet "cargo-cyclonedx@$CARGO_CYCLONEDX_CRATE_VERSION" "cargo-auditable@$CARGO_AUDITABLE_CRATE_VERSION"
82+
EOF
7783

7884
# Build artifacts will be available in /app.
7985
RUN mkdir /app
@@ -83,20 +89,21 @@ COPY shared/copy_artifacts.sh /
8389
ONBUILD WORKDIR /src
8490
ONBUILD COPY . /src
8591

86-
ONBUILD RUN . "$HOME/.cargo/env" && cargo auditable --quiet build --release --workspace && cargo cyclonedx --output-pattern package --all --output-cdx
92+
ONBUILD RUN <<EOF
93+
. "$HOME/.cargo/env"
94+
cargo auditable --quiet build --release --workspace
95+
cargo cyclonedx --all --spec-version 1.5 --describe binaries
8796

88-
# Copy the "interesting" files into /app.
89-
ONBUILD RUN find /src/target/release \
90-
-regextype egrep \
91-
# The interesting binaries are all directly in ${BUILD_DIR}.
92-
-maxdepth 1 \
93-
# Well, binaries are executable.
94-
-executable \
95-
# Well, binaries are files.
96-
-type f \
97-
# Filter out tests.
98-
! -regex ".*\-[a-fA-F0-9]{16,16}$" \
99-
# Copy the matching files into /app.
100-
-exec /copy_artifacts.sh {} \;
97+
# -maxdepth 1: The interesting binaries are all directly in ${BUILD_DIR}.
98+
# -regex filters out tests
99+
# - exec copies matching files to /app
100+
find /src/target/release \
101+
-regextype egrep \
102+
-maxdepth 1 \
103+
-executable \
104+
-type f \
105+
! -regex ".*\-[a-fA-F0-9]{16,16}$" \
106+
-exec /copy_artifacts.sh {} \;
101107

102-
ONBUILD RUN echo "The following files will be copied to the runtime image: $(ls /app)"
108+
echo "The following files will be copied to the runtime image: $(ls /app)"
109+
EOF

0 commit comments

Comments
 (0)