Skip to content

Commit

Permalink
release-docker: add registry option
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonadoni committed Oct 24, 2023
1 parent f2250ab commit 982a793
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions reana/reana_dev/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,12 @@ def release_commands():
)
@click.option("--user", "-u", default="reanahub", help="DockerHub user name [reanahub]")
@click.option("--image-name", help="Should the component have a custom image name?")
@click.option(

Check warning on line 87 in reana/reana_dev/release.py

View check run for this annotation

Codecov / codecov/patch

reana/reana_dev/release.py#L87

Added line #L87 was not covered by tests
"--registry", "-r", default="docker.io", help="Registry to use in the image tag"
)
@release_commands.command(name="release-docker")
@click.pass_context
def release_docker(ctx, component, user, image_name): # noqa: D301
def release_docker(ctx, component, user, image_name, registry): # noqa: D301

Check warning on line 92 in reana/reana_dev/release.py

View check run for this annotation

Codecov / codecov/patch

reana/reana_dev/release.py#L92

Added line #L92 was not covered by tests
"""Release a component on Docker Hub.
\b
Expand All @@ -113,13 +116,19 @@ def release_docker(ctx, component, user, image_name): # noqa: D301
if not is_component_dockerised(component_):
cannot_release_on_dockerhub.append(component_)
is_component_releasable(component_, exit_code=True, display=True)
full_image_name = f"{user}/{image_name or component_}"
full_image_name = f"{registry}/{user}/{image_name or component_}"

Check warning on line 119 in reana/reana_dev/release.py

View check run for this annotation

Codecov / codecov/patch

reana/reana_dev/release.py#L119

Added line #L119 was not covered by tests
docker_tag = get_docker_tag(component_)
run_command(
f"docker tag {full_image_name}:latest {full_image_name}:{docker_tag}",
component_,
)
ctx.invoke(docker_push, component=[component_], tag=docker_tag, user=user)
ctx.invoke(

Check warning on line 125 in reana/reana_dev/release.py

View check run for this annotation

Codecov / codecov/patch

reana/reana_dev/release.py#L125

Added line #L125 was not covered by tests
docker_push,
component=[component_],
tag=docker_tag,
user=user,
registry=registry,
)

if cannot_release_on_dockerhub:
click.secho(
Expand Down

0 comments on commit 982a793

Please sign in to comment.