Skip to content

Commit

Permalink
chore: fix aliyun sync (#367)
Browse files Browse the repository at this point in the history
* chore: fix aliyun sync

* chore: fix skopeo sync image
  • Loading branch information
JashBook authored Jul 17, 2024
1 parent 9ae6f6a commit e5c8bb6
Show file tree
Hide file tree
Showing 13 changed files with 205 additions and 66 deletions.
6 changes: 6 additions & 0 deletions .github/actions/image-sync-auth-apecloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
docker.io:
username: "${DOCKER_USER}"
password: "${DOCKER_PASSWORD}"
apecloud-registry.cn-zhangjiakou.cr.aliyuncs.com:
username: "${ALIYUN_USER}"
password: "${ALIYUN_PASSWORD}"
9 changes: 0 additions & 9 deletions .github/actions/image-sync-auth-new.yml

This file was deleted.

7 changes: 3 additions & 4 deletions .github/utils/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -643,19 +643,18 @@ EOF
done
}

generate_image_yaml_new() {
generate_image_yaml_apecloud() {
if [[ -z "$IMAGES" ]]; then
echo "images name is empty"
return
fi
image_sync_yaml="./image_sync_yaml_new.yml"
image_sync_yaml="./image_sync_yaml_apecloud.yml"
rm -f $image_sync_yaml
touch $image_sync_yaml
for image in `echo "$IMAGES" | sed 's/|/ /g'`; do
image_name=${image##*/}
tee -a $image_sync_yaml << EOF
${REGISTRY}/${image}:
- "infracreate-registry.cn-zhangjiakou.cr.aliyuncs.com/apecloud/${image_name}"
- "apecloud-registry.cn-zhangjiakou.cr.aliyuncs.com/apecloud/${image_name}"
EOF
done
Expand Down Expand Up @@ -997,7 +996,7 @@ main() {
check_release_version
;;
32)
generate_image_yaml_new
generate_image_yaml_apecloud
;;
33)
set_label
Expand Down
31 changes: 27 additions & 4 deletions .github/workflows/release-image-amd-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,35 @@ jobs:

- name: generate image yaml
run: |
bash ${{ github.workspace }}/apecloud-cd/.github/utils/utils.sh \
--type 27 \
--images "${{ inputs.IMG }}:${{ needs.release-image.outputs.tag-name }}" \
--registry "${{ env.DOCKER_REGISTRY_URL }}"
if [[ -n "${{ env.ALIYUN_USER_NEW }}" && -n "${{ env.ALIYUN_PASSWORD_NEW }}" ]]; then
bash ${{ github.workspace }}/apecloud-cd/.github/utils/utils.sh \
--type 27 \
--images "${{ inputs.IMG }}:${{ needs.release-image.outputs.tag-name }}" \
--registry "${{ env.DOCKER_REGISTRY_URL }}"
else
bash ${{ github.workspace }}/apecloud-cd/.github/utils/utils.sh \
--type 32 \
--images "${{ inputs.IMG }}:${{ needs.release-image.outputs.tag-name }}" \
--registry "${{ env.DOCKER_REGISTRY_URL }}"
fi
- uses: hhyasdf/[email protected]
name: sync image to apecloud aliyun registry
if: ${{ env.DOCKER_USER != '' && env.DOCKER_PASSWORD != '' && env.ALIYUN_USER != '' && env.ALIYUN_PASSWORD != '' && (env.ALIYUN_USER_NEW == '' || env.ALIYUN_PASSWORD_NEW == '') }}
with:
auth_file: ${{ github.workspace }}/apecloud-cd/.github/actions/image-sync-auth-apecloud.yml
images_file: ./image_sync_yaml_apecloud.yml
proc: 6
retries: 5
version: v1.5.2
env:
DOCKER_USER: ${{ env.DOCKER_USER }}
DOCKER_PASSWORD: ${{ env.DOCKER_PASSWORD }}
ALIYUN_USER: ${{ env.ALIYUN_USER }}
ALIYUN_PASSWORD: ${{ env.ALIYUN_PASSWORD }}

- uses: hhyasdf/[email protected]
name: sync image to all aliyun registry
if: ${{ env.DOCKER_USER != '' && env.DOCKER_PASSWORD != '' && env.ALIYUN_USER != '' && env.ALIYUN_PASSWORD != '' && env.ALIYUN_USER_NEW != '' && env.ALIYUN_PASSWORD_NEW != '' }}
with:
auth_file: ${{ github.workspace }}/apecloud-cd/.github/actions/image-sync-auth.yml
Expand Down
31 changes: 27 additions & 4 deletions .github/workflows/release-image-arm-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,35 @@ jobs:

- name: generate image yaml
run: |
bash ${{ github.workspace }}/apecloud-cd/.github/utils/utils.sh \
--type 27 \
--images "${{ inputs.IMG }}:${{ needs.release-image.outputs.tag-name }}" \
--registry "${{ env.DOCKER_REGISTRY_URL }}"
if [[ -n "${{ env.ALIYUN_USER_NEW }}" && -n "${{ env.ALIYUN_PASSWORD_NEW }}" ]]; then
bash ${{ github.workspace }}/apecloud-cd/.github/utils/utils.sh \
--type 27 \
--images "${{ inputs.IMG }}:${{ needs.release-image.outputs.tag-name }}" \
--registry "${{ env.DOCKER_REGISTRY_URL }}"
else
bash ${{ github.workspace }}/apecloud-cd/.github/utils/utils.sh \
--type 32 \
--images "${{ inputs.IMG }}:${{ needs.release-image.outputs.tag-name }}" \
--registry "${{ env.DOCKER_REGISTRY_URL }}"
fi
- uses: hhyasdf/[email protected]
name: sync image to apecloud aliyun registry
if: ${{ env.DOCKER_USER != '' && env.DOCKER_PASSWORD != '' && env.ALIYUN_USER != '' && env.ALIYUN_PASSWORD != '' && (env.ALIYUN_USER_NEW == '' || env.ALIYUN_PASSWORD_NEW == '') }}
with:
auth_file: ${{ github.workspace }}/apecloud-cd/.github/actions/image-sync-auth-apecloud.yml
images_file: ./image_sync_yaml_apecloud.yml
proc: 6
retries: 5
version: v1.5.2
env:
DOCKER_USER: ${{ env.DOCKER_USER }}
DOCKER_PASSWORD: ${{ env.DOCKER_PASSWORD }}
ALIYUN_USER: ${{ env.ALIYUN_USER }}
ALIYUN_PASSWORD: ${{ env.ALIYUN_PASSWORD }}

- uses: hhyasdf/[email protected]
name: sync image to all aliyun registry
if: ${{ env.DOCKER_USER != '' && env.DOCKER_PASSWORD != '' && env.ALIYUN_USER != '' && env.ALIYUN_PASSWORD != '' && env.ALIYUN_USER_NEW != '' && env.ALIYUN_PASSWORD_NEW != '' }}
with:
auth_file: ${{ github.workspace }}/apecloud-cd/.github/actions/image-sync-auth.yml
Expand Down
31 changes: 27 additions & 4 deletions .github/workflows/release-image-cache-amd-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,35 @@ jobs:

- name: generate image yaml
run: |
bash ${{ github.workspace }}/apecloud-cd/.github/utils/utils.sh \
--type 27 \
--images "${{ inputs.IMG }}:${{ needs.release-image.outputs.tag-name }}" \
--registry "${{ env.DOCKER_REGISTRY_URL }}"
if [[ -n "${{ env.ALIYUN_USER_NEW }}" && -n "${{ env.ALIYUN_PASSWORD_NEW }}" ]]; then
bash ${{ github.workspace }}/apecloud-cd/.github/utils/utils.sh \
--type 27 \
--images "${{ inputs.IMG }}:${{ needs.release-image.outputs.tag-name }}" \
--registry "${{ env.DOCKER_REGISTRY_URL }}"
else
bash ${{ github.workspace }}/apecloud-cd/.github/utils/utils.sh \
--type 32 \
--images "${{ inputs.IMG }}:${{ needs.release-image.outputs.tag-name }}" \
--registry "${{ env.DOCKER_REGISTRY_URL }}"
fi
- uses: hhyasdf/[email protected]
name: sync image to apecloud aliyun registry
if: ${{ env.DOCKER_USER != '' && env.DOCKER_PASSWORD != '' && env.ALIYUN_USER != '' && env.ALIYUN_PASSWORD != '' && (env.ALIYUN_USER_NEW == '' || env.ALIYUN_PASSWORD_NEW == '') }}
with:
auth_file: ${{ github.workspace }}/apecloud-cd/.github/actions/image-sync-auth-apecloud.yml
images_file: ./image_sync_yaml_apecloud.yml
proc: 6
retries: 5
version: v1.5.2
env:
DOCKER_USER: ${{ env.DOCKER_USER }}
DOCKER_PASSWORD: ${{ env.DOCKER_PASSWORD }}
ALIYUN_USER: ${{ env.ALIYUN_USER }}
ALIYUN_PASSWORD: ${{ env.ALIYUN_PASSWORD }}

- uses: hhyasdf/[email protected]
name: sync image to all aliyun registry
if: ${{ env.DOCKER_USER != '' && env.DOCKER_PASSWORD != '' && env.ALIYUN_USER != '' && env.ALIYUN_PASSWORD != '' && env.ALIYUN_USER_NEW != '' && env.ALIYUN_PASSWORD_NEW != '' }}
with:
auth_file: ${{ github.workspace }}/apecloud-cd/.github/actions/image-sync-auth.yml
Expand Down
31 changes: 27 additions & 4 deletions .github/workflows/release-image-cache-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,35 @@ jobs:

- name: generate image yaml
run: |
bash ${{ github.workspace }}/apecloud-cd/.github/utils/utils.sh \
--type 27 \
--images "${{ inputs.IMG }}:${{ needs.release-image.outputs.tag-name }}" \
--registry "${{ env.DOCKER_REGISTRY_URL }}"
if [[ -n "${{ env.ALIYUN_USER_NEW }}" && -n "${{ env.ALIYUN_PASSWORD_NEW }}" ]]; then
bash ${{ github.workspace }}/apecloud-cd/.github/utils/utils.sh \
--type 27 \
--images "${{ inputs.IMG }}:${{ needs.release-image.outputs.tag-name }}" \
--registry "${{ env.DOCKER_REGISTRY_URL }}"
else
bash ${{ github.workspace }}/apecloud-cd/.github/utils/utils.sh \
--type 32 \
--images "${{ inputs.IMG }}:${{ needs.release-image.outputs.tag-name }}" \
--registry "${{ env.DOCKER_REGISTRY_URL }}"
fi
- uses: hhyasdf/[email protected]
name: sync image to apecloud aliyun registry
if: ${{ env.DOCKER_USER != '' && env.DOCKER_PASSWORD != '' && env.ALIYUN_USER != '' && env.ALIYUN_PASSWORD != '' && (env.ALIYUN_USER_NEW == '' || env.ALIYUN_PASSWORD_NEW == '') }}
with:
auth_file: ${{ github.workspace }}/apecloud-cd/.github/actions/image-sync-auth-apecloud.yml
images_file: ./image_sync_yaml_apecloud.yml
proc: 6
retries: 5
version: v1.5.2
env:
DOCKER_USER: ${{ env.DOCKER_USER }}
DOCKER_PASSWORD: ${{ env.DOCKER_PASSWORD }}
ALIYUN_USER: ${{ env.ALIYUN_USER }}
ALIYUN_PASSWORD: ${{ env.ALIYUN_PASSWORD }}

- uses: hhyasdf/[email protected]
name: sync image to all aliyun registry
if: ${{ env.DOCKER_USER != '' && env.DOCKER_PASSWORD != '' && env.ALIYUN_USER != '' && env.ALIYUN_PASSWORD != '' && env.ALIYUN_USER_NEW != '' && env.ALIYUN_PASSWORD_NEW != '' }}
with:
auth_file: ${{ github.workspace }}/apecloud-cd/.github/actions/image-sync-auth.yml
Expand Down
36 changes: 30 additions & 6 deletions .github/workflows/release-image-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -367,16 +367,40 @@ jobs:
;;
esac
fi
bash ${{ github.workspace }}/apecloud-cd/.github/utils/utils.sh \
--type 32 \
--images "${IMAGES_INPUT}" \
--registry "${{ env.DOCKER_REGISTRY_URL }}"
if [[ -n "${{ env.ALIYUN_USER_NEW }}" && -n "${{ env.ALIYUN_PASSWORD_NEW }}" ]]; then
bash ${{ github.workspace }}/apecloud-cd/.github/utils/utils.sh \
--type 27 \
--images "${IMAGES_INPUT}" \
--registry "${{ env.DOCKER_REGISTRY_URL }}"
else
bash ${{ github.workspace }}/apecloud-cd/.github/utils/utils.sh \
--type 32 \
--images "${IMAGES_INPUT}" \
--registry "${{ env.DOCKER_REGISTRY_URL }}"
fi
- uses: hhyasdf/[email protected]
name: sync image to apecloud aliyun registry
if: ${{ env.DOCKER_USER != '' && env.DOCKER_PASSWORD != '' && env.ALIYUN_USER != '' && env.ALIYUN_PASSWORD != '' && (env.ALIYUN_USER_NEW == '' || env.ALIYUN_PASSWORD_NEW == '') }}
with:
auth_file: ${{ github.workspace }}/apecloud-cd/.github/actions/image-sync-auth-apecloud.yml
images_file: ./image_sync_yaml_apecloud.yml
proc: 6
retries: 5
version: v1.5.2
env:
DOCKER_USER: ${{ env.DOCKER_USER }}
DOCKER_PASSWORD: ${{ env.DOCKER_PASSWORD }}
ALIYUN_USER: ${{ env.ALIYUN_USER }}
ALIYUN_PASSWORD: ${{ env.ALIYUN_PASSWORD }}

- uses: hhyasdf/[email protected]
if: ${{ env.DOCKER_USER != '' && env.DOCKER_PASSWORD != '' && env.ALIYUN_USER_NEW != '' && env.ALIYUN_PASSWORD_NEW != '' }}
name: sync image to all aliyun registry
if: ${{ env.DOCKER_USER != '' && env.DOCKER_PASSWORD != '' && env.ALIYUN_USER != '' && env.ALIYUN_PASSWORD != '' && env.ALIYUN_USER_NEW != '' && env.ALIYUN_PASSWORD_NEW != '' }}
with:
auth_file: ${{ github.workspace }}/apecloud-cd/.github/actions/image-sync-auth.yml
images_file: ./image_sync_yaml_new.yml
images_file: ./image_sync_yaml.yml
proc: 6
retries: 5
version: v1.5.2
Expand Down
22 changes: 14 additions & 8 deletions .github/workflows/skopeo-copy-images-aliyun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ run-name: copy to aliyun:${{ github.event.inputs.images_name }}
env:
DOCKER_USER: ${{ secrets.DOCKER_REGISTRY_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
ALIYUN_USER: ${{ secrets.ALIYUN_REGISTRY_USER }}
ALIYUN_PASSWORD: ${{ secrets.ALIYUN_REGISTRY_PASSWORD }}
ALIYUN_USER_NEW: ${{ secrets.ALIYUN_USER_NEW }}
ALIYUN_PASSWORD_NEW: ${{ secrets.ALIYUN_PASSWORD_NEW }}

jobs:
script:
Expand All @@ -35,15 +39,17 @@ jobs:
fi
bash ${{ github.workspace }}/.github/utils/skopeo_copy_to_aliyun.sh \
"${{ secrets.ALIYUN_REGISTRY_USER }}" \
"${{ secrets.ALIYUN_REGISTRY_PASSWORD }}" \
"${{ env.ALIYUN_USER }}" \
"${{ env.ALIYUN_PASSWORD }}" \
${{ github.workspace }}/.github/utils/images-list.txt \
"${{ inputs.registry }}" \
'${{ secrets.ECR_PASSWORD }}'
bash ${{ github.workspace }}/.github/utils/skopeo_copy_to_aliyun_new.sh \
"${{ secrets.ALIYUN_USER_NEW }}" \
"${{ secrets.ALIYUN_PASSWORD_NEW }}" \
${{ github.workspace }}/.github/utils/images-list.txt \
"${{ inputs.registry }}" \
'${{ secrets.ECR_PASSWORD }}'
if [[ -n "${{ env.ALIYUN_USER_NEW }}" && -n "${{ env.ALIYUN_PASSWORD_NEW }}" ]]; then
bash ${{ github.workspace }}/.github/utils/skopeo_copy_to_aliyun_new.sh \
"${{ env.ALIYUN_USER_NEW }}" \
"${{ env.ALIYUN_PASSWORD_NEW }}" \
${{ github.workspace }}/.github/utils/images-list.txt \
"${{ inputs.registry }}" \
'${{ secrets.ECR_PASSWORD }}'
fi
4 changes: 2 additions & 2 deletions .github/workflows/skopeo-copy-images-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ jobs:
fi
bash ${{ github.workspace }}/.github/utils/skopeo_copy_to_docker.sh \
"${{ secrets.DOCKER_REGISTRY_USER }}" \
'${{ secrets.DOCKER_REGISTRY_PASSWORD }}' \
"${{ env.DOCKER_USER }}" \
'${{ env.DOCKER_PASSWORD }}' \
${{ github.workspace }}/.github/utils/images-list.txt \
"${{ inputs.registry }}" \
'${{ secrets.ECR_PASSWORD }}'
15 changes: 10 additions & 5 deletions .github/workflows/skopeo-sync-images-aliyun-to-aliyun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ on:

run-name: sync to aliyun:${{ github.event.inputs.images_name }}

env:
ALIYUN_USER: ${{ secrets.ALIYUN_REGISTRY_USER }}
ALIYUN_PASSWORD: ${{ secrets.ALIYUN_REGISTRY_PASSWORD }}
ALIYUN_USER_NEW: ${{ secrets.ALIYUN_USER_NEW }}
ALIYUN_PASSWORD_NEW: ${{ secrets.ALIYUN_PASSWORD_NEW }}

jobs:
script:
runs-on: macos-latest
Expand All @@ -29,12 +35,11 @@ jobs:
--images "${{ github.event.inputs.images_name }}" \
--images-list ${{ github.workspace }}/.github/utils/images-list.txt
fi
bash ${{ github.workspace }}/.github/utils/skopeo_sync_aliyun_to_aliyun_new.sh \
"${{ secrets.ALIYUN_REGISTRY_USER }}" \
'${{ secrets.ALIYUN_REGISTRY_PASSWORD }}' \
"${{ secrets.ALIYUN_USER_NEW }}" \
"${{ secrets.ALIYUN_PASSWORD_NEW }}" \
"${{ env.ALIYUN_USER }}" \
'${{ env.ALIYUN_PASSWORD }}' \
"${{ env.ALIYUN_USER_NEW }}" \
"${{ env.ALIYUN_PASSWORD_NEW }}" \
${{ github.workspace }}/.github/utils/images-list.txt \
"${{ inputs.registry }}"
37 changes: 24 additions & 13 deletions .github/workflows/skopeo-sync-images-aliyun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ on:

run-name: sync to aliyun:${{ github.event.inputs.images_name }}

env:
DOCKER_USER: ${{ secrets.DOCKER_REGISTRY_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
ALIYUN_USER: ${{ secrets.ALIYUN_REGISTRY_USER }}
ALIYUN_PASSWORD: ${{ secrets.ALIYUN_REGISTRY_PASSWORD }}
ALIYUN_USER_NEW: ${{ secrets.ALIYUN_USER_NEW }}
ALIYUN_PASSWORD_NEW: ${{ secrets.ALIYUN_PASSWORD_NEW }}
ECR_PASSWORD: ${{ secrets.ECR_PASSWORD }}

jobs:
script:
runs-on: macos-latest
Expand All @@ -31,19 +40,21 @@ jobs:
fi
bash ${{ github.workspace }}/.github/utils/skopeo_sync_to_aliyun.sh \
"${{ secrets.DOCKER_USER }}" \
'${{ secrets.DOCKER_PASSWORD }}' \
"${{ secrets.ALIYUN_REGISTRY_USER }}" \
"${{ secrets.ALIYUN_REGISTRY_PASSWORD }}" \
"${{ env.DOCKER_USER }}" \
'${{ env.DOCKER_PASSWORD }}' \
"${{ env.ALIYUN_USER }}" \
"${{ env.ALIYUN_PASSWORD }}" \
${{ github.workspace }}/.github/utils/images-list.txt \
"${{ inputs.registry }}" \
'${{ secrets.ECR_PASSWORD }}'
'${{ env.ECR_PASSWORD }}'
bash ${{ github.workspace }}/.github/utils/skopeo_sync_to_aliyun_new.sh \
"${{ secrets.DOCKER_USER }}" \
'${{ secrets.DOCKER_PASSWORD }}' \
"${{ secrets.ALIYUN_USER_NEW }}" \
"${{ secrets.ALIYUN_PASSWORD_NEW }}" \
${{ github.workspace }}/.github/utils/images-list.txt \
"${{ inputs.registry }}" \
'${{ secrets.ECR_PASSWORD }}'
if [[ -n "${{ env.ALIYUN_USER_NEW }}" && -n "${{ env.ALIYUN_PASSWORD_NEW }}" ]]; then
bash ${{ github.workspace }}/.github/utils/skopeo_sync_to_aliyun_new.sh \
"${{ env.DOCKER_USER }}" \
'${{ env.DOCKER_PASSWORD }}' \
"${{ env.ALIYUN_USER_NEW }}" \
"${{ env.ALIYUN_PASSWORD_NEW }}" \
${{ github.workspace }}/.github/utils/images-list.txt \
"${{ inputs.registry }}" \
'${{ env.ECR_PASSWORD }}'
fi
Loading

0 comments on commit e5c8bb6

Please sign in to comment.