Update Sync ()

This commit is contained in:
Shiming Zhang 2024-12-20 13:51:45 +08:00 committed by GitHub
parent 89369a6deb
commit e7678e9589
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 41 additions and 90 deletions

View File

@ -1,4 +1,5 @@
name: Manual Deep Sync
run-name: Manual Deep Sync ${{ inputs.image }} by @${{ github.actor }}
on:
workflow_dispatch:
@ -10,34 +11,15 @@ on:
jobs:
sync-images:
if: github.repository == 'DaoCloud/public-image-mirror'
runs-on: ubuntu-latest
if: github.repository == 'DaoCloud/public-image-mirror'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Start Proxy
env:
only_proxy: "m.daocloud.io"
- name: Set up crproxy
run: |
wget https://github.com/wzshiming/bridge/releases/download/v0.9.0/bridge_linux_amd64 -O /usr/local/bin/bridge && chmod +x /usr/local/bin/bridge
nohup /usr/local/bin/bridge -b :8080 -p - ${{ secrets.PROTOCOL }} 2>/dev/null &
- name: Check Proxy
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: |
curl -v http://127.0.0.1:8080 || exit 1
curl -f --proxy 127.0.0.1:8080 -v http://m.daocloud.io/v2/ || exit 1
- name: Override mirror.txt
run: |
echo ${{ github.event.inputs.image }} > mirror.txt
- name: Set up skopeo
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
skopeo --version
- name: Sync Images
env:
INCREMENTAL: "true"
SYNC: "true"
PARALLET: "1"
http_proxy: socks5://127.0.0.1:8080
https_proxy: socks5://127.0.0.1:8080
run: |
./hack/diff.sh
ORIGIN_IMAGE=${{ github.event.inputs.image }}
/usr/local/bin/crproxy sync --deep --max-warn 1 ${{ secrets.STORAGE_ARGS }} --user '${{ secrets.OCI_USER }}' --list ${ORIGIN_IMAGE}

View File

@ -1,4 +1,5 @@
name: Manual Sync
run-name: Manual Sync ${{ inputs.image }} by @${{ github.actor }}
on:
workflow_dispatch:
@ -10,35 +11,15 @@ on:
jobs:
sync-images:
if: github.repository == 'DaoCloud/public-image-mirror'
runs-on: ubuntu-latest
if: github.repository == 'DaoCloud/public-image-mirror'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Start Proxy
env:
only_proxy: "m.daocloud.io"
- name: Set up crproxy
run: |
wget https://github.com/wzshiming/bridge/releases/download/v0.9.0/bridge_linux_amd64 -O /usr/local/bin/bridge && chmod +x /usr/local/bin/bridge
nohup /usr/local/bin/bridge -b :8080 -p - ${{ secrets.PROTOCOL }} 2>/dev/null &
- name: Check Proxy
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: |
curl -v http://127.0.0.1:8080 || exit 1
curl -f --proxy 127.0.0.1:8080 -v http://m.daocloud.io/v2/ || exit 1
- name: Override mirror.txt
run: |
echo ${{ github.event.inputs.image }} > mirror.txt
- name: Set up skopeo
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
skopeo --version
- name: Sync Images
env:
INCREMENTAL: "true"
QUICKLY: "true"
SYNC: "true"
PARALLET: "1"
http_proxy: socks5://127.0.0.1:8080
https_proxy: socks5://127.0.0.1:8080
run: |
./hack/diff.sh
ORIGIN_IMAGE=${{ github.event.inputs.image }}
/usr/local/bin/crproxy sync --max-warn 1 ${{ secrets.STORAGE_ARGS }} --user '${{ secrets.OCI_USER }}' --list ${ORIGIN_IMAGE}

View File

@ -2,38 +2,23 @@ name: Sync
on:
schedule:
- cron: "0 12,18 * * *"
- cron: "1 * * * *"
workflow_dispatch:
jobs:
sync-images:
if: github.repository == 'DaoCloud/public-image-mirror'
runs-on: ubuntu-latest
if: github.repository == 'DaoCloud/public-image-mirror'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Start Proxy
env:
only_proxy: "m.daocloud.io"
- name: Set up crproxy
run: |
wget https://github.com/wzshiming/bridge/releases/download/v0.9.0/bridge_linux_amd64 -O /usr/local/bin/bridge && chmod +x /usr/local/bin/bridge
nohup /usr/local/bin/bridge -b :8080 -p - ${{ secrets.PROTOCOL }} 2>/dev/null &
- name: Check Proxy
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: |
curl -v http://127.0.0.1:8080 || exit 1
curl -f --proxy 127.0.0.1:8080 -v http://m.daocloud.io/v2/ || exit 1
- name: Set up skopeo
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
skopeo --version
- name: Sync Images
env:
INCREMENTAL: "true"
QUICKLY: "true"
SYNC: "true"
PARALLET: "2"
http_proxy: socks5://127.0.0.1:8080
https_proxy: socks5://127.0.0.1:8080
run: |
./hack/diff.sh
ORIGIN_IMAGE=$(echo "${MESSAGE}" | grep SYNC | awk '{print $2}' | head -n 1 | sed "s/\r//g")
/usr/local/bin/crproxy sync --max-warn 100 ${{ secrets.STORAGE_ARGS }} --list-from-file ./mirror.txt

View File

@ -1,4 +1,6 @@
name: Target Sync Image (old)
run-name: Target ${{ github.event.issue.title }} by @${{ github.actor }}
on:
issues:
types:
@ -50,18 +52,14 @@ jobs:
- name: Set up crproxy
run: |
wget https://github.com/DaoCloud/crproxy/releases/download/v0.8.0/crproxy_linux_amd64 -O /usr/local/bin/crproxy && chmod +x /usr/local/bin/crproxy
/usr/local/bin/crproxy -a :8000 ${{ secrets.CRPROXY_ARGS }} &
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
- name: Sync Images to OSS&OBS
env:
MESSAGE: "${{ github.event.issue.body }}"
run: |
ORIGIN_IMAGE=$(echo "${MESSAGE}" | grep SYNC | awk '{print $2}' | head -n 1 | sed "s/\r//g")
curl --fail -X PUT "http://127.0.0.1:8000/internal/api/image/sync?image=${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 close ${{ github.event.issue.number }} --reason "completed"
/usr/local/bin/crproxy sync --deep --max-warn 1 ${{ secrets.STORAGE_ARGS }} --user '${{ secrets.OCI_USER }}' --list ${ORIGIN_IMAGE}
- name: Fail Sync
if: failure()

View File

@ -1,4 +1,6 @@
name: Target Sync Image
run-name: Target Sync ${{ github.event.issue.title }} by @${{ github.actor }}
on:
issues:
types:
@ -49,13 +51,16 @@ jobs:
- name: Set up crproxy
run: |
wget https://github.com/DaoCloud/crproxy/releases/download/v0.8.0/crproxy_linux_amd64 -O /usr/local/bin/crproxy && chmod +x /usr/local/bin/crproxy
/usr/local/bin/crproxy -a :8000 ${{ secrets.CRPROXY_ARGS }} &
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
- 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 }}"
curl --fail -X PUT "http://127.0.0.1:8000/internal/api/image/sync?image=${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 close ${{ github.event.issue.number }} --reason "completed"