Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions registry-image-sync/action.yaml
Original file line number Diff line number Diff line change
@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
required: true
required: false
default: ghcr.io/scality

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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: "the username in destination registry"
description: "the username in destination registry"
default: ${{ github.actor }}

DEST_PASSWORD:
description: "the password in destination registry"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: "the password in destination registry"
description: "the password in destination registry"
default: ${{ github.token }}



runs:
using: "composite"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of making it a composite action, make it a docker one. Removing the need to ask users to use the proper container image and giving you more control over the environment.

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 }}
25 changes: 25 additions & 0 deletions registry-image-sync/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Overview

This action helps to sync images between two container registries

# Example

on:
workflow_dispatch:
```yaml
Comment on lines +7 to +9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
on:
workflow_dispatch:
```yaml
```yaml
on:
workflow_dispatch:
# optionally show example with inputs.
inputs:
SOURCE_REPO:
required: true
IMAGE_NAME:
required: true

Then use those vars below.

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: <repo-name> # Ex bert-e
IMAGE_NAME: <image-name> # Ex bert-e
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're making some parameters as required but not mentioning them here, feel free to setup default values for the destination.

SRC_USERNAME: ${{ secrets.<src-username> }}
SRC_PASSWORD: ${{ secrets.<src-password> }}
Comment on lines +21 to +22
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SRC_USERNAME: ${{ secrets.<src-username> }}
SRC_PASSWORD: ${{ secrets.<src-password> }}
SRC_USERNAME: ${{ secrets.REGISTRY_LOGIN }}
SRC_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}

DEST_USERNAME: ${{ github.repository_owner }}
DEST_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
```