mirror of
https://github.com/DaoCloud/public-image-mirror.git
synced 2025-08-08 21:57:43 +08:00
Fix target sync image
This commit is contained in:
9
.github/workflows/sync-image.yml
vendored
9
.github/workflows/sync-image.yml
vendored
@@ -46,14 +46,9 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
echo "image=${ORIGIN_IMAGE}" >> $GITHUB_OUTPUT
|
||||
if [[ "${ORIGIN_IMAGE}" =~ ^docker.io/ ]]; then
|
||||
ORIGIN_IMAGE="registry-1.${ORIGIN_IMAGE}"
|
||||
fi
|
||||
|
||||
if [[ "${ORIGIN_IMAGE}" =~ ^registry-1\.docker\.io/[^/]+$ ]]; then
|
||||
ORIGIN_IMAGE="registry-1.docker.io/library/${ORIGIN_IMAGE#registry-1.docker.io/}"
|
||||
fi
|
||||
echo "sync_image=${ORIGIN_IMAGE}" >> $GITHUB_OUTPUT
|
||||
SYNC_IMAGE="$(./hack/real-image.sh "${ORIGIN_IMAGE}")"
|
||||
echo "sync_image=${SYNC_IMAGE}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Set up crproxy
|
||||
run: |
|
||||
|
21
hack/real-image.sh
Executable file
21
hack/real-image.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function guess_image() {
|
||||
local image="${1}"
|
||||
|
||||
if [[ -z "${image}" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ "${image}" =~ ^"docker.io/"* ]]; then
|
||||
image="registry-1.${image}"
|
||||
fi
|
||||
|
||||
if [[ "${image}" =~ ^"registry-1.docker.io/"[^/]+$ ]]; then
|
||||
image="registry-1.docker.io/library/${image#*/}"
|
||||
fi
|
||||
|
||||
echo "${image}"
|
||||
}
|
||||
|
||||
guess_image "${1}"
|
Reference in New Issue
Block a user