
# regsync Usages

```text
Usage:
  regsync-cloud [command]

Available Commands:
  check       processes each sync command once but skip actual copy
  once        processes each sync command once

Flags:
  -c, --config string        Config file
      --cloud  bool          Use cloud config template
```

The `check` command is useful for reporting any stale images that need to be updated.

The `once` command can be placed in a cron or CI job to perform the synchronization immediately rather than following the schedule.

# Configuration File

The `regsync-cloud` configuration file is yaml formatted with the following layout:

```yaml
repositorySets:
  commonRepositories:
  - name: test-temp/busybox
    source: docker.io/busybox
    tags:
      allow:
        - "1.33.1"
targetRegistries:
  - name: 385595570414.dkr.ecr.us-west-1.amazonaws.com
    type: ECR
    includeRepositorySets:
      - commonRepositories
  - name: 385595570414.dkr.ecr.us-west-2.amazonaws.com
    type: ECR
    repositories:
      - name: test-temp/busybox
        source: docker.io/busybox
        tags:
          allow:
            - "1.34.1"
  - name: gcr.io
    project: pingcap-public
    type: GCR
#    includeRepositorySets:
#      - commonRepositories
    repositories:
      - name: test-temp/busybox
        source: docker.io/busybox
        tags:
          allow:
            - "1.33.1"
            - "1.34.1"
  - name: gcr.io
    project: pingcap-dbaas-build
    type: GCR
    repositories:
      - name: test-temp/busybox
        source: docker.io/busybox
        tags:
          allow:
            - "1.3\\d.\\d+""
            deny:
            - "1.34.1"
  - name: gcr.io
    project: pingcap-gardener
    type: GCR
    repositories:
      - name: test-temp/busybox
        source: docker.io/busybox
        tags:
          allow:
            - "1.34.1"
defaults:
  ratelimit:
    min: 100
    retry: 15m
  parallel: 0
creds:
  - registry: docker.io
```

- `repository`
  - `source`:
    Source registry, repository, or image.
  - `name`:
    Image name in target registry.
  - `tags`:
    Implements filters on tags, regex values are automatically bound to the beginning and ending of each string (`^` and `$`).
    - `allow`:
      (array of strings) regex to allow specific tags.
    - `deny`:
      (array of strings) regex to deny specific tags.

- `repositorySets`:
  `map[string][]repos`, can be referred by `includeRepositorySets`

- `targetRegistries`: 
  List of Registries, which defines image-sync destination

  - `Registry`:
    - `name`: gcr.io
    - `project`: pingcap-gardener, only for gcr type
    - `type`: gcr or ecr supported now 
    - `includeRepositorySets`: List of strings to include `repositorySets`
    - `repositories`: List of `repositories`, only for this registry

- `defaults`:
  Global settings and default values applied to each sync entry
  - `ratelimit`:
    Settings to throttle based on source rate limits.
    - `min`:
      Minimum number of pulls remaining to start the step.
      Actions while running the step can result in going below this limit.
      Note that parallel steps and multi-platform images may each result in more than one pull happening beyond this threshold.
    - `retry`:
      How long to wait before checking if the rate limit has increased.
  - `parallel`:
    Number of concurrent image copies to run.
    All sync steps may be started concurrently to check if a mirror is needed, but will wait on this limit when a copy is needed.
    Defaults to 1.
  




