@@ -86,32 +86,42 @@ jobs:
8686
8787 - name : ' Pre-pull dockcross image'
8888 run : |
89+ # Resolve the image tag dynamically from the ITKPythonPackage build scripts
90+ # so it matches exactly what the build step will pull.
91+ IPP_TAG=${{ inputs.itk-python-package-tag }}
92+ IPP_TAG=${IPP_TAG:=main}
93+ IPP_ORG=${{ inputs.itk-python-package-org }}
94+ IPP_ORG=${IPP_ORG:=InsightSoftwareConsortium}
95+
8996 MANYLINUX_PLATFORM=${{ matrix.manylinux-platform }}
90- MANYLINUX_VERSION=$(echo ${MANYLINUX_PLATFORM} | cut -d '-' -f 1)
91- TARGET_ARCH=$(echo ${MANYLINUX_PLATFORM} | cut -d '-' -f 2)
92- if [[ ${MANYLINUX_VERSION} == _2_28 && ${TARGET_ARCH} == x64 ]]; then
93- IMAGE_TAG="20240304-9e57d2b"
94- elif [[ ${MANYLINUX_VERSION} == 2014 ]]; then
95- IMAGE_TAG="20240304-9e57d2b"
96- else
97- echo "Unknown manylinux platform ${MANYLINUX_PLATFORM}, skipping pre-pull"
97+ export MANYLINUX_VERSION=$(echo ${MANYLINUX_PLATFORM} | cut -d '-' -f 1)
98+ export TARGET_ARCH=$(echo ${MANYLINUX_PLATFORM} | cut -d '-' -f 2)
99+
100+ VARS_URL="https://raw.githubusercontent.com/${IPP_ORG}/ITKPythonPackage/${IPP_TAG}/scripts/dockcross-manylinux-set-vars.sh"
101+ echo "Fetching image tags from ${VARS_URL}"
102+ curl -fsSL "${VARS_URL}" -o /tmp/set-vars.sh || { echo "Could not fetch set-vars.sh, skipping pre-pull"; exit 0; }
103+ source /tmp/set-vars.sh
104+
105+ if [[ -z ${CONTAINER_SOURCE} ]]; then
106+ echo "Could not determine container source, skipping pre-pull"
98107 exit 0
99108 fi
100- IMAGE="dockcross/manylinux${MANYLINUX_VERSION}-${TARGET_ARCH}:${IMAGE_TAG}"
109+
110+ # Build the GHCR mirror name
101111 GHCR_IMAGE="ghcr.io/insightsoftwareconsortium/dockcross-manylinux${MANYLINUX_VERSION}-${TARGET_ARCH}:${IMAGE_TAG}"
102- echo "Pre-pulling ${GHCR_IMAGE} (mirror of docker.io/${IMAGE })"
112+ echo "Pre-pulling ${GHCR_IMAGE} (mirror of ${CONTAINER_SOURCE })"
103113 for attempt in 1 2 3; do
104114 if docker pull "${GHCR_IMAGE}" 2>/dev/null; then
105- docker tag "${GHCR_IMAGE}" "docker.io/${IMAGE }"
115+ docker tag "${GHCR_IMAGE}" "${CONTAINER_SOURCE }"
106116 echo "Successfully pulled from GHCR mirror"
107117 exit 0
108118 fi
109- echo "GHCR pull attempt ${attempt} failed, trying Docker Hub ..."
110- if docker pull "docker.io/${IMAGE }"; then
111- echo "Successfully pulled from Docker Hub "
119+ echo "GHCR pull attempt ${attempt} failed, trying upstream ${CONTAINER_SOURCE} ..."
120+ if docker pull "${CONTAINER_SOURCE }"; then
121+ echo "Successfully pulled from upstream "
112122 exit 0
113123 fi
114- echo "Docker Hub pull attempt ${attempt} failed, retrying in 15s..."
124+ echo "Upstream pull attempt ${attempt} failed, retrying in 15s..."
115125 sleep 15
116126 done
117127 echo "WARNING: All pull attempts failed, build script will retry"
@@ -214,18 +224,35 @@ jobs:
214224
215225 - name : ' Pre-pull manylinux aarch64 image'
216226 run : |
217- IMAGE_TAG="2024-03-25-9206bd9"
218- IMAGE="quay.io/pypa/manylinux_2_28_aarch64:${IMAGE_TAG}"
227+ # Resolve the image tag dynamically from the ITKPythonPackage build scripts
228+ IPP_TAG=${{ inputs.itk-python-package-tag }}
229+ IPP_TAG=${IPP_TAG:=main}
230+ IPP_ORG=${{ inputs.itk-python-package-org }}
231+ IPP_ORG=${IPP_ORG:=InsightSoftwareConsortium}
232+
233+ export MANYLINUX_VERSION="_2_28"
234+ export TARGET_ARCH="aarch64"
235+
236+ VARS_URL="https://raw.githubusercontent.com/${IPP_ORG}/ITKPythonPackage/${IPP_TAG}/scripts/dockcross-manylinux-set-vars.sh"
237+ echo "Fetching image tags from ${VARS_URL}"
238+ curl -fsSL "${VARS_URL}" -o /tmp/set-vars.sh || { echo "Could not fetch set-vars.sh, skipping pre-pull"; exit 0; }
239+ source /tmp/set-vars.sh
240+
241+ if [[ -z ${CONTAINER_SOURCE} ]]; then
242+ echo "Could not determine container source, skipping pre-pull"
243+ exit 0
244+ fi
245+
219246 GHCR_IMAGE="ghcr.io/insightsoftwareconsortium/dockcross-manylinux_2_28-aarch64:${IMAGE_TAG}"
220- echo "Pre-pulling ${GHCR_IMAGE} (mirror of ${IMAGE })"
247+ echo "Pre-pulling ${GHCR_IMAGE} (mirror of ${CONTAINER_SOURCE })"
221248 for attempt in 1 2 3; do
222249 if docker pull "${GHCR_IMAGE}" 2>/dev/null; then
223- docker tag "${GHCR_IMAGE}" "${IMAGE }"
250+ docker tag "${GHCR_IMAGE}" "${CONTAINER_SOURCE }"
224251 echo "Successfully pulled from GHCR mirror"
225252 exit 0
226253 fi
227254 echo "GHCR pull attempt ${attempt} failed, trying upstream..."
228- if docker pull "${IMAGE }"; then
255+ if docker pull "${CONTAINER_SOURCE }"; then
229256 echo "Successfully pulled from upstream"
230257 exit 0
231258 fi
0 commit comments