Fix
This commit is contained in:
parent
53d246cd49
commit
00c2c6a6c8
|
@ -34,7 +34,7 @@ jobs:
|
||||||
gh issue close ${{ github.event.issue.number }} --reason "not planned"
|
gh issue close ${{ github.event.issue.number }} --reason "not planned"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [[ "${ORIGIN_IMAGE%%/*}" != *"."* ]]; then
|
if [[ "${ORIGIN_IMAGE%%/*}" != *"."* ]] || [[ "${ORIGIN_IMAGE}" != *"/"* ]]; then
|
||||||
gh issue comment ${{ github.event.issue.number }} -b "镜像 ${ORIGIN_IMAGE} 不存在呢, 请指定域名, 如: docker.io/${ORIGIN_IMAGE}"
|
gh issue comment ${{ github.event.issue.number }} -b "镜像 ${ORIGIN_IMAGE} 不存在呢, 请指定域名, 如: docker.io/${ORIGIN_IMAGE}"
|
||||||
gh issue edit ${{ github.event.issue.number }} --title "FAILED SYNC IMAGE"
|
gh issue edit ${{ github.event.issue.number }} --title "FAILED SYNC IMAGE"
|
||||||
gh issue close ${{ github.event.issue.number }} --reason "not planned"
|
gh issue close ${{ github.event.issue.number }} --reason "not planned"
|
||||||
|
|
|
@ -18,27 +18,35 @@ jobs:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Check Issue
|
- name: Check Issue
|
||||||
|
id: get-image
|
||||||
|
env:
|
||||||
|
IMAGE: "${{ github.event.issue.title }}"
|
||||||
run: |
|
run: |
|
||||||
ORIGIN_IMAGE=$(echo ${{ github.event.issue.title }} | awk '{print $1}')
|
ORIGIN_IMAGE="${IMAGE}"
|
||||||
if [[ -z "${ORIGIN_IMAGE}" ]]; then
|
if [[ "${ORIGIN_IMAGE}" == *"//"* ]] || [[ "${ORIGIN_IMAGE}" == *" "* ]]; then
|
||||||
gh issue comment ${{ github.event.issue.number }} -b "找不到镜像呢"
|
gh issue comment ${{ github.event.issue.number }} -b "镜像 "${ORIGIN_IMAGE}" 不是一个镜像"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [[ "${ORIGIN_IMAGE%%/*}" != *"."* ]] || [[ "${ORIGIN_IMAGE}" != *"/"* ]]; then
|
||||||
|
if [[ "${ORIGIN_IMAGE}" != *":"* ]]; then
|
||||||
|
gh issue comment ${{ github.event.issue.number }} -b "镜像 "${ORIGIN_IMAGE}" 不存在呢, 请指定 域名 和 tag, 如: docker.io/${ORIGIN_IMAGE}:latest"
|
||||||
|
else
|
||||||
|
gh issue comment ${{ github.event.issue.number }} -b "镜像 "${ORIGIN_IMAGE}" 不存在呢, 请指定域名, 如: docker.io/${ORIGIN_IMAGE}"
|
||||||
|
fi
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [[ "${ORIGIN_IMAGE}" != *":"* ]]; then
|
if [[ "${ORIGIN_IMAGE}" != *":"* ]]; then
|
||||||
gh issue comment ${{ github.event.issue.number }} -b "镜像 ${ORIGIN_IMAGE} 不存在呢, 请指定 tag, 如: ${ORIGIN_IMAGE}:latest"
|
gh issue comment ${{ github.event.issue.number }} -b "镜像 "${ORIGIN_IMAGE}" 不存在呢, 请指定 tag, 如: ${ORIGIN_IMAGE}:latest"
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [[ "${ORIGIN_IMAGE%%/*}" != *"."* ]]; then
|
|
||||||
gh issue comment ${{ github.event.issue.number }} -b "镜像 ${ORIGIN_IMAGE} 不存在呢, 请指定域名, 如: docker.io/${ORIGIN_IMAGE}"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
echo "image=${ORIGIN_IMAGE}" >> $GITHUB_OUTPUT
|
||||||
- name: Set up skopeo
|
- name: Set up skopeo
|
||||||
run: |
|
run: |
|
||||||
wget https://github.com/lework/skopeo-binary/releases/download/v1.13.3/skopeo-linux-amd64 -O /usr/local/bin/skopeo && chmod +x /usr/local/bin/skopeo
|
wget https://github.com/lework/skopeo-binary/releases/download/v1.13.3/skopeo-linux-amd64 -O /usr/local/bin/skopeo && chmod +x /usr/local/bin/skopeo
|
||||||
skopeo --version
|
skopeo --version
|
||||||
- name: Check Image
|
- name: Check Image
|
||||||
run: |
|
run: |
|
||||||
ORIGIN_IMAGE=$(echo ${{ github.event.issue.title }} | awk '{print $1}')
|
ORIGIN_IMAGE="${{ steps.get-image.outputs.image }}"
|
||||||
gh issue comment ${{ github.event.issue.number }} -b "镜像 ${ORIGIN_IMAGE} 同步中...<br>[详情请查看](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})"
|
gh issue comment ${{ github.event.issue.number }} -b "镜像 ${ORIGIN_IMAGE} 同步中...<br>[详情请查看](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})"
|
||||||
- name: Start Proxy
|
- name: Start Proxy
|
||||||
env:
|
env:
|
||||||
|
@ -58,7 +66,7 @@ jobs:
|
||||||
http_proxy: socks5://127.0.0.1:8080
|
http_proxy: socks5://127.0.0.1:8080
|
||||||
https_proxy: socks5://127.0.0.1:8080
|
https_proxy: socks5://127.0.0.1:8080
|
||||||
run: |
|
run: |
|
||||||
ORIGIN_IMAGE=$(echo ${{ github.event.issue.title }} | awk '{print $1}')
|
ORIGIN_IMAGE="${{ steps.get-image.outputs.image }}"
|
||||||
./hack/diff-image.sh "${ORIGIN_IMAGE}" "m.daocloud.io/${ORIGIN_IMAGE}"
|
./hack/diff-image.sh "${ORIGIN_IMAGE}" "m.daocloud.io/${ORIGIN_IMAGE}"
|
||||||
gh issue comment ${{ github.event.issue.number }} -b "镜像 ${ORIGIN_IMAGE} 同步完成<br>请使用 m.daocloud.io/${ORIGIN_IMAGE} 替代源镜像"
|
gh issue comment ${{ github.event.issue.number }} -b "镜像 ${ORIGIN_IMAGE} 同步完成<br>请使用 m.daocloud.io/${ORIGIN_IMAGE} 替代源镜像"
|
||||||
gh issue edit ${{ github.event.issue.number }} --add-label "sync image succeeded" -b "IMAGE SYNC"
|
gh issue edit ${{ github.event.issue.number }} --add-label "sync image succeeded" -b "IMAGE SYNC"
|
||||||
|
@ -67,7 +75,7 @@ jobs:
|
||||||
- name: Fail Sync
|
- name: Fail Sync
|
||||||
if: failure()
|
if: failure()
|
||||||
run: |
|
run: |
|
||||||
ORIGIN_IMAGE=$(echo ${{ github.event.issue.title }} | awk '{print $1}')
|
ORIGIN_IMAGE="${{ steps.get-image.outputs.image }}"
|
||||||
gh issue comment ${{ github.event.issue.number }} -b "镜像 ${ORIGIN_IMAGE} 同步失败[详情请查看](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})<br>请检查 image 是否存在, [查看成功例子](https://github.com/DaoCloud/public-image-mirror/issues?q=is%3Aissue+is%3Aclosed+label%3A%22sync+image+succeeded%22)<br>如有疑问请回复 /auto-cc 召唤帮助"
|
gh issue comment ${{ github.event.issue.number }} -b "镜像 ${ORIGIN_IMAGE} 同步失败[详情请查看](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})<br>请检查 image 是否存在, [查看成功例子](https://github.com/DaoCloud/public-image-mirror/issues?q=is%3Aissue+is%3Aclosed+label%3A%22sync+image+succeeded%22)<br>如有疑问请回复 /auto-cc 召唤帮助"
|
||||||
gh issue edit ${{ github.event.issue.number }} --add-label "sync image failure" -b "IMAGE SYNC"
|
gh issue edit ${{ github.event.issue.number }} --add-label "sync image failure" -b "IMAGE SYNC"
|
||||||
gh issue close ${{ github.event.issue.number }} --reason "not planned"
|
gh issue close ${{ github.event.issue.number }} --reason "not planned"
|
||||||
|
|
Loading…
Reference in New Issue