Use docker buildx to ensure images for multi platforms are saved #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: OpenShift Certification | ||
Check failure on line 1 in .github/workflows/openshift-certification.yml
|
||
on: | ||
workflow_call: | ||
inputs: | ||
runner: | ||
required: false | ||
type: string | ||
default: 'ubuntu-24.04' | ||
image: | ||
required: true | ||
type: string | ||
platform: | ||
required: true | ||
type: string | ||
defaults: | ||
run: | ||
shell: bash | ||
permissions: | ||
contents: read | ||
jobs: | ||
preflight: | ||
runs-on: ${{ inputs.runner }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Download preflight binary | ||
run: | | ||
curl -LO https://github.com/redhat-openshift-ecosystem/openshift-preflight/releases/latest/download/preflight-linux-amd64 | ||
chmod +x preflight-linux-amd64 | ||
sudo mv preflight-linux-amd64 /usr/local/bin/preflight | ||
- name: Download image artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ inputs.image }}-images # or ${{ inputs.image }}-linux-${{ inputs.platform | tr '/' '-' }} | ||
- name: Load image into Docker | ||
run: docker load -i ${{ inputs.image }}-${{ inputs.platform | tr '/' '-' }}.tar | ||
- name: Retag image for preflight | ||
run: | | ||
loaded_tag="ghcr.io/${{ github.repository_owner }}/nginx-gateway-fabric/${{ inputs.image }}:${{ inputs.image_version }}" | ||
preflight_tag="${{ inputs.image }}:ubi" | ||
docker tag "$loaded_tag" "$preflight_tag" | ||
- name: Run preflight | ||
env: | ||
PYXIS_API_TOKEN: ${{ secrets.PYXIS_API_TOKEN }} | ||
run: preflight check container ${{ inputs.image }}:ubi > preflight-result.json | ||
- name: Check preflight results | ||
run: | | ||
failed_count=$(jq '.results.failed | length' preflight-result.json) | ||
if [ "$failed_count" -ne 0 ]; then | ||
echo "Preflight checks failed: $failed_count failed checks" | ||
echo "Results for preflight-result.json:" | ||
jq '.results.failed' preflight-result.json | ||
exit 1 | ||
fi |