--- name: Rebuild released container images on updated base images # Rebuilds the container images of an already released version from its release tag, so they pick up # base image security fixes without a new Fluent Bit release, then refreshes the wiki status page. # Packages are not rebuilt. on: workflow_dispatch: inputs: version: description: Released version to rebuild, without the v prefix. Leave empty for the newest release. type: string required: false default: "" mode: description: >- if-needed rebuilds only when the published images have fixable critical or high findings, always forces a rebuild, report-only just refreshes the wiki pages. type: choice options: - if-needed - always - report-only default: if-needed promote: description: Publish the rebuilt images to Docker Hub and GHCR. Disable to stop after staging and tests. type: boolean default: true update-wiki: description: Push the regenerated image index and status pages to the repository wiki. type: boolean default: true # An omitted version can resolve to the same release as an explicit version. concurrency: group: release-rebuild-images cancel-in-progress: false permissions: contents: read env: STAGING_IMAGE_NAME: ghcr.io/${{ github.repository }}/staging GHCR_RELEASE_IMAGE_NAME: ghcr.io/${{ github.repository }} WIKI_INDEX_PAGE: Container-Images WIKI_STATUS_PAGE: Container-Image-Security-Status jobs: rebuild-plan: name: Resolve the release and tags to rebuild runs-on: ubuntu-latest permissions: contents: read outputs: version: ${{ steps.plan.outputs.version }} ref: ${{ steps.plan.outputs.ref }} build: ${{ steps.plan.outputs.build }} preserve: ${{ steps.plan.outputs.preserve }} tags: ${{ steps.plan.outputs.tags }} windows-images: ${{ steps.plan.outputs.windows-images }} windows-tags: ${{ steps.plan.outputs.windows-tags }} report-tags: ${{ steps.plan.outputs.report-tags }} steps: - name: Checkout release tooling uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 # The published tags decide which images exist for the release, so nothing new is published. - name: Resolve the plan from the release and registry tags id: plan run: | git ls-remote --tags "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git" 'v*' > release-tags.txt docker run --rm quay.io/skopeo/stable:latest list-tags --retry-times 10 \ "docker://$GHCR_RELEASE_IMAGE_NAME" > registry-tags.json # The build date of the published image names the original build when it is preserved. RESOLVED=$(python3 .github/scripts/release_image_rebuild.py resolve \ --version "$VERSION" --tags-file release-tags.txt) docker run --rm quay.io/skopeo/stable:latest inspect --retry-times 10 \ "docker://$GHCR_RELEASE_IMAGE_NAME:$RESOLVED" > original.json || rm -f original.json python3 .github/scripts/release_image_rebuild.py plan \ --version "$RESOLVED" --tags-file release-tags.txt --registry-tags registry-tags.json \ --original-inspect original.json --date "$(date -u +%Y%m%d)" env: VERSION: ${{ inputs.version }} shell: bash rebuild-scan-published: name: Scan the published images if: inputs.mode != 'report-only' needs: rebuild-plan runs-on: ubuntu-latest permissions: contents: read packages: read outputs: rebuild: ${{ steps.decide.outputs.rebuild }} steps: - name: Checkout release tooling uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Log in to the Container registry uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Create the scan directory run: mkdir -p scans shell: bash - name: Trivy - published production image uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 with: image-ref: "${{ env.GHCR_RELEASE_IMAGE_NAME }}:${{ needs.rebuild-plan.outputs.version }}" format: "json" output: "scans/production.json" exit-code: "0" vuln-type: "os,library" severity: "CRITICAL,HIGH" - name: Trivy - published debug image uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 with: image-ref: "${{ env.GHCR_RELEASE_IMAGE_NAME }}:${{ needs.rebuild-plan.outputs.version }}-debug" format: "json" output: "scans/debug.json" exit-code: "0" vuln-type: "os,library" severity: "CRITICAL,HIGH" - name: Decide whether a rebuild is needed id: decide run: | python3 .github/scripts/release_image_rebuild.py decide-rebuild --mode "$MODE" \ scans/production.json scans/debug.json | tee -a "$GITHUB_STEP_SUMMARY" env: MODE: ${{ inputs.mode }} shell: bash - name: Keep the scans to compare against the rebuild uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: rebuild-scan-published path: scans/ if-no-files-found: error retention-days: 7 rebuild-build: name: Rebuild the images into staging if: needs.rebuild-scan-published.outputs.rebuild == 'true' needs: - rebuild-plan - rebuild-scan-published permissions: contents: read packages: write id-token: write uses: ./.github/workflows/call-build-images.yaml with: version: ${{ needs.rebuild-plan.outputs.version }} ref: ${{ needs.rebuild-plan.outputs.ref }} registry: ghcr.io username: ${{ github.actor }} image: ${{ github.repository }}/staging environment: staging refresh-base-images: true windows-images: ${{ needs.rebuild-plan.outputs.windows-images }} # The rebuild is compared against the published images below instead of failing here. scan-exit-code: "0" secrets: token: ${{ secrets.GITHUB_TOKEN }} cosign_private_key: ${{ secrets.COSIGN_PRIVATE_KEY }} cosign_private_key_password: ${{ secrets.COSIGN_PASSWORD }} rebuild-test: name: Test the rebuilt images needs: - rebuild-plan - rebuild-build permissions: contents: read packages: read uses: ./.github/workflows/call-test-images.yaml with: registry: ghcr.io username: ${{ github.actor }} image: ${{ github.repository }}/staging image-tag: ${{ needs.rebuild-plan.outputs.version }} environment: staging secrets: token: ${{ secrets.GITHUB_TOKEN }} cosign_key: ${{ secrets.COSIGN_PUBLIC_KEY }} rebuild-verify: name: Compare the rebuilt images with the published ones needs: - rebuild-plan - rebuild-scan-published - rebuild-build - rebuild-test runs-on: ubuntu-latest permissions: contents: read packages: read outputs: promote: ${{ steps.decide.outputs.promote }} digest: ${{ steps.image.outputs.digest }} debug-digest: ${{ steps.image.outputs.debug-digest }} steps: - name: Checkout release tooling uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@594f3bf4285d9ea8dc53c9a0c9c4092420091003 # v4.4.0 - name: Log in to the Container registry uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} # The single architecture builds may fail individually, so never publish a partial manifest. - name: Resolve immutable rebuilt images id: image run: | for SUFFIX in "" "-debug"; do REF="$STAGING_IMAGE_NAME:$VERSION$SUFFIX" PLATFORMS=$(docker buildx imagetools inspect "$REF" --raw | jq -r '[.manifests[]?.platform | select(.os == "linux") | .architecture] | sort | join(",")') if [[ "$PLATFORMS" != "amd64,arm,arm64" ]]; then echo "::error::$REF does not provide every platform: $PLATFORMS" exit 1 fi DIGEST=$(docker buildx imagetools inspect "$REF" --format '{{.Manifest.Digest}}') echo "${SUFFIX:+debug-}digest=$DIGEST" >> "$GITHUB_OUTPUT" done env: VERSION: ${{ needs.rebuild-plan.outputs.version }} shell: bash - name: Create the scan directory run: mkdir -p rebuilt shell: bash - name: Trivy - rebuilt production image uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 with: image-ref: "${{ env.STAGING_IMAGE_NAME }}@${{ steps.image.outputs.digest }}" format: "json" output: "rebuilt/production.json" exit-code: "0" vuln-type: "os,library" severity: "CRITICAL,HIGH" - name: Trivy - rebuilt debug image uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 with: image-ref: "${{ env.STAGING_IMAGE_NAME }}@${{ steps.image.outputs.debug-digest }}" format: "json" output: "rebuilt/debug.json" exit-code: "0" vuln-type: "os,library" severity: "CRITICAL,HIGH" - name: Download the scans of the published images uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: name: rebuild-scan-published path: published - name: Decide whether the rebuild is published id: decide run: | python3 .github/scripts/release_image_rebuild.py decide-promote --mode "$MODE" \ --before published/production.json published/debug.json \ --after rebuilt/production.json rebuilt/debug.json | tee -a "$GITHUB_STEP_SUMMARY" env: MODE: ${{ inputs.mode }} shell: bash # A registry cannot tell what a tag used to point to. Before the version tags move for the first # time, give every image of the original release a dated tag so it stays listed and pullable. # This only adds tags inside each registry, which also works for the Windows images. A dated tag # that already exists is never written again, so a run that stopped half way is completed by the # next one, registry by registry and image by image. rebuild-release-preserve-original: name: Keep the original release under a dated tag if: inputs.promote && needs.rebuild-verify.outputs.promote == 'true' needs: - rebuild-plan - rebuild-verify runs-on: ubuntu-latest environment: release permissions: packages: write steps: # A retry can reuse the build id from an earlier planning attempt. If another run already # published that id while this run was stopped, stop here before any publishing job runs. - name: Check the build id is still free run: | docker run --rm quay.io/skopeo/stable:latest list-tags --retry-times 10 \ --creds "$GHCR_CREDS" "docker://$GHCR_RELEASE_IMAGE_NAME" > published-tags.json if jq -e --arg tag "$VERSION-$BUILD" '.Tags | index($tag)' published-tags.json > /dev/null; then echo "::error::$VERSION-$BUILD was published by another run after this one was planned. Start a new run." exit 1 fi env: VERSION: ${{ needs.rebuild-plan.outputs.version }} BUILD: ${{ needs.rebuild-plan.outputs.build }} GHCR_CREDS: ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }} shell: bash - name: Tag the original images run: | keep() { # Failing to list the tags fails the job: guessing could overwrite a kept build. docker run --rm quay.io/skopeo/stable:latest list-tags --retry-times 10 \ --creds "$2" "docker://$1" > existing-tags.json jq -r '.[] | "\(.from) \(.to)"' <<< "$PRESERVE" | while read -r FROM TO; do if jq -e --arg tag "$TO" '.Tags | index($tag)' existing-tags.json > /dev/null; then echo "$1:$TO is already kept" continue fi echo "Keeping $1:$FROM as $1:$TO" docker run --rm quay.io/skopeo/stable:latest copy --all --preserve-digests \ --retry-times 10 --src-creds "$2" --dest-creds "$2" \ "docker://$1:$FROM" "docker://$1:$TO" < /dev/null done } keep "$GHCR_RELEASE_IMAGE_NAME" "$GHCR_CREDS" keep "$DH_RELEASE_IMAGE_NAME" "$DH_CREDS" env: PRESERVE: ${{ needs.rebuild-plan.outputs.preserve }} DH_RELEASE_IMAGE_NAME: docker.io/${{ secrets.DOCKERHUB_ORGANIZATION }} DH_CREDS: ${{ secrets.DOCKERHUB_USERNAME }}:${{ secrets.DOCKERHUB_TOKEN }} GHCR_CREDS: ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }} shell: bash # Same promotion as staging-release: copy the verified manifests by digest, never by tag. rebuild-release-images: name: Release ${{ matrix.tag }} Linux container images if: inputs.promote && needs.rebuild-verify.outputs.promote == 'true' needs: - rebuild-plan - rebuild-verify - rebuild-release-preserve-original runs-on: ubuntu-latest environment: release env: SOURCE_DIGEST: ${{ endsWith(matrix.tag, '-debug') && needs.rebuild-verify.outputs.debug-digest || needs.rebuild-verify.outputs.digest }} strategy: fail-fast: false matrix: tag: ${{ fromJSON(needs.rebuild-plan.outputs.tags) }} permissions: packages: write steps: # Primarily because the skopeo errors are hard to parse and non-obvious - name: Check the image exists run: | docker pull "$STAGING_IMAGE_NAME@$SOURCE_DIGEST" shell: bash - name: Promote container images from staging to Dockerhub run: | docker run --rm \ quay.io/skopeo/stable:latest \ copy \ --all \ --retry-times 10 \ --src-no-creds \ --dest-creds "$RELEASE_CREDS" \ "docker://$STAGING_IMAGE_NAME@$SOURCE_DIGEST" \ "docker://$RELEASE_IMAGE_NAME:$TAG" env: RELEASE_IMAGE_NAME: docker.io/${{ secrets.DOCKERHUB_ORGANIZATION }} RELEASE_CREDS: ${{ secrets.DOCKERHUB_USERNAME }}:${{ secrets.DOCKERHUB_TOKEN }} TAG: ${{ matrix.tag }} shell: bash - name: Promote container images from staging to GHCR.io run: | docker run --rm \ quay.io/skopeo/stable:latest \ copy \ --all \ --retry-times 10 \ --src-no-creds \ --dest-creds "$RELEASE_CREDS" \ "docker://$STAGING_IMAGE_NAME@$SOURCE_DIGEST" \ "docker://$GHCR_RELEASE_IMAGE_NAME:$TAG" env: RELEASE_CREDS: ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }} TAG: ${{ matrix.tag }} shell: bash rebuild-release-images-arch-specific-legacy-tags: name: Release ${{ matrix.arch }} legacy format Linux container images runs-on: ubuntu-latest needs: - rebuild-plan - rebuild-release-images environment: release strategy: fail-fast: false matrix: arch: - amd64 - arm64 - arm/v7 permissions: packages: write env: RELEASE_IMAGE_NAME: ${{ secrets.DOCKERHUB_ORGANIZATION }} RELEASE_TAG: ${{ needs.rebuild-plan.outputs.version }} steps: - name: Login to Docker Hub uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Login to GitHub Container Registry uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Convert arch to tag id: get-tag run: | TAG="${RELEASE_TAG}-${{ matrix.arch }}" TAG=${TAG/\//-} echo "Using tag: $TAG" echo "tag=$TAG" >> "$GITHUB_OUTPUT" shell: bash - name: Pull release image run: docker pull --platform='linux/${{ matrix.arch }}' "$RELEASE_IMAGE_NAME:$RELEASE_TAG" shell: bash - name: Tag and push legacy format image to DockerHub run: | docker tag "$RELEASE_IMAGE_NAME:$RELEASE_TAG" docker.io/"$RELEASE_IMAGE_NAME:$TAG" docker push docker.io/"$RELEASE_IMAGE_NAME:$TAG" shell: bash env: TAG: ${{ steps.get-tag.outputs.tag }} - name: Tag and push legacy format image to Github Container Registry run: | docker tag "$RELEASE_IMAGE_NAME:$RELEASE_TAG" "$GHCR_RELEASE_IMAGE_NAME:$TAG" docker push "$GHCR_RELEASE_IMAGE_NAME:$TAG" shell: bash env: TAG: ${{ steps.get-tag.outputs.tag }} rebuild-release-images-windows: name: Release Windows images # Cannot be done by Skopeo on a Linux runner unfortunately runs-on: ${{ startsWith(matrix.tag, 'windows-2022-') && 'windows-latest' || 'windows-2025' }} if: inputs.promote && needs.rebuild-verify.outputs.promote == 'true' && needs.rebuild-plan.outputs.windows-tags != '[]' needs: - rebuild-plan - rebuild-verify - rebuild-release-preserve-original environment: release permissions: packages: write strategy: fail-fast: false matrix: tag: ${{ fromJSON(needs.rebuild-plan.outputs.windows-tags) }} steps: - name: Login to GitHub Container Registry uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Check the image exists # Use manifest inspect rather than pulling the image so the Windows host version does not need to match the container image run: | docker manifest inspect "$STAGING_IMAGE_NAME:$TAG" env: TAG: ${{ matrix.tag }} shell: bash - name: Promote container images from staging to GHCR.io run: | docker pull "$STAGING_IMAGE_NAME:$TAG" for NAME in "$TAG" "$TAG-$BUILD"; do docker tag "$STAGING_IMAGE_NAME:$TAG" "$GHCR_RELEASE_IMAGE_NAME:$NAME" docker push "$GHCR_RELEASE_IMAGE_NAME:$NAME" done env: TAG: ${{ matrix.tag }} BUILD: ${{ needs.rebuild-plan.outputs.build }} shell: bash - name: Login to Docker Hub uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Promote container images from staging to Dockerhub run: | for NAME in "$TAG" "$TAG-$BUILD"; do docker tag "$STAGING_IMAGE_NAME:$TAG" "$RELEASE_IMAGE_NAME:$NAME" docker push "$RELEASE_IMAGE_NAME:$NAME" done env: RELEASE_IMAGE_NAME: docker.io/${{ secrets.DOCKERHUB_ORGANIZATION }} TAG: ${{ matrix.tag }} BUILD: ${{ needs.rebuild-plan.outputs.build }} shell: bash rebuild-release-images-sign: name: Sign container image manifests permissions: contents: read packages: write # This is used to complete the identity challenge with sigstore/fulcio. id-token: write runs-on: ubuntu-latest environment: release needs: - rebuild-plan - rebuild-release-images env: DH_RELEASE_IMAGE_NAME: docker.io/${{ secrets.DOCKERHUB_ORGANIZATION }} VERSION: ${{ needs.rebuild-plan.outputs.version }} steps: - name: Install cosign uses: sigstore/cosign-installer@756fe2d284c7292c4e9b62c8a28f1e5629c59532 # v4.1.3 - name: Login to Docker Hub uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Login to GitHub Container Registry uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Cosign with a key # Only run if we have a key defined if: ${{ env.COSIGN_PRIVATE_KEY }} # The key needs to cope with newlines run: | echo -e "${COSIGN_PRIVATE_KEY}" > /tmp/my_cosign.key cosign sign --key /tmp/my_cosign.key --recursive --yes \ -a "repo=${{ github.repository }}" \ -a "workflow=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \ -a "release=$VERSION" \ "$GHCR_RELEASE_IMAGE_NAME:$VERSION" \ "$GHCR_RELEASE_IMAGE_NAME:$VERSION-debug" \ "$DH_RELEASE_IMAGE_NAME:$VERSION" \ "$DH_RELEASE_IMAGE_NAME:$VERSION-debug" rm -f /tmp/my_cosign.key shell: bash env: COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }} COSIGN_PASSWORD: ${{ secrets.COSIGN_PRIVATE_KEY_PASSWORD }} # optional - name: Cosign keyless signing using Rektor public transparency log run: | cosign sign --yes --recursive \ -a "repo=${{ github.repository }}" \ -a "workflow=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \ -a "release=$VERSION" \ "$GHCR_RELEASE_IMAGE_NAME:$VERSION" \ "$GHCR_RELEASE_IMAGE_NAME:$VERSION-debug" \ "$DH_RELEASE_IMAGE_NAME:$VERSION" \ "$DH_RELEASE_IMAGE_NAME:$VERSION-debug" shell: bash env: COSIGN_EXPERIMENTAL: true rebuild-release-smoke-test-containers: name: Run container smoke tests on the published images permissions: contents: read packages: read runs-on: ubuntu-latest environment: release needs: - rebuild-plan - rebuild-release-images steps: - name: Checkout code uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Test containers run: | ./packaging/testing/smoke/container/container-smoke-test.sh shell: bash env: IMAGE_TAG: ${{ needs.rebuild-plan.outputs.version }} # The report reflects what the registry serves, so it also runs when nothing was rebuilt or a # publishing job failed. rebuild-report-scan: name: Scan ${{ matrix.tag }} for the status page if: ${{ !cancelled() && needs.rebuild-plan.result == 'success' }} needs: - rebuild-plan - rebuild-release-preserve-original - rebuild-release-images - rebuild-release-images-arch-specific-legacy-tags - rebuild-release-images-windows - rebuild-release-images-sign - rebuild-release-smoke-test-containers runs-on: ubuntu-latest permissions: contents: read packages: read strategy: fail-fast: false matrix: tag: ${{ fromJSON(needs.rebuild-plan.outputs.report-tags) }} steps: - name: Log in to the Container registry uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Create the scan directory run: mkdir -p scans shell: bash # A release without published images is reported as unavailable instead of failing the page. - name: Trivy - published image continue-on-error: true uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 with: image-ref: "${{ env.GHCR_RELEASE_IMAGE_NAME }}:${{ matrix.tag }}" format: "json" output: "scans/trivy-${{ matrix.tag }}.json" exit-code: "0" vuln-type: "os,library" severity: "CRITICAL,HIGH" - name: Inspect the published image continue-on-error: true run: | docker run --rm quay.io/skopeo/stable:latest inspect --retry-times 10 \ "docker://$GHCR_RELEASE_IMAGE_NAME:$TAG" > "scans/inspect-$TAG.json" env: TAG: ${{ matrix.tag }} shell: bash - name: Upload the scan uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: rebuild-report-scan-${{ matrix.tag }} path: scans/ if-no-files-found: warn retention-days: 7 rebuild-report-publish: name: Publish the image index and status pages if: ${{ !cancelled() && needs.rebuild-plan.result == 'success' }} needs: - rebuild-plan - rebuild-report-scan runs-on: ubuntu-latest permissions: # Required to push to the repository wiki contents: write steps: - name: Checkout release tooling uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Download the scans uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: pattern: rebuild-report-scan-* path: scans merge-multiple: true # Both pages are regenerated from what the registry serves, so no state is kept between runs. - name: Inspect every build listed in the index run: | mkdir -p scans git ls-remote --tags "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git" 'v*' > release-tags.txt docker run --rm quay.io/skopeo/stable:latest list-tags --retry-times 10 \ "docker://$GHCR_RELEASE_IMAGE_NAME" > scans/registry-tags.json python3 .github/scripts/release_image_rebuild.py index-tags \ --tags-file release-tags.txt --registry-tags scans/registry-tags.json > index-tags.txt while read -r TAG; do # A tag that cannot be inspected is listed as unavailable instead of failing the page. docker run --rm quay.io/skopeo/stable:latest inspect --retry-times 10 \ "docker://$GHCR_RELEASE_IMAGE_NAME:$TAG" > "scans/inspect-$TAG.json" < /dev/null || rm -f "scans/inspect-$TAG.json" done < index-tags.txt shell: bash - name: Render the pages run: | python3 .github/scripts/release_image_rebuild.py index \ --tags-file release-tags.txt --registry-tags scans/registry-tags.json --scan-dir scans \ --image "${GITHUB_REPOSITORY}" --image "$GHCR_RELEASE_IMAGE_NAME" \ --run-url "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \ --output "$WIKI_INDEX_PAGE.md" # shellcheck disable=SC2046 python3 .github/scripts/release_image_rebuild.py report \ --tags $(jq -r 'join(" ")' <<< "$REPORT_TAGS") \ --scan-dir scans --registry-tags scans/registry-tags.json \ --image "docker.io/${GITHUB_REPOSITORY}" --image "$GHCR_RELEASE_IMAGE_NAME" \ --run-url "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \ --output "$WIKI_STATUS_PAGE.md" cat "$WIKI_INDEX_PAGE.md" "$WIKI_STATUS_PAGE.md" >> "$GITHUB_STEP_SUMMARY" env: REPORT_TAGS: ${{ needs.rebuild-plan.outputs.report-tags }} shell: bash - name: Upload the pages uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: container-image-pages path: | ${{ env.WIKI_INDEX_PAGE }}.md ${{ env.WIKI_STATUS_PAGE }}.md if-no-files-found: error - name: Push the pages to the wiki if: inputs.update-wiki run: | git clone --depth 1 "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.wiki.git" wiki cp "$WIKI_INDEX_PAGE.md" "$WIKI_STATUS_PAGE.md" wiki/ cd wiki git add "$WIKI_INDEX_PAGE.md" "$WIKI_STATUS_PAGE.md" if git diff --cached --quiet; then echo "The pages are unchanged" exit 0 fi git config user.name 'github-actions[bot]' git config user.email '41898282+github-actions[bot]@users.noreply.github.com' git commit --quiet -m "Update container image index and security status" # Rebuilds of other versions may publish at the same time. for ATTEMPT in 1 2 3 4 5; do if git push; then exit 0 fi git pull --rebase done echo "::error::Unable to push the pages to the wiki" exit 1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} shell: bash