fix(ci): copy release images to TCR with skopeo
This commit is contained in:
1 parent
3b0a442042
commit
bc6fdfdcd4
2 files changed
+18
-6
No files matched your search
@@ -188,6 +188,11 @@ jobs:
|
||||
username: ${{ secrets.TENCENT_TCR_USERNAME }}
|
||||
password: ${{ secrets.TENCENT_TCR_PASSWORD }}
|
||||
|
||||
- name: Install registry copy tool
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install --yes skopeo
|
||||
|
||||
- name: Build and publish image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
@@ -209,9 +214,12 @@ jobs:
|
||||
while IFS= read -r image_tag; do
|
||||
[[ -n "${image_tag}" ]] || continue
|
||||
for attempt in 1 2 3; do
|
||||
if docker buildx imagetools create \
|
||||
--tag "${TCR_IMAGE_NAME}:${image_tag}" \
|
||||
"${GHCR_IMAGE_NAME}:${image_tag}"; then
|
||||
if skopeo copy \
|
||||
--all \
|
||||
--preserve-digests \
|
||||
--authfile "${HOME}/.docker/config.json" \
|
||||
"docker://${GHCR_IMAGE_NAME}:${image_tag}" \
|
||||
"docker://${TCR_IMAGE_NAME}:${image_tag}"; then
|
||||
break
|
||||
fi
|
||||
if [[ "${attempt}" -eq 3 ]]; then
|
||||
|
||||
@@ -85,10 +85,14 @@ describe("Docker release contract", () => {
|
||||
expect(workflow).toContain("TCR_IMAGE_NAME: ccr.ccs.tencentyun.com/edgeever/edgeever");
|
||||
expect(workflow).toContain("secrets.TENCENT_TCR_USERNAME");
|
||||
expect(workflow).toContain("secrets.TENCENT_TCR_PASSWORD");
|
||||
expect(workflow).toContain("sudo apt-get install --yes skopeo");
|
||||
expect(workflow).toContain("name: Mirror image to Tencent Cloud Container Registry");
|
||||
expect(workflow).toContain('docker buildx imagetools create \\');
|
||||
expect(workflow).toContain('--tag "${TCR_IMAGE_NAME}:${image_tag}"');
|
||||
expect(workflow).toContain('"${GHCR_IMAGE_NAME}:${image_tag}"');
|
||||
expect(workflow).toContain('skopeo copy \\');
|
||||
expect(workflow).toContain("--all");
|
||||
expect(workflow).toContain("--preserve-digests");
|
||||
expect(workflow).toContain('--authfile "${HOME}/.docker/config.json"');
|
||||
expect(workflow).toContain('"docker://${GHCR_IMAGE_NAME}:${image_tag}"');
|
||||
expect(workflow).toContain('"docker://${TCR_IMAGE_NAME}:${image_tag}"');
|
||||
expect(workflow).toContain("for attempt in 1 2 3; do");
|
||||
expect(workflow).toContain('Failed to mirror ${image_tag} after ${attempt} attempts');
|
||||
expect(workflow).toContain('sleep "$((attempt * 15))"');
|
||||
|
||||
Reference in new issue
Block a user