Skip to content

Commit 9d065a2

Browse files
authored
feat: deploy multi-arch images (#1755)
1 parent d88dda1 commit 9d065a2

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

.github/workflows/multiarch.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Deploy multi-arch images
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "30 5 * * *" # every day, at 5:30
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
10+
cancel-in-progress: false
11+
12+
jobs:
13+
deploy:
14+
name: Deploy multi-arch images
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Install ORAS
19+
run: sudo snap install oras --classic
20+
- name: Deploy
21+
if: github.repository == 'pypa/manylinux'
22+
run: ./deploy_multiarch.sh
23+
env:
24+
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
25+
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}

deploy_multiarch.sh

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
IMAGES=(manylinux2014 manylinux_2_28 manylinux_2_31 manylinux_2_34 musllinux_1_2)
6+
7+
podman login -u "${QUAY_USERNAME}" -p "${QUAY_PASSWORD}" quay.io
8+
9+
for IMAGE in "${IMAGES[@]}"; do
10+
echo "::group::${IMAGE}"
11+
LAST_TAG="$(oras repo tags --last "2025.02.23-1" "quay.io/pypa/${IMAGE}" | tail -2 | head -1)"
12+
if [ "${LAST_TAG}" == "" ]; then
13+
LAST_TAG=2025.02.23-1
14+
fi
15+
echo "${IMAGE}: last tag is ${LAST_TAG}"
16+
case ${IMAGE} in
17+
manylinux_2_31) REF_IMAGE=manylinux_2_31_armv7l;;
18+
*) REF_IMAGE=${IMAGE}_x86_64;;
19+
esac
20+
TAGS_TO_PUSH=()
21+
while IFS='' read -r LINE; do
22+
TAGS_TO_PUSH+=("$LINE");
23+
done < <(oras repo tags --last "${LAST_TAG}" "quay.io/pypa/${REF_IMAGE}" | grep -v "^20[0-9][0-9]-" | grep -v "latest")
24+
if [ ${#TAGS_TO_PUSH[@]} -eq 0 ]; then
25+
echo "${IMAGE}: up-to-date"
26+
echo "::endgroup::"
27+
continue
28+
fi
29+
30+
echo "${IMAGE}: adding tags ${TAGS_TO_PUSH[*]}"
31+
case ${IMAGE} in
32+
manylinux_2_31) ARCHS=("armv7l");;
33+
manylinux2014) ARCHS=("x86_64" "i686" "aarch64" "ppc64le" "s390x");;
34+
musllinux_1_2) ARCHS=("x86_64" "i686" "aarch64" "armv7l" "ppc64le" "s390x");;
35+
*) ARCHS=("x86_64" "aarch64" "ppc64le" "s390x");;
36+
esac
37+
38+
LATEST_MANIFEST=
39+
for TAG_TO_PUSH in "${TAGS_TO_PUSH[@]}"; do
40+
echo "::group::${TAG_TO_PUSH}"
41+
SRC_IMAGES=()
42+
for ARCH in "${ARCHS[@]}"; do
43+
SRC_IMAGES+=("docker://quay.io/pypa/${IMAGE}_${ARCH}:${TAG_TO_PUSH}")
44+
done
45+
MANIFEST="${IMAGE}:${TAG_TO_PUSH}"
46+
if ! podman manifest create "${MANIFEST}" "${SRC_IMAGES[@]}"; then
47+
echo "::error ::failed to create '${MANIFEST}' manifest using ${SRC_IMAGES[*]}"
48+
else
49+
if ! podman manifest push --all "${MANIFEST}" "docker://quay.io/pypa/${IMAGE}:${TAG_TO_PUSH}"; then
50+
echo "::error ::failed to push 'quay.io/pypa/${IMAGE}:${TAG_TO_PUSH}' using '${MANIFEST}'"
51+
else
52+
LATEST_MANIFEST="${MANIFEST}"
53+
fi
54+
fi
55+
echo "::endgroup::"
56+
done
57+
if [ "${LATEST_MANIFEST}" == "" ]; then
58+
echo "::warning ::${IMAGE}: skipping latest due to previous errors"
59+
else
60+
if ! podman manifest push --all "${LATEST_MANIFEST}" "docker://quay.io/pypa/${IMAGE}:latest"; then
61+
echo "::error ::failed to push 'quay.io/pypa/${IMAGE}:latest' using '${LATEST_MANIFEST}'"
62+
fi
63+
fi
64+
echo "::endgroup::"
65+
done

0 commit comments

Comments
 (0)