Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker: add registry option #754

Merged
merged 7 commits into from
Nov 15, 2023
Merged

Conversation

mdonadoni
Copy link
Member

@mdonadoni mdonadoni commented Oct 24, 2023

  • utils: remove unused code
  • docker-push: add registry option
  • docker-push: add image-name option
  • release-docker: add registry option
  • docker-build: add platform option
  • release-docker: add platform option

Closes #752

@mdonadoni mdonadoni changed the title release docker docker: add registry option Oct 24, 2023
@codecov
Copy link

codecov bot commented Oct 24, 2023

Codecov Report

Merging #754 (fc70577) into master (adad9f0) will decrease coverage by 0.38%.
The diff coverage is 0.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #754      +/-   ##
==========================================
- Coverage   18.99%   18.61%   -0.38%     
==========================================
  Files          26       26              
  Lines        2290     2326      +36     
==========================================
- Hits          435      433       -2     
- Misses       1855     1893      +38     
Files Coverage Δ
reana/reana_dev/cli.py 0.00% <ø> (ø)
reana/reana_dev/utils.py 38.08% <0.00%> (-0.23%) ⬇️
reana/reana_dev/docker.py 0.00% <0.00%> (ø)
reana/reana_dev/release.py 0.00% <0.00%> (ø)

@mdonadoni mdonadoni marked this pull request as ready for review October 25, 2023 09:05
Copy link
Member

@giuseppe-steduto giuseppe-steduto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just left a couple of cosmetic comments!

@docker_commands.command(name="docker-push")
def docker_push(user, tag, component): # noqa: D301
def docker_push(user, tag, component, registry, image_name): # noqa: D301
"""Push REANA component images to DockerHub.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: this docstring should be amended to specify that DockerHub is not the only registry to which the image can be pushed, and to include the registry and image_name parameters.

Comment on lines +115 to +139
if image_name and len(components) > 1:
click.secho("Cannot use custom image name with multiple components.", fg="red")
sys.exit(1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: maybe we could add this check also in the docker_push function? It could be helpful when calling it directly from the docker-push command.

@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
"""Release a component on Docker Hub.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: same comment as above for the docstring

Copy link
Member

@tiborsimko tiborsimko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works nicely on Linux and macOS with Podman. Left some cosmetic comments.

@click.option(
"--platform",
multiple=True,
help="Platforms for multi-arch images",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to specify [default=linux/amd64] i.e. the default value for the platform. If it can be detected easily, we could print the actual value. Otherwise we can simply print "[current architecture]".

Also, it would be nice to modify top-level help to add the release example i.e. --platform linux/amd64 --platform linux/arm64. Currently we have there the following:

$ reana-dev --help
...
  How to release and push cluster component images:

  .. code-block:: console

          $ reana-dev git-clean
          $ reana-dev docker-build --no-cache
          $ # we should now run one more test with non-cached ``latest``
          $ # once it works, we can tag and push
          $ reana-dev docker-build -t 0.3.0.dev20180625
          $ reana-dev docker-push -t 0.3.0.dev20180625
          $ # we should now publish stable helm charts for tag via chartpress

@@ -84,10 +85,21 @@ 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(
"--registry", "-r", default="docker.io", help="Registry to use in the image tag"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to specify in the help string [default=docker.io] explicitly, as we do for [reanahub] the user name.

@@ -105,21 +117,85 @@ def release_docker(ctx, component, user, image_name): # noqa: D301
to include several runable REANA demo examples;
* (7) special value 'ALL' that will expand to include
all REANA repositories.
:param user: Organisation or user name. [default=reanahub]
:param image_name: Custom name of the local Docker image.
:param registry: Registry to use in the image tag.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add to the docstring [default=docker.io]

@mdonadoni mdonadoni merged commit fc70577 into reanahub:master Nov 15, 2023
14 checks passed
@mdonadoni mdonadoni deleted the release-docker branch November 15, 2023 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ci: build and push docker images
3 participants