From 262c25c151e6d4873491b9b4ea480fa65e9ccdd2 Mon Sep 17 00:00:00 2001 From: zyy17 Date: Thu, 12 Oct 2023 00:37:49 +0800 Subject: [PATCH] ci: fix skopeo auth error --- .../actions/release-cn-artifacts/action.yaml | 65 ++++++++++--------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/.github/actions/release-cn-artifacts/action.yaml b/.github/actions/release-cn-artifacts/action.yaml index 653d6a269462..565524bef68f 100644 --- a/.github/actions/release-cn-artifacts/action.yaml +++ b/.github/actions/release-cn-artifacts/action.yaml @@ -63,38 +63,6 @@ inputs: runs: using: composite steps: - - name: Install skopeo - shell: bash - run: | - sudo apt update && sudo apt install -y skopeo - - - name: Push images from Dockerhub to ACR - shell: bash - run: | - skopeo copy -a docker://docker.io/${{ inputs.image-namespace }}/${{ inputs.image-name }}:${{ inputs.version }} \ - --dest-creds "${{ inputs.image-registry-username }}":"${{ inputs.image-registry-password }}" \ - docker://${{ inputs.image-registry }}/${{ inputs.image-namespace }}/${{ inputs.image-name }}:${{ inputs.version }} - - if [[ "${{ inputs.dev-mode }}" == "false" ]]; then - skopeo copy -a docker://docker.io/${{ inputs.image-namespace }}/${{ inputs.image-name }}:${{ inputs.version }} \ - --dest-creds "${{ inputs.image-registry-username }}":"${{ inputs.image-registry-password }}" \ - docker://${{ inputs.image-registry }}/${{ inputs.image-namespace }}/${{ inputs.image-name }}-centos:${{ inputs.version }} - fi - - - name: Push latest images from Dockerhub to ACR - shell: bash - if: ${{ inputs.push-latest-tag == 'true' }} - run: | - skopeo copy -a docker://docker.io/${{ inputs.image-namespace }}/${{ inputs.image-name }}:${{ inputs.version }} \ - --dest-creds "${{ inputs.image-registry-username }}":"${{ inputs.image-registry-password }}" \ - docker://${{ inputs.image-registry }}/${{ inputs.image-namespace }}/${{ inputs.image-name }}:latest - - if [[ "${{ inputs.dev-mode }}" == "false" ]]; then - skopeo copy -a docker://docker.io/${{ inputs.image-namespace }}/${{ inputs.image-name }}:${{ inputs.version }} \ - --dest-creds "${{ inputs.image-registry-username }}":"${{ inputs.image-registry-password }}" \ - docker://${{ inputs.image-registry }}/${{ inputs.image-namespace }}/${{ inputs.image-name }}-centos:latest - fi - - name: Download artifacts uses: actions/download-artifact@v3 with: @@ -136,3 +104,36 @@ runs: command: | echo "${{ inputs.version }}" > ${{ inputs.artifacts-dir }}/latest-version.txt && \ aws cp ${{ inputs.artifacts-dir }}/latest-version.txt s3://${{ inputs.aws-cn-s3-bucket }}/releases/greptimedb/latest-version.txt + + - name: Push images from Dockerhub to ACR + shell: bash + env: + DST_REGISTRY_USERNAME: ${{ inputs.image-registry-username }} + DST_REGISTRY_PASSWORD: ${{ inputs.image-registry-password }} + run: | + docker run quay.io/skopeo/stable:latest copy -a docker://docker.io/${{ inputs.image-namespace }}/${{ inputs.image-name }}:${{ inputs.version }} \ + --dest-creds "$DST_REGISTRY_USERNAME":"$DST_REGISTRY_PASSWORD" \ + docker://${{ inputs.image-registry }}/${{ inputs.image-namespace }}/${{ inputs.image-name }}:${{ inputs.version }} + + if [[ "${{ inputs.dev-mode }}" == "false" ]]; then + docker run quay.io/skopeo/stable:latest copy -a docker://docker.io/${{ inputs.image-namespace }}/${{ inputs.image-name }}:${{ inputs.version }} \ + --dest-creds "$DST_REGISTRY_USERNAME":"$DST_REGISTRY_PASSWORD" \ + docker://${{ inputs.image-registry }}/${{ inputs.image-namespace }}/${{ inputs.image-name }}-centos:${{ inputs.version }} + fi + + - name: Push latest images from Dockerhub to ACR + shell: bash + if: ${{ inputs.push-latest-tag == 'true' }} + env: + DST_REGISTRY_USERNAME: ${{ inputs.image-registry-username }} + DST_REGISTRY_PASSWORD: ${{ inputs.image-registry-password }} + run: | + docker run quay.io/skopeo/stable:latest copy -a docker://docker.io/${{ inputs.image-namespace }}/${{ inputs.image-name }}:${{ inputs.version }} \ + --dest-creds "$DST_REGISTRY_USERNAME":"$DST_REGISTRY_PASSWORD" \ + docker://${{ inputs.image-registry }}/${{ inputs.image-namespace }}/${{ inputs.image-name }}:latest + + if [[ "${{ inputs.dev-mode }}" == "false" ]]; then + docker run quay.io/skopeo/stable:latest copy -a docker://docker.io/${{ inputs.image-namespace }}/${{ inputs.image-name }}:${{ inputs.version }} \ + --dest-creds "$DST_REGISTRY_USERNAME":"$DST_REGISTRY_PASSWORD" \ + docker://${{ inputs.image-registry }}/${{ inputs.image-namespace }}/${{ inputs.image-name }}-centos:latest + fi