Skip to content

Commit 2249c09

Browse files
committed
CI: fix build-dockerfile workflow
1 parent 2dbd2bb commit 2249c09

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

.github/workflows/build-dockerfile.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
FINAL_BASE_IMAGE_DIGEST="$(docker inspect --format='{{index .RepoDigests 0}}' "$FINAL_BASE_IMAGE" | grep -o '[[:alnum:]:]\+$')"
9696
9797
BUILD_BASE_IMAGE="ghcr.io/paulsengroup/ci-docker-images/$OS_NAME-$OS_VERSION-cxx-$C_COMPILER:latest"
98-
FINAL_BASE_IMAGE="$(echo "${FINAL_BASE_IMAGE#docker.io/library/}" | cut -d : -f 1)"
98+
FINAL_BASE_IMAGE="${FINAL_BASE_IMAGE#docker.io/library/}"
9999
100100
if [[ '${{ github.event_name }}' == 'pull_request' ]]; then
101101
HICTK_GIT_HASH=0000000000000000000000000000000000000000
@@ -107,10 +107,10 @@ jobs:
107107
HICTK_GIT_SHORT_HASH="$(git rev-parse --short HEAD)"
108108
HICTK_GIT_TAG="$(git for-each-ref 'refs/tags/v*.*.*' --count 1 --sort=-v:refname --format "%(refname:short)" --points-at HEAD)"
109109
if [ -z "$HICTK_GIT_TAG" ]; then
110-
VERSION="sha-$GIT_SHORT_HASH"
111-
GIT_TAG=unknown
110+
VERSION="sha-$HICTK_GIT_SHORT_HASH"
111+
HICTK_GIT_TAG=unknown
112112
else
113-
VERSION="$GIT_TAG"
113+
VERSION="$HICTK_GIT_TAG"
114114
fi
115115
fi
116116
@@ -288,8 +288,12 @@ jobs:
288288
working-directory: ${{ runner.temp }}/digests
289289
run: |
290290
# https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners
291-
docker buildx imagetools create "$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON")" \
292-
"$(printf ' ${{ github.repository }}@sha256:%s ' *)"
291+
args="$(printf ' ${{ github.repository }}@sha256:%s ' *)"
292+
args+=" $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON")"
293+
read -r -a args_array <<< "$args"
294+
295+
set -x
296+
docker buildx imagetools create "${args_array[@]}"
293297
294298
- name: Inspect image (DockerHub)
295299
run: docker buildx imagetools inspect ${{ github.repository }}
@@ -298,8 +302,12 @@ jobs:
298302
working-directory: ${{ runner.temp }}/digests
299303
run: |
300304
# https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners
301-
docker buildx imagetools create "$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON")" \
302-
"$(printf ' ghcr.io/${{ github.repository }}@sha256:%s ' *)"
305+
args="$(printf ' ghcr.io/${{ github.repository }}@sha256:%s ' *)"
306+
args+=" $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON")"
307+
read -r -a args_array <<< "$args"
308+
309+
set -x
310+
docker buildx imagetools create "${args_array[@]}"
303311
304312
- name: Inspect image (GHCR.io)
305313
run: docker buildx imagetools inspect ghcr.io/${{ github.repository }}

0 commit comments

Comments
 (0)