Commit 69a66605 authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

feat: force update release only on latest

parent d3d6c0a3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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                                                                                 |
+4 −4
Original line number Diff line number Diff line
@@ -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",