gitlab: Fix commit option in update.py
This commit is contained in:
parent
5e369bab42
commit
06a7ece7bb
|
@ -250,21 +250,19 @@ def update_gitlab_pages():
|
||||||
|
|
||||||
def get_container_registry_version() -> str:
|
def get_container_registry_version() -> str:
|
||||||
"""Returns the version attribute of gitlab-container-registry"""
|
"""Returns the version attribute of gitlab-container-registry"""
|
||||||
return str(
|
return subprocess.check_output(
|
||||||
subprocess.check_output(
|
[
|
||||||
[
|
"nix",
|
||||||
"nix",
|
"--experimental-features",
|
||||||
"--experimental-features",
|
"nix-command",
|
||||||
"nix-command",
|
"eval",
|
||||||
"eval",
|
"-f",
|
||||||
"-f",
|
".",
|
||||||
".",
|
"--raw",
|
||||||
"--raw",
|
"gitlab-container-registry.version",
|
||||||
"gitlab-container-registry.version",
|
],
|
||||||
],
|
cwd=NIXPKGS_PATH,
|
||||||
cwd=NIXPKGS_PATH,
|
).decode("utf-8")
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@cli.command("update-gitlab-shell")
|
@cli.command("update-gitlab-shell")
|
||||||
|
@ -287,16 +285,25 @@ def update_gitlab_workhorse():
|
||||||
|
|
||||||
@cli.command("update-gitlab-container-registry")
|
@cli.command("update-gitlab-container-registry")
|
||||||
@click.option("--rev", default="latest", help="The rev to use (vX.Y.Z-ee), or 'latest'")
|
@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"""
|
"""Update gitlab-container-registry"""
|
||||||
logger.info("Updading gitlab-container-registry")
|
logger.info("Updading gitlab-container-registry")
|
||||||
repo = GitLabRepo(repo="container-registry")
|
repo = GitLabRepo(repo="container-registry")
|
||||||
|
old_container_registry_version = get_container_registry_version()
|
||||||
|
|
||||||
if rev == "latest":
|
if rev == "latest":
|
||||||
rev = next(filter(lambda x: not ("rc" in x or x.endswith("pre")), repo.tags))
|
rev = next(filter(lambda x: not ("rc" in x or x.endswith("pre")), repo.tags))
|
||||||
|
|
||||||
version = repo.rev2version(rev)
|
version = repo.rev2version(rev)
|
||||||
_call_nix_update("gitlab-container-registry", version)
|
_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")
|
@cli.command("update-all")
|
||||||
|
|
Loading…
Reference in a new issue