Skip to content

Target Sync cr.weaviate.io/semitechnologies/img2vec-pytorch:resnet50 by @youzipi #347

Target Sync cr.weaviate.io/semitechnologies/img2vec-pytorch:resnet50 by @youzipi

Target Sync cr.weaviate.io/semitechnologies/img2vec-pytorch:resnet50 by @youzipi #347

Workflow file for this run

name: Target Sync Image
run-name: Target Sync ${{ github.event.issue.title }} by @${{ github.actor }}
on:
issues:
types:
- opened
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token
permissions:
issues: write
jobs:
sync:
runs-on: ubuntu-latest
if: contains(github.event.issue.labels.*.name, 'sync image')
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check Issue
id: get-image
env:
IMAGE: "${{ github.event.issue.title }}"
run: |
ORIGIN_IMAGE="${IMAGE}"
CORRECT_IMAGE="$(./hack/correct-image.sh "${ORIGIN_IMAGE}")"
if [[ "${CORRECT_IMAGE}" == "" ]]; then
gh issue comment ${{ github.event.issue.number }} -b "镜像 '${ORIGIN_IMAGE}' 不是一个镜像"
exit 1
fi
if [[ "${CORRECT_IMAGE}" != "${ORIGIN_IMAGE}" ]]; then
if ! ./hack/verify-allows.sh ./allows.txt "${CORRECT_IMAGE}"; then
gh issue comment ${{ github.event.issue.number }} -b "镜像 '${ORIGIN_IMAGE}' 不存在呢, 也许应该是 '${CORRECT_IMAGE}', 并且不在白名单列表里, 不支持同步和访问<br>可以将其添加到[白名单](https://github.com/${{ github.repository }}/issues/2328)"
else
gh issue comment ${{ github.event.issue.number }} -b "镜像 '${ORIGIN_IMAGE}' 不存在呢, 也许应该是 '${CORRECT_IMAGE}'"
fi
exit 1
fi
if ! ./hack/verify-allows.sh ./allows.txt "${ORIGIN_IMAGE}"; then
gh issue comment ${{ github.event.issue.number }} -b "镜像 ${ORIGIN_IMAGE} 不在白名单列表里, 不支持同步和访问<br>可以将其添加到[白名单](https://github.com/${{ github.repository }}/issues/2328)"
exit 1
fi
echo "image=${ORIGIN_IMAGE}" >> $GITHUB_OUTPUT
- name: Check Image
run: |
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 }})"
- name: Set up crproxy
run: |
wget https://github.com/DaoCloud/crproxy/releases/download/v0.13.0-alpha.43/crproxy_linux_amd64 -O /usr/local/bin/crproxy && chmod +x /usr/local/bin/crproxy
- name: Sync Images to OSS&OBS
run: |
ORIGIN_IMAGE="${{ steps.get-image.outputs.image }}"
/usr/local/bin/crproxy sync --deep --max-warn 1 ${{ secrets.STORAGE_ARGS }} --user '${{ secrets.OCI_USER }}' --list ${ORIGIN_IMAGE}
- name: Succeeded Sync
run: |
ORIGIN_IMAGE="${{ steps.get-image.outputs.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 close ${{ github.event.issue.number }} --reason "completed"
- name: Fail Sync
if: failure()
run: |
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>如有疑问请回复 /auto-cc 召唤帮助, 或者查看[同步成功案例](https://github.com/${{ github.repository }}/issues?q=is%3Aissue+is%3Aclosed+label%3A%22sync+image+succeeded%22)或[白名单申请案例](https://github.com/${{ github.repository }}/issues?q=is%3Aissue+label%3A%22allows+image%22+is%3Aclosed+linked%3Apr)"
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"