-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
147 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: autotest | ||
|
||
on: | ||
push: {} | ||
pull_request: {} | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.after }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test_sync_job: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Run docker registry | ||
run: docker run -d -p 5000:5000 --restart=always --name registry registry:2 | ||
- uses: ./ | ||
with: | ||
auth_file: ./.github/workflows/test-auth.yaml | ||
images_file: ./.github/workflows//test-images.yaml | ||
env: | ||
TEST_PASSWORD: ${{ secrets.TEST_PASSWORD }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: check | ||
|
||
on: | ||
push: {} | ||
pull_request: {} | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.after }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
shellcheck: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: ludeeus/[email protected] | ||
env: | ||
SHELLCHECK_OPTS: -e SC2236,SC2162,SC2268 | ||
with: | ||
ignore: tests | ||
|
||
super-linter: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Lint Code Base | ||
uses: github/[email protected] | ||
env: | ||
VALIDATE_ALL_CODEBASE: true | ||
VALIDATE_MARKDOWN: true | ||
LINTER_RULES_PATH: .github | ||
MARKDOWN_CONFIG_FILE: .markdown-lint.yml | ||
VALIDATE_MD: true | ||
DEFAULT_BRANCH: main | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
FILTER_REGEX_EXCLUDE: .github/.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
localhost:5000: | ||
insecure: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
quay.io/operator-framework/olm:v0.18.3: "localhost:5000/image-syncer-test/olm" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Image Sync Action | ||
|
||
- Use [image-syncer](https://github.com/AliyunContainerService/image-syncer) to Sync images between docker registries. | ||
|
||
## Examples | ||
|
||
#### Typical Use Case | ||
|
||
```yaml | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- uses: hhyasdf/image-sync-action@v1 | ||
with: | ||
auth_file: ./test-auth.yaml # The auth information file of registries, optional. | ||
images_file: ./test-images.yaml # The images need to sync, always needed. | ||
version: latest # The version of image-syncer, use the latest version if not specified. | ||
proc: 6 # The max number of goroutines to sync images, default value is 5. | ||
env: | ||
TEST_PASSWORD: ${{ secrets.TEST_PASSWORD }} # For safty consideration, passing registry password by github action secrets is needed. | ||
``` | ||
To use the `TEST_PASSWORD` environment variable as a paasword, the auth file needs to include something like: | ||
|
||
```yaml | ||
registry.cn-beijing.aliyuncs.com: | ||
username: test | ||
password: ${TEST_PASSWORD} | ||
``` | ||
|
||
For more information of how to create an auth file or images file, refer to the [image-syncer configure files](https://github.com/AliyunContainerService/image-syncer/blob/master/README.md#configure-files). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: "Image Sync Action" | ||
description: "Automatically sync conatiner images between registries through Github Action" | ||
inputs: | ||
version: | ||
description: "The version of image-syncer" | ||
default: "latest" | ||
required: false | ||
auth_file: | ||
description: "The --auth parameter of image-syncer, auth file path. This flag need to be pair used with --images" | ||
required: false | ||
images_file: | ||
description: "The --images parameter of image-syncer, images file path. This flag need to be pair used with --auth" | ||
default: "./images.yaml" | ||
required: true | ||
default_namespace: | ||
description: "The --namespace parameter of image-syncer, default destination namespace when destination namespace is not given in the config file, can also be set with DEFAULT_NAMESPACE environment value" | ||
required: false | ||
default_registry: | ||
description: "The --registry parameter of image-syncer, default destination registry url when destination registry is not given in the config file, can also be set with DEFAULT_REGISTRY environment value" | ||
required: false | ||
arch: | ||
description: "The --arch parameter of image-syncer, architecture list to filter source tags, not works for OCI media" | ||
required: false | ||
os: | ||
description: "The --os parameter of image-syncer, os list to filter source tags, not works for docker v2 schema1 and OCI media" | ||
required: false | ||
proc: | ||
description: "The --proc parameter of image-syncer, numbers of working goroutines (default 5)" | ||
default: 5 | ||
required: false | ||
retries: | ||
description: "The --retries parameter of image-syncer, times to retry failed task (default 2)" | ||
default: 2 | ||
required: false | ||
runs: | ||
using: "composite" | ||
steps: | ||
- id: download | ||
run: ${{ github.action_path }}/download.sh ${{ inputs.version }} | ||
shell: bash | ||
- id: excute | ||
run: ./image-syncer --auth=${{ inputs.auth_file }} --images=${{ inputs.images_file }} --namespace=${{ inputs.default_namespace }} --registry=${{ inputs.default_registry }} --arch=${{ inputs.arch }} --os=${{ inputs.os }} --proc=${{ inputs.proc }} --retries=${{ inputs.retries }} | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
target_tag=$(curl --silent "https://api.github.com/repos/AliyunContainerService/image-syncer/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') | ||
|
||
if [ "${1}" != "latest" ]; then | ||
target_tag=${1} | ||
fi | ||
|
||
wget https://github.com/AliyunContainerService/image-syncer/releases/download/"${target_tag}"/image-syncer-"${target_tag}"-linux-amd64.tar.gz | ||
|
||
tar -xvf image-syncer-"${target_tag}"-linux-amd64.tar.gz |