From f2a74bd673107c8ffec33ce3101d3cd4a2b418e8 Mon Sep 17 00:00:00 2001 From: Abubakarr Kamara Date: Thu, 27 Jul 2023 18:26:33 +0200 Subject: [PATCH 1/2] PTFE-687: action to sync two registries --- registry-image-sync/action.yaml | 38 +++++++++++++++++++++++++++++++++ registry-image-sync/readme.md | 26 ++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 registry-image-sync/action.yaml create mode 100644 registry-image-sync/readme.md diff --git a/registry-image-sync/action.yaml b/registry-image-sync/action.yaml new file mode 100644 index 0000000..1562fa1 --- /dev/null +++ b/registry-image-sync/action.yaml @@ -0,0 +1,38 @@ +name: "Sync images between two registries" +description: "sync images between two registries using skopeo" + +inputs: + SOURCE_REGISTRY: + description: "the source registry" + required: true + TARGET_REGISTRY: + description: "the target registry" + required: true + IMAGE_NAME: + description: "the name of the image to sync" + SOURCE_REPO: + description: "the source repo that contains the images" + SRC_USERNAME: + description: "the username in the source registry" + SRC_PASSWORD: + description: "the password in source registry" + DEST_USERNAME: + description: "the username in destination registry" + DEST_PASSWORD: + description: "the password in destination registry" + + +runs: + using: "composite" + steps: + - name: Sync images from ${{ inputs.SOURCE_REGISTRY }} to ${{ inputs.TARGET_REGISTRY }} + shell: bash + run: |- + skopeo sync \ + --src docker \ + --dest docker \ + --all \ + --src-creds ${{ inputs.SRC_USERNAME }}:${{ inputs.SRC_PASSWORD }} \ + --dest-creds ${{ inputs.DEST_USERNAME }}:${{ inputs.DEST_PASSWORD }} \ + ${{ inputs.SOURCE_REGISTRY }}/${{ inputs.SOURCE_REPO }}/${{ inputs.IMAGE_NAME }} \ + ${{ inputs.TARGET_REGISTRY }} diff --git a/registry-image-sync/readme.md b/registry-image-sync/readme.md new file mode 100644 index 0000000..c3c79ee --- /dev/null +++ b/registry-image-sync/readme.md @@ -0,0 +1,26 @@ +# Overview + +This action helps to sync images between two container registries + +# Example + +on: + workflow_dispatch: +```yaml +jobs: + cleanup: + runs-on: ubuntu-latest + container: + image: quay.io/skopeo/stable + steps: + - uses: actions/checkout@v3 + - name: Sync images + uses: scality/actions/registry-image-sync + with: + SOURCE_REPO: # Ex bert-e + IMAGE_NAME: # Ex bert-e + SRC_USERNAME: ${{ secrets. }} + SRC_PASSWORD: ${{ secrets. }} + DEST_USERNAME: ${{ github.repository_owner }} + DEST_PASSWORD: ${{ secrets.GITHUB_TOKEN }} +``` From 594c6fe3273025ba98bb7ead22d3ddfab7185f1a Mon Sep 17 00:00:00 2001 From: Abubakarr Kamara Date: Thu, 27 Jul 2023 18:27:58 +0200 Subject: [PATCH 2/2] PTFE-687: removed checkout step --- registry-image-sync/readme.md | 1 - 1 file changed, 1 deletion(-) diff --git a/registry-image-sync/readme.md b/registry-image-sync/readme.md index c3c79ee..5106b5f 100644 --- a/registry-image-sync/readme.md +++ b/registry-image-sync/readme.md @@ -13,7 +13,6 @@ jobs: container: image: quay.io/skopeo/stable steps: - - uses: actions/checkout@v3 - name: Sync images uses: scality/actions/registry-image-sync with: