diff options
author | Yaya <mak@nyantec.com> | 2023-05-25 18:20:09 +0000 |
---|---|---|
committer | Yureka <yuka@yuka.dev> | 2023-05-26 08:58:37 +0200 |
commit | 06a7ece7bb739b76eb16eb0f09a794bcb99e955b (patch) | |
tree | 4a7f790d6e3fd5aaf31666c0529686c8c349add3 /pkgs/applications/version-management | |
parent | 5e369bab42b1857b4ca5bd875fde333a73ae241d (diff) |
gitlab: Fix commit option in update.py
Diffstat (limited to 'pkgs/applications/version-management')
-rwxr-xr-x | pkgs/applications/version-management/gitlab/update.py | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/pkgs/applications/version-management/gitlab/update.py b/pkgs/applications/version-management/gitlab/update.py index fa3d06b18ea4d..b513b71b1bba3 100755 --- a/pkgs/applications/version-management/gitlab/update.py +++ b/pkgs/applications/version-management/gitlab/update.py @@ -250,21 +250,19 @@ def update_gitlab_pages(): def get_container_registry_version() -> str: """Returns the version attribute of gitlab-container-registry""" - return str( - subprocess.check_output( - [ - "nix", - "--experimental-features", - "nix-command", - "eval", - "-f", - ".", - "--raw", - "gitlab-container-registry.version", - ], - cwd=NIXPKGS_PATH, - ) - ) + return subprocess.check_output( + [ + "nix", + "--experimental-features", + "nix-command", + "eval", + "-f", + ".", + "--raw", + "gitlab-container-registry.version", + ], + cwd=NIXPKGS_PATH, + ).decode("utf-8") @cli.command("update-gitlab-shell") @@ -287,16 +285,25 @@ def update_gitlab_workhorse(): @cli.command("update-gitlab-container-registry") @click.option("--rev", default="latest", help="The rev to use (vX.Y.Z-ee), or 'latest'") -def update_gitlab_container_registry(rev: str): +@click.option( + "--commit", is_flag=True, default=False, help="Commit the changes for you" +) +def update_gitlab_container_registry(rev: str, commit: bool): """Update gitlab-container-registry""" logger.info("Updading gitlab-container-registry") repo = GitLabRepo(repo="container-registry") + old_container_registry_version = get_container_registry_version() if rev == "latest": rev = next(filter(lambda x: not ("rc" in x or x.endswith("pre")), repo.tags)) version = repo.rev2version(rev) _call_nix_update("gitlab-container-registry", version) + if commit: + new_container_registry_version = get_container_registry_version() + commit_container_registry( + old_container_registry_version, new_container_registry_version + ) @cli.command("update-all") |