Skip to content

Add docker_logs to control docker build summaries upload and set #19

Add docker_logs to control docker build summaries upload and set

Add docker_logs to control docker build summaries upload and set #19

name: Get Image Platforms

Check failure on line 1 in .github/workflows/GetContainerPlatforms.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/GetContainerPlatforms.yml

Invalid workflow file

(Line: 41, Col: 7): 'shell' is already defined
on:
workflow_call:
inputs:
image:
description: 'Image name to inspect'
required: true
type: string
outputs:
platforms:
description: 'Comma-separated list of platforms (e.g. linux/amd64,linux/arm64)'
value: ${{ jobs.dm-inspect.outputs.platforms }}
build-matrix:
description: 'JSON list of platforms for matrix usage'
value: ${{ jobs.dm-inspect.outputs.build-matrix }}
jobs:
dm-inspect:
runs-on: ubuntu-latest
outputs:
platforms: ${{ steps.get-platforms.outputs.platforms }}
build-matrix: ${{ steps.get-platforms.outputs.build-matrix }}
steps:
- name: Get Image Platforms
id: get-platforms
shell: bash -o pipefail {0}
run: |
PLATFORMS="$(docker manifest inspect ${{ inputs.image }} | \
jq -r '.manifests[] | "\(.platform.os)/\(.platform.architecture)\(if .platform.variant != null then "/\(.platform.variant)" else "" end)"' | \
sort -u | grep -v unknown | paste -sd ',')"
if [ ! -n "${PLATFORMS}" ]
then
echo "Cannot get list of platforms supported by the ${{ inputs.image }}." >&2
exit 1
fi
BUILD_MATRIX="$(echo ${PLATFORMS} | tr ',' '\n' | jq -R . | jq -s . | tr '\n' ' ')"
echo "platforms=${PLATFORMS}" >> $GITHUB_OUTPUT
echo "build-matrix=${BUILD_MATRIX}" >> $GITHUB_OUTPUT
shell: bash