Skip to content

Commit

Permalink
Add further validations on expected platforms for components specifie…
Browse files Browse the repository at this point in the history
…d in JSON
  • Loading branch information
amansinghoriginal committed Mar 2, 2025
1 parent 5d3c1f4 commit b7dcad1
Showing 1 changed file with 34 additions and 15 deletions.
49 changes: 34 additions & 15 deletions .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,24 +171,43 @@ jobs:
- name: Create and push manifest list
run: |
for component in $(echo '${{ env.QUERY_COMPONENTS }}' | jq -r '.[].name'); do
# Initialize an array to hold the manifests
manifests=()
# Check and handle amd64 manifest with debug output
if docker manifest inspect ghcr.io/drasi-project/$component:${{ inputs.tag }}-amd64 > /dev/null 2>&1; then
echo "Manifest for $component:${{ inputs.tag }}-amd64:"
docker manifest inspect ghcr.io/drasi-project/$component:${{ inputs.tag }}-amd64
manifests+=("ghcr.io/drasi-project/$component:${{ inputs.tag }}-amd64")
else
echo "No amd64 manifest found for $component:${{ inputs.tag }}-amd64"
# Get the expected platforms for the component as stored in JSON
expected_platforms=$(echo '${{ env.QUERY_COMPONENTS }}' | jq -r ".[] | select(.name == \"$component\") | .platforms")
# Does this component need to be built for linux/amd64?
if echo "$expected_platforms" | grep -q "linux/amd64"; then
# Check if the amd64 manifest exists and add it to the array
if docker manifest inspect ghcr.io/drasi-project/$component:${{ inputs.tag }}-amd64 > /dev/null 2>&1; then
echo "Manifest for $component:${{ inputs.tag }}-amd64:"
docker manifest inspect ghcr.io/drasi-project/$component:${{ inputs.tag }}-amd64
manifests+=("ghcr.io/drasi-project/$component:${{ inputs.tag }}-amd64")
# If the amd64 manifest is not found, print an error message
else
echo "Error: Expected amd64 manifest not found for $component:${{ inputs.tag }}-amd64" >&2
exit 1
fi
fi
# Check and handle arm64 manifest with debug output
if docker manifest inspect ghcr.io/drasi-project/$component:${{ inputs.tag }}-arm64 > /dev/null 2>&1; then
echo "Manifest for $component:${{ inputs.tag }}-arm64:"
docker manifest inspect ghcr.io/drasi-project/$component:${{ inputs.tag }}-arm64
manifests+=("ghcr.io/drasi-project/$component:${{ inputs.tag }}-arm64")
else
echo "No arm64 manifest found for $component:${{ inputs.tag }}-arm64"
# Does this component need to be built for linux/arm64?
if echo "$expected_platforms" | grep -q "linux/arm64"; then
# Check and handle arm64 manifest with debug output
if docker manifest inspect ghcr.io/drasi-project/$component:${{ inputs.tag }}-arm64 > /dev/null 2>&1; then
echo "Manifest for $component:${{ inputs.tag }}-arm64:"
docker manifest inspect ghcr.io/drasi-project/$component:${{ inputs.tag }}-arm64
manifests+=("ghcr.io/drasi-project/$component:${{ inputs.tag }}-arm64")
# If the arm64 manifest is not found, print an error message
else
echo "Error: Expected arm64 manifest found for $component:${{ inputs.tag }}-arm64" >&2
exit 1
fi
fi
# Create the manifest list if there are manifests to combine
Expand Down

0 comments on commit b7dcad1

Please sign in to comment.