Skip to content

Commit

Permalink
Optimize check schemaVersion before copy
Browse files Browse the repository at this point in the history
  • Loading branch information
dyrnq committed Oct 4, 2024
1 parent b82caee commit 4905d42
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/copy-open-webui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ jobs:
sudo curl -# -fSL https://github.com/dyrnq/skopeo-binary/releases/download/${SKOPEO_VER}/skopeo.tar.xz | sudo tar -xvJ -C /usr/bin
sudo chmod +x /usr/bin/skopeo
skopeo -v && skopeo --help
- name: Install regctl
run: |
sudo curl -# -fSL -o /usr/local/bin/regctl https://github.com/regclient/regclient/releases/download/v0.7.1/regctl-linux-amd64
sudo chmod +x /usr/local/bin/regctl
regctl version
- name: Images copy
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
Expand All @@ -85,4 +90,10 @@ jobs:
dest=$(awk -F, '{print $2}' <<< "${line}")
tag=${{ matrix.tags }}
echo ${tag}
skopeo --insecure-policy copy --all --retry-times 20 --dest-precompute-digests --dest-creds $DOCKER_USERNAME:$DOCKER_PASSWORD docker://"${scr}":"${tag}" docker://"${dest}":"${tag}"
schemaVersion=$(regctl manifest get docker://"${scr}":"${tag}" --format raw-body | jq -r '.schemaVersion')
if [ "${schemaVersion}" = "1" ]; then
echo "schemaVersion=1, skip copy"
else
skopeo --insecure-policy copy --all --retry-times 20 --dest-precompute-digests --dest-creds $DOCKER_USERNAME:$DOCKER_PASSWORD docker://"${scr}":"${tag}" docker://"${dest}":"${tag}"
fi
17 changes: 14 additions & 3 deletions .github/workflows/copy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ jobs:
sudo curl -# -fSL https://github.com/dyrnq/skopeo-binary/releases/download/${SKOPEO_VER}/skopeo.tar.xz | sudo tar -xvJ -C /usr/bin
sudo chmod +x /usr/bin/skopeo
skopeo -v && skopeo --help
- name: Install regctl
run: |
sudo curl -# -fSL -o /usr/local/bin/regctl https://github.com/regclient/regclient/releases/download/v0.7.1/regctl-linux-amd64
sudo chmod +x /usr/local/bin/regctl
regctl version
- name: Images copy
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
Expand All @@ -101,9 +106,15 @@ jobs:
for tag in $(skopeo list-tags docker://"${scr}" | jq -r '.Tags[]' | grep -v "sha" ) ; do
skopeo --insecure-policy copy --format v2s2 --all --retry-times 20 --dest-precompute-digests --dest-creds $DOCKER_USERNAME:$DOCKER_PASSWORD docker://"${scr}":"${tag}" docker://"${dest}":"${tag}"
# skopeo --insecure-policy copy --all --retry-times 20 --dest-precompute-digests --dest-creds $DOCKER_USERNAME:$DOCKER_PASSWORD docker://"${scr}":"${tag}" docker://"${dest}":"${tag}"
schemaVersion=$(regctl manifest get docker://"${scr}":"${tag}" --format raw-body | jq -r '.schemaVersion')
if [ "${schemaVersion}" = "1" ]; then
echo "schemaVersion=1, skip copy"
else
skopeo --insecure-policy copy --all --retry-times 20 --dest-precompute-digests --dest-creds $DOCKER_USERNAME:$DOCKER_PASSWORD docker://"${scr}":"${tag}" docker://"${dest}":"${tag}"
fi
done
# skopeo --insecure-policy copy --format v2s2 --all --retry-times 5 --dest-precompute-digests --dest-creds $DOCKER_USERNAME:$DOCKER_PASSWORD docker://gcr.io/google.com/cloudsdktool/cloud-sdk:302.0.0-slim docker://docker.io/dyrnq/cloud-sdk:302.0.0-slim
# skopeo --insecure-policy copy --format v2s2 --all --retry-times 5 --dest-precompute-digests --dest-creds $DOCKER_USERNAME:$DOCKER_PASSWORD docker://gcr.io/distroless/base:debug docker://docker.io/dyrnq/distroless-base:debug
# skopeo --insecure-policy copy --all --retry-times 5 --dest-precompute-digests --dest-creds $DOCKER_USERNAME:$DOCKER_PASSWORD docker://gcr.io/google.com/cloudsdktool/cloud-sdk:302.0.0-slim docker://docker.io/dyrnq/cloud-sdk:302.0.0-slim
# skopeo --insecure-policy copy --all --retry-times 5 --dest-precompute-digests --dest-creds $DOCKER_USERNAME:$DOCKER_PASSWORD docker://gcr.io/distroless/base:debug docker://docker.io/dyrnq/distroless-base:debug

0 comments on commit 4905d42

Please sign in to comment.