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..5106b5f --- /dev/null +++ b/registry-image-sync/readme.md @@ -0,0 +1,25 @@ +# 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: + - 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 }} +```