Skip to content

Commit 7a4af85

Browse files
authored
ci(release): Various workflow fixes (#790)
* ci(release): Get the digest from structured output * ci(action/publish-image): Get the digest from structured output * chore: add --quiet to noisy cargo commands * chore: resolve hadolint SC2086 * chore: resolve ruff lint issue * ci(pre-commit): compare against the main branch (stackabletech/issues#616) * ci(pre-commit): see which branches we have available to compare to * ci(pre-commit): see which refs we have available to compare to * ci(pre-commit): properly compare against the main branch (stackabletech/issues#616) * ci(pre-commit): adjust fetch-depth * ci(pre-commit): remove debug step
1 parent 5324e04 commit 7a4af85

File tree

7 files changed

+22
-31
lines changed

7 files changed

+22
-31
lines changed

.github/actions/publish-image/action.yml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,9 @@ runs:
6363
shell: bash
6464
run: |
6565
set -euo pipefail
66-
# Store the output of `docker image push` into a variable, so we can
67-
# parse it for the digest
68-
PUSH_OUTPUT=$(docker image push "$(< bake-target-tags)" 2>&1)
69-
echo "$PUSH_OUTPUT"
70-
# Obtain the digest of the pushed image from the output of `docker image
71-
# push`, because signing by tag is deprecated and will be removed from
72-
# cosign in the future
73-
DIGEST=$(echo "$PUSH_OUTPUT" | awk "/: digest: sha256:[a-f0-9]{64} size: [0-9]+$/ { print \$3 }")
66+
docker image push "$(< bake-target-tags)"
67+
# Obtain the digest of the image, because signing by tag is deprecated and will be removed from cosign in the future
68+
DIGEST=$(docker images --digests "$(< bake-target-tags)" --format '{{.Digest}}')
7469
echo "DIGEST=$DIGEST" >> $GITHUB_ENV
7570
# Refer to image via its digest (docker.stackable.tech/stackable/airflow@sha256:0a1b2c...)
7671
# This generates a signature and publishes it to the registry, next to the image
@@ -99,11 +94,9 @@ runs:
9994
IMAGE_NAME=oci.stackable.tech/sdp/${{ inputs.product }}
10095
echo "image: $IMAGE_NAME"
10196
docker tag "$(< bake-target-tags)" "$IMAGE_NAME:$TAG_NAME"
102-
# Store the output of `docker image push` into a variable, so we can parse it for the digest
103-
PUSH_OUTPUT=$(docker image push "$IMAGE_NAME:$TAG_NAME" 2>&1)
104-
echo "$PUSH_OUTPUT"
105-
# Obtain the digest of the pushed image from the output of `docker image push`, because signing by tag is deprecated and will be removed from cosign in the future
106-
DIGEST=$(echo "$PUSH_OUTPUT" | awk "/: digest: sha256:[a-f0-9]{64} size: [0-9]+$/ { print \$3 }")
97+
docker image push "$(< bake-target-tags)"
98+
# Obtain the digest of the image, because signing by tag is deprecated and will be removed from cosign in the future
99+
DIGEST=$(docker images --digests "$(< bake-target-tags)" --format '{{.Digest}}')
107100
echo "DIGEST=$DIGEST" >> $GITHUB_ENV
108101
# Refer to image via its digest (oci.stackable.tech/sdp/airflow@sha256:0a1b2c...)
109102
# This generates a signature and publishes it to the registry, next to the image

.github/workflows/pr_pre-commit.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
12+
with:
13+
fetch-depth: 0
1214
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
1315
with:
1416
python-version: '3.12'
1517
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
1618
with:
17-
extra_args: "" # Disable --all-files until we have time to fix druid/stackable/bin/run-druid
19+
extra_args: "--from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}"

.github/workflows/release.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,9 @@ jobs:
113113
TAG_NAME=$(cut -d ":" -f 2 < bake-target-tags)
114114
echo "image: $IMAGE_NAME"
115115
echo "tag: $TAG_NAME"
116-
# Store the output of `docker image push` into a variable, so we can parse it for the digest
117-
PUSH_OUTPUT=$(docker image push "$(< bake-target-tags)" 2>&1)
118-
echo "$PUSH_OUTPUT"
119-
# Obtain the digest of the pushed image from the output of `docker image push`, because signing by tag is deprecated and will be removed from cosign in the future
120-
DIGEST=$(echo "$PUSH_OUTPUT" | awk "/: digest: sha256:[a-f0-9]{64} size: [0-9]+$/ { print \$3 }")
116+
docker image push "$(< bake-target-tags)"
117+
# Obtain the digest of the image, because signing by tag is deprecated and will be removed from cosign in the future
118+
DIGEST=$(docker images --digests "$(< bake-target-tags)" --format '{{.Digest}}')
121119
# Refer to image via its digest (docker.stackable.tech/stackable/airflow@sha256:0a1b2c...)
122120
# This generates a signature and publishes it to the registry, next to the image
123121
# Uses the keyless signing flow with Github Actions as identity provider
@@ -139,11 +137,9 @@ jobs:
139137
IMAGE_NAME=oci.stackable.tech/sdp/${{ matrix.product }}
140138
echo "image: $IMAGE_NAME"
141139
docker tag "$(< bake-target-tags)" "$IMAGE_NAME:$TAG_NAME"
142-
# Store the output of `docker image push` into a variable, so we can parse it for the digest
143-
PUSH_OUTPUT=$(docker image push "$IMAGE_NAME:$TAG_NAME" 2>&1)
144-
echo "$PUSH_OUTPUT"
145-
# Obtain the digest of the pushed image from the output of `docker image push`, because signing by tag is deprecated and will be removed from cosign in the future
146-
DIGEST=$(echo "$PUSH_OUTPUT" | awk "/: digest: sha256:[a-f0-9]{64} size: [0-9]+$/ { print \$3 }")
140+
docker image push "$IMAGE_NAME:$TAG_NAME"
141+
# Obtain the digest of the image, because signing by tag is deprecated and will be removed from cosign in the future
142+
DIGEST=$(docker images --digests "$(< bake-target-tags)" --format '{{.Digest}}')
147143
# Refer to image via its digest (oci.stackable.tech/sdp/airflow@sha256:0a1b2c...)
148144
# This generates a signature and publishes it to the registry, next to the image
149145
# Uses the keyless signing flow with Github Actions as identity provider

opa/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ WORKDIR /
2323

2424
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
2525
RUN git clone --depth 1 --branch ${BUNDLE_BUILDER_VERSION} https://github.com/stackabletech/opa-bundle-builder
26-
RUN cd ./opa-bundle-builder && . $HOME/.cargo/env && cargo build --release
26+
RUN cd ./opa-bundle-builder && . "$HOME/.cargo/env" && cargo --quiet build --release
2727

2828
FROM stackable/image/stackable-base AS multilog-builder
2929

stackable-base/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ microdnf clean all
2121
rm -rf /var/cache/yum
2222

2323
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain "$RUST_DEFAULT_TOOLCHAIN_VERSION"
24-
. "$HOME/.cargo/env" && cargo install cargo-cyclonedx@"$CARGO_CYCLONEDX_CRATE_VERSION" cargo-auditable@"$CARGO_AUDITABLE_CRATE_VERSION"
24+
. "$HOME/.cargo/env" && cargo --quiet install cargo-cyclonedx@"$CARGO_CYCLONEDX_CRATE_VERSION" cargo-auditable@"$CARGO_AUDITABLE_CRATE_VERSION"
2525

2626
git clone --depth 1 --branch "${CONFIG_UTILS_VERSION}" https://github.com/stackabletech/config-utils
2727
cd ./config-utils
2828
. "$HOME/.cargo/env"
29-
cargo auditable build --release && cargo cyclonedx --output-pattern package --all --output-cdx
29+
cargo auditable --quiet build --release && cargo cyclonedx --output-pattern package --all --output-cdx
3030
EOF
3131

3232
# Manifest list digest because of multi architecture builds ( https://www.redhat.com/architect/pull-container-image#:~:text=A%20manifest%20list%20exists%20to,system%20on%20a%20specific%20architecture )

ubi8-rust-builder/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ WORKDIR /
6767
# If you change the toolchain version here, make sure to also change the "rust_version"
6868
# property in operator-templating/config/rust.yaml
6969
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain $RUST_DEFAULT_TOOLCHAIN_VERSION \
70-
&& . "$HOME/.cargo/env" && cargo install cargo-cyclonedx@$CARGO_CYCLONEDX_CRATE_VERSION cargo-auditable@$CARGO_AUDITABLE_CRATE_VERSION
70+
&& . "$HOME/.cargo/env" && cargo --quiet install cargo-cyclonedx@$CARGO_CYCLONEDX_CRATE_VERSION cargo-auditable@$CARGO_AUDITABLE_CRATE_VERSION
7171

7272
# Build artifacts will be available in /app.
7373
RUN mkdir /app
@@ -77,7 +77,7 @@ COPY shared/copy_artifacts.sh /
7777
ONBUILD WORKDIR /src
7878
ONBUILD COPY . /src
7979

80-
ONBUILD RUN . "$HOME/.cargo/env" && cargo auditable build --release --workspace && cargo cyclonedx --output-pattern package --all --output-cdx
80+
ONBUILD RUN . "$HOME/.cargo/env" && cargo auditable --quiet build --release --workspace && cargo cyclonedx --output-pattern package --all --output-cdx
8181

8282
# Copy the "interesting" files into /app.
8383
ONBUILD RUN find /src/target/release \

ubi9-rust-builder/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ WORKDIR /
6666
# If you change the toolchain version here, make sure to also change the "rust_version"
6767
# property in operator-templating/config/rust.yaml
6868
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain $RUST_DEFAULT_TOOLCHAIN_VERSION \
69-
&& . "$HOME/.cargo/env" && cargo install cargo-cyclonedx@$CARGO_CYCLONEDX_CRATE_VERSION cargo-auditable@$CARGO_AUDITABLE_CRATE_VERSION
69+
&& . "$HOME/.cargo/env" && cargo --quiet install cargo-cyclonedx@$CARGO_CYCLONEDX_CRATE_VERSION cargo-auditable@$CARGO_AUDITABLE_CRATE_VERSION
7070

7171
# Build artifacts will be available in /app.
7272
RUN mkdir /app
@@ -76,7 +76,7 @@ COPY shared/copy_artifacts.sh /
7676
ONBUILD WORKDIR /src
7777
ONBUILD COPY . /src
7878

79-
ONBUILD RUN . "$HOME/.cargo/env" && cargo auditable build --release --workspace && cargo cyclonedx --output-pattern package --all --output-cdx
79+
ONBUILD RUN . "$HOME/.cargo/env" && cargo auditable --quiet build --release --workspace && cargo cyclonedx --output-pattern package --all --output-cdx
8080

8181
# Copy the "interesting" files into /app.
8282
ONBUILD RUN find /src/target/release \

0 commit comments

Comments
 (0)