diff --git a/.github/workflows/docker-base.yaml b/.github/workflows/docker-base.yaml index ac40e3b220e70..120cfcdd6651b 100644 --- a/.github/workflows/docker-base.yaml +++ b/.github/workflows/docker-base.yaml @@ -53,12 +53,38 @@ jobs: project: wl5hnrrkns context: base-build-context file: scripts/Dockerfile.base - platforms: - - linux/amd64 - - linux/arm64 - - linux/arm/v7 + platforms: linux/amd64,linux/arm64,linux/arm/v7 pull: true no-cache: true push: true tags: | ghcr.io/coder/coder-base:latest + + - name: Verify that images are pushed properly + run: | + # retry 10 times with a 5 second delay as the images may not be + # available immediately + for i in {1..10}; do + rc=0 + raw_manifests=$(docker buildx imagetools inspect --raw ghcr.io/coder/coder-base:latest) || rc=$? + if [[ "$rc" -eq 0 ]]; then + break + fi + if [[ "$i" -eq 10 ]]; then + echo "Failed to pull manifests after 10 retries" + exit 1 + fi + echo "Failed to pull manifests, retrying in 5 seconds" + sleep 5 + done + + manifests=$( + echo "$raw_manifests" | \ + jq -r '.manifests[].platform | .os + "/" + .architecture + (if .variant then "/" + .variant else "" end)' + ) + + # Verify all 3 platforms are present. + set -euxo pipefail + echo "$manifests" | grep -q linux/amd64 + echo "$manifests" | grep -q linux/arm64 + echo "$manifests" | grep -q linux/arm/v7 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3e5e7b7901ff0..a5da8fa7f6c0b 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -188,16 +188,42 @@ jobs: project: wl5hnrrkns context: base-build-context file: scripts/Dockerfile.base - platforms: - - linux/amd64 - - linux/arm64 - - linux/arm/v7 + platforms: linux/amd64,linux/arm64,linux/arm/v7 pull: true no-cache: true push: true tags: | ${{ steps.image-base-tag.outputs.tag }} + - name: Verify that images are pushed properly + run: | + # retry 10 times with a 5 second delay as the images may not be + # available immediately + for i in {1..10}; do + rc=0 + raw_manifests=$(docker buildx imagetools inspect --raw "${{ steps.image-base-tag.outputs.tag }}") || rc=$? + if [[ "$rc" -eq 0 ]]; then + break + fi + if [[ "$i" -eq 10 ]]; then + echo "Failed to pull manifests after 10 retries" + exit 1 + fi + echo "Failed to pull manifests, retrying in 5 seconds" + sleep 5 + done + + manifests=$( + echo "$raw_manifests" | \ + jq -r '.manifests[].platform | .os + "/" + .architecture + (if .variant then "/" + .variant else "" end)' + ) + + # Verify all 3 platforms are present. + set -euxo pipefail + echo "$manifests" | grep -q linux/amd64 + echo "$manifests" | grep -q linux/arm64 + echo "$manifests" | grep -q linux/arm/v7 + - name: Build Linux Docker images run: | set -euxo pipefail