Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/build-test-package-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,48 @@ jobs:
large-packages: "false" # Takes too long to remove apt-get packages
mandb: "true" # Speeds up future apt-get installs (disables man page generation), this CI does not use apt-get

- name: 'Pre-pull dockcross image'
run: |
# Resolve the image tag dynamically from the ITKPythonPackage build scripts
# so it matches exactly what the build step will pull.
IPP_TAG=${{ inputs.itk-python-package-tag }}
IPP_TAG=${IPP_TAG:=main}
IPP_ORG=${{ inputs.itk-python-package-org }}
IPP_ORG=${IPP_ORG:=InsightSoftwareConsortium}

MANYLINUX_PLATFORM=${{ matrix.manylinux-platform }}
export MANYLINUX_VERSION=$(echo ${MANYLINUX_PLATFORM} | cut -d '-' -f 1)
export TARGET_ARCH=$(echo ${MANYLINUX_PLATFORM} | cut -d '-' -f 2)

VARS_URL="https://raw.githubusercontent.com/${IPP_ORG}/ITKPythonPackage/${IPP_TAG}/scripts/dockcross-manylinux-set-vars.sh"
echo "Fetching image tags from ${VARS_URL}"
curl -fsSL "${VARS_URL}" -o /tmp/set-vars.sh || { echo "Could not fetch set-vars.sh, skipping pre-pull"; exit 0; }
source /tmp/set-vars.sh

if [[ -z ${CONTAINER_SOURCE} ]]; then
echo "Could not determine container source, skipping pre-pull"
exit 0
fi

# Build the GHCR mirror name
GHCR_IMAGE="ghcr.io/insightsoftwareconsortium/dockcross-manylinux${MANYLINUX_VERSION}-${TARGET_ARCH}:${IMAGE_TAG}"
echo "Pre-pulling ${GHCR_IMAGE} (mirror of ${CONTAINER_SOURCE})"
for attempt in 1 2 3; do
if docker pull "${GHCR_IMAGE}" 2>/dev/null; then
docker tag "${GHCR_IMAGE}" "${CONTAINER_SOURCE}"
echo "Successfully pulled from GHCR mirror"
exit 0
fi
echo "GHCR pull attempt ${attempt} failed, trying upstream ${CONTAINER_SOURCE}..."
if docker pull "${CONTAINER_SOURCE}"; then
echo "Successfully pulled from upstream"
exit 0
fi
echo "Upstream pull attempt ${attempt} failed, retrying in 15s..."
sleep 15
done
echo "WARNING: All pull attempts failed, build script will retry"

- name: 'Fetch build script'
run: |
IPP_DOWNLOAD_GIT_TAG=${{ inputs.itk-python-package-tag }}
Expand Down Expand Up @@ -180,6 +222,45 @@ jobs:
large-packages: "false" # Takes too long to remove apt-get packages
mandb: "true" # Speeds up future apt-get installs (disables man page generation), this CI does not use apt-get

- name: 'Pre-pull manylinux aarch64 image'
run: |
# Resolve the image tag dynamically from the ITKPythonPackage build scripts
IPP_TAG=${{ inputs.itk-python-package-tag }}
IPP_TAG=${IPP_TAG:=main}
IPP_ORG=${{ inputs.itk-python-package-org }}
IPP_ORG=${IPP_ORG:=InsightSoftwareConsortium}

export MANYLINUX_VERSION="_2_28"
export TARGET_ARCH="aarch64"

VARS_URL="https://raw.githubusercontent.com/${IPP_ORG}/ITKPythonPackage/${IPP_TAG}/scripts/dockcross-manylinux-set-vars.sh"
echo "Fetching image tags from ${VARS_URL}"
curl -fsSL "${VARS_URL}" -o /tmp/set-vars.sh || { echo "Could not fetch set-vars.sh, skipping pre-pull"; exit 0; }
source /tmp/set-vars.sh

if [[ -z ${CONTAINER_SOURCE} ]]; then
echo "Could not determine container source, skipping pre-pull"
exit 0
fi

GHCR_IMAGE="ghcr.io/insightsoftwareconsortium/dockcross-manylinux_2_28-aarch64:${IMAGE_TAG}"
echo "Pre-pulling ${GHCR_IMAGE} (mirror of ${CONTAINER_SOURCE})"
for attempt in 1 2 3; do
if docker pull "${GHCR_IMAGE}" 2>/dev/null; then
docker tag "${GHCR_IMAGE}" "${CONTAINER_SOURCE}"
echo "Successfully pulled from GHCR mirror"
exit 0
fi
echo "GHCR pull attempt ${attempt} failed, trying upstream..."
if docker pull "${CONTAINER_SOURCE}"; then
echo "Successfully pulled from upstream"
exit 0
fi
echo "Upstream pull attempt ${attempt} failed, retrying in 15s..."
sleep 15
done
echo "WARNING: All pull attempts failed, build script will retry"

- name: 'Fetch build script'
run: |
IPP_DOWNLOAD_GIT_TAG=${{ inputs.itk-python-package-tag }}
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/mirror-dockcross-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Mirror dockcross images to GHCR

on:
schedule:
# Run weekly on Monday at 06:00 UTC
- cron: '0 6 * * 1'
workflow_dispatch:

env:
GHCR_ORG: ghcr.io/insightsoftwareconsortium

jobs:
mirror:
runs-on: ubuntu-22.04
permissions:
packages: write
strategy:
matrix:
include:
# v5.4.x image tags
- source: docker.io/dockcross/manylinux_2_28-x64:20240304-9e57d2b
target: dockcross-manylinux_2_28-x64:20240304-9e57d2b
- source: docker.io/dockcross/manylinux2014-x64:20240304-9e57d2b
target: dockcross-manylinux2014-x64:20240304-9e57d2b
- source: quay.io/pypa/manylinux_2_28_aarch64:2024-03-25-9206bd9
target: dockcross-manylinux_2_28-aarch64:2024-03-25-9206bd9
# v6.0b01 image tags
- source: docker.io/dockcross/manylinux_2_28-x64:20250913-6ea98ba
target: dockcross-manylinux_2_28-x64:20250913-6ea98ba
# v6.0b02 / main image tags
- source: docker.io/dockcross/manylinux_2_28-x64:20260203-3dfb3ff
target: dockcross-manylinux_2_28-x64:20260203-3dfb3ff
- source: quay.io/pypa/manylinux_2_28_aarch64:2025.08.12-1
target: dockcross-manylinux_2_28-aarch64:2025.08.12-1

steps:
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Pull source image
run: |
for attempt in 1 2 3; do
docker pull ${{ matrix.source }} && break
echo "Pull attempt $attempt failed, retrying in 15s..."
sleep 15
done

- name: Tag and push to GHCR
run: |
docker tag ${{ matrix.source }} ${{ env.GHCR_ORG }}/${{ matrix.target }}
docker push ${{ env.GHCR_ORG }}/${{ matrix.target }}