Skip to content

Commit 5ad2e9f

Browse files
committed
Make sure to fail if the list of platforms cannot be determined.
1 parent 17ddb08 commit 5ad2e9f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

.github/workflows/GetContainerPlatforms.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,16 @@ jobs:
2525
steps:
2626
- name: Get Image Platforms
2727
id: get-platforms
28+
shell: bash -o pipefail {0}
2829
run: |
2930
PLATFORMS="$(docker manifest inspect ${{ inputs.image }} | \
3031
jq -r '.manifests[] | "\(.platform.os)/\(.platform.architecture)\(if .platform.variant != null then "/\(.platform.variant)" else "" end)"' | \
3132
sort -u | grep -v unknown | paste -sd ',')"
33+
if [ ! -n "${PLATFORMS}" ]
34+
then
35+
echo "Cannot get list of platforms supported by the ${{ inputs.image }}." >&2
36+
exit 1
37+
fi
3238
BUILD_MATRIX="$(echo ${PLATFORMS} | tr ',' '\n' | jq -R . | jq -s . | tr '\n' ' ')"
3339
echo "platforms=${PLATFORMS}" >> $GITHUB_OUTPUT
3440
echo "build-matrix=${BUILD_MATRIX}" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)