diff --git a/README.md b/README.md index 2e923fbbebc2138a324119e44d2844bc46e20d8d..0d99aad8bb84c6cb0d945dbf82ed782ebf5c00fc 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ options: maximum visibility of projects in destination group --exclude EXCLUDE project/group path to exclude from processing (relative to --src-sync-path) --insecure skip SSL verification - --update-release force update the releases even when they exist + --update-release force the update of the latest release --update-avatar force update the avatar images even when they exist and look the same --no-group-description don't synchronize group description @@ -60,7 +60,7 @@ options: | `--max-visibility` | `$MAX_VISIBILITY` | maximum visibility of projects in destination group (defaults to `public`) | | `--exclude` | `$EXCLUDE` | project/group path(s) to exclude (multiple CLI option; env. variable is a coma separated list) | | `--insecure` | `$INSECURE` | skip SSL verification | -| `--update-release` | `$UPDATE_RELEASE` | set to update the releases even if they exists | +| `--update-release` | `$UPDATE_RELEASE` | set to force the update of the latest release (in order to trigger GitLab CI/CD catalog publication) | | `--update-avatar` | `$UPDATE_AVATAR` | force update the avatar images even when they exist and look the same | | `--no-group-description` | `$GROUP_DESCRIPTION_DISABLED` | don't synchronize group description | | `--no-project-description` | `$PROJECT_DESCRIPTION_DISABLED` | don't synchronize project description | diff --git a/gitlab_cp/sync.py b/gitlab_cp/sync.py index c6c8738faaef5bd50f3deccd34dcdfbd33299bb9..2e278d2489ace14ca5b5ee0607d44ad5363a49d5 100644 --- a/gitlab_cp/sync.py +++ b/gitlab_cp/sync.py @@ -86,7 +86,7 @@ class Synchronizer: self.work_dir = work_dir self.max_visibility = max_visibility self.exclude = exclude or [] - self.update_release = update_release + self.force_update_latest_release = update_release self.group_description = group_description self.project_description = project_description self.dry_run = dry_run @@ -175,7 +175,7 @@ class Synchronizer: src_releases = src_project.releases.list(all=True) print(f" - sync {len(src_releases)} releases...") dest_releases = dest_project.releases.list(all=True) - for src_release in src_releases: + for idx, src_release in enumerate(src_releases): tag_name: str = src_release.tag_name dest_release = next( filter( @@ -210,7 +210,7 @@ class Synchronizer: ge, ) self.handle_error(ge) - elif self.update_release: + elif idx == 0 and self.force_update_latest_release: if self.dry_run: print( f" - {tag_name}: {AnsiColors.HYELLOW}update needed{AnsiColors.RESET} (force)" @@ -755,7 +755,7 @@ def run(): "--update-release", default=os.getenv("UPDATE_RELEASE") is not None, action="store_true", - help="force update the releases even when they exist", + help="force the update of the latest release", ) parser.add_argument( "--update-avatar",