sync to docker.io:apecloud-registry.cn-zhangjiakou.cr.aliyuncs.com/apecloud/goldendb-zk:6.1.03.08 #94
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: A skopeo image to dockerhub | |
on: | |
workflow_dispatch: | |
inputs: | |
images_name: | |
description: 'sync image src name (e.g. <namesapce>/<name>:<tag>)' | |
required: false | |
default: '' | |
registry: | |
description: 'sync image src resource registry(e.g. docker.io)' | |
required: false | |
default: 'docker.io' | |
run-name: sync to docker.io:${{ inputs.images_name }} | |
env: | |
DOCKER_REGISTRY_URL: docker.io | |
DOCKER_USER: ${{ secrets.DOCKER_REGISTRY_USER }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_REGISTRY_PASSWORD }} | |
ECR_PASSWORD: ${{ secrets.ECR_PASSWORD }} | |
ALIYUN_USER: ${{ secrets.ALIYUN_REGISTRY_USER }} | |
ALIYUN_PASSWORD: ${{ secrets.ALIYUN_REGISTRY_PASSWORD }} | |
jobs: | |
script: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name : skopeo sync images | |
run: | | |
brew install skopeo | |
skopeo sync -h | |
if [[ -n "${{ inputs.images_name }}" ]];then | |
bash ${{ github.workspace }}/.github/utils/utils.sh \ | |
--type 26 \ | |
--images "${{ inputs.images_name }}" \ | |
--images-list ${{ github.workspace }}/.github/utils/images-list.txt | |
fi | |
- name: check images exists | |
id: check_image_exists | |
continue-on-error: true | |
run: | | |
SKEPEO_TOOL="copy" | |
echo "skopeo-tool=${SKEPEO_TOOL}" >> $GITHUB_OUTPUT | |
IMAGE_NAME="${{ inputs.images_name }}" | |
IMAGE_NAME=${IMAGE_NAME##*/} | |
IMAGE_NAME=${IMAGE_NAME%:*} | |
LIST_IMAGE_NAME="${{ env.DOCKER_REGISTRY_URL }}/apecloud/${IMAGE_NAME}" | |
for i in {1..3}; do | |
LIST_TAGS="$( skopeo list-tags docker://${LIST_IMAGE_NAME} )" | |
if [[ -n "${LIST_TAGS}" ]]; then | |
SKEPEO_TOOL="sync" | |
break | |
fi | |
sleep 1 | |
done | |
echo "skopeo-tool=${SKEPEO_TOOL}" >> $GITHUB_OUTPUT | |
- name: skopeo sync images | |
if: ${{ steps.check_image_exists.outputs.skopeo-tool == 'sync' }} | |
run: | | |
bash ${{ github.workspace }}/.github/utils/skopeo_sync_to_docker.sh \ | |
"${{ env.DOCKER_USER }}" \ | |
'${{ env.DOCKER_PASSWORD }}' \ | |
${{ github.workspace }}/.github/utils/images-list.txt \ | |
"${{ inputs.registry }}" \ | |
'${{ env.ECR_PASSWORD }}' | |
- name: skopeo copy images | |
if: ${{ steps.check_image_exists.outputs.skopeo-tool == 'copy' }} | |
run: | | |
bash ${{ github.workspace }}/.github/utils/skopeo_copy_to_docker.sh \ | |
"${{ env.DOCKER_USER }}" \ | |
'${{ env.DOCKER_PASSWORD }}' \ | |
${{ github.workspace }}/.github/utils/images-list.txt \ | |
"${{ inputs.registry }}" \ | |
'${{ secrets.ECR_PASSWORD }}' |