-
Notifications
You must be signed in to change notification settings - Fork 0
PTFE-687: action to sync two registries #88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | ||||||||
| 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" | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| DEST_PASSWORD: | ||||||||
| description: "the password in destination registry" | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
|
|
||||||||
|
|
||||||||
| runs: | ||||||||
| using: "composite" | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 }} | ||||||||
| 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
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 | ||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||
| DEST_USERNAME: ${{ github.repository_owner }} | ||||||||||||||||||||||||||||
| DEST_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.