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

Add tag/untag commands for container repositories #429

Merged
merged 1 commit into from
Feb 2, 2022

Conversation

gerrod3
Copy link
Contributor

@gerrod3 gerrod3 commented Nov 12, 2021

fixes: #423

See issue for discussion around command structure. I would like to have #425 merged first so I can use those commands for creating tests for these commands. I'll update the suppported_workflows.md after I'm done with all the new container commands to avoid merge conflicts.

Copy link
Contributor Author

@gerrod3 gerrod3 left a comment

Choose a reason for hiding this comment

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

Commands are pretty simple, but the main question I have is about their placement. I would like for @pulp/container-plugin to be in consensus so it doesn't have to be changed later.

Comment on lines 81 to 84
VERSION_CONTEXT = PulpContainerRepositoryVersionContext
CAPABILITIES = {
"sync": [PluginRequirement("container")],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If adding/removing tags between the two repository types is supported from different versions of pulp_container then I can add capabilities here. Might be worth to do it anyway since I don't know which version tagging was added in.

Copy link
Member

@lubosmj lubosmj Nov 25, 2021

Choose a reason for hiding this comment

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

Support for tagging manifests within push repositories was added in version 2.3.0 (2021-02-08). According to the pulp-cli docs, we support 5 versions of pulpcore from 3.11-3.16 and 5 of Pulp's plugins: pulp_ansible, pulp_container. Version 2.3.0 falls into the pulpcore requirement when looking at requirements.txt.

Comment on lines 131 to 156
if len(tag) == 0:
raise click.ClickException("Please pass a non empty tag name.")

digest = digest.strip()
if not digest.startswith("sha256:"):
digest = f"sha256:{digest}"
if len(digest) != 71: # len("sha256:" + 64
raise click.ClickException("Improper SHA256, please provide a valid 64 digit digest.")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tried doing some bare minimum checks and leaving the rest to the endpoint's serializer. If there is anything else needed please tell me.

Copy link
Member

Choose a reason for hiding this comment

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

You may also add a validation regex for tags.

For validation purposes, it would be better to have a separate callback (https://click.palletsprojects.com/en/8.0.x/options/#callbacks-for-validation). Do you agree?

@gerrod3 gerrod3 marked this pull request as ready for review January 20, 2022 23:31
Comment on lines 106 to 107
TAG_ID: ClassVar[str] = "repositories_container_container_tag"
UNTAG_ID: ClassVar[str] = "repositories_container_container_untag"
Copy link
Member

Choose a reason for hiding this comment

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

This looks like a rebase is needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are you talking about your new PR refactoring the IDs? #448 I can wait till after it's merged to rebase.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, yes, i get confused what's merged or not.

@gerrod3 gerrod3 force-pushed the tag-container branch 4 times, most recently from 531367a to ba3e164 Compare January 28, 2022 14:47
Comment on lines +45 to +46
if len(value) == 0:
raise click.ClickException("Please pass a non empty tag name.")
Copy link
Member

Choose a reason for hiding this comment

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

FWIW, an empty string would not pass the regex. But i see this check provide a better error condition.

Comment on lines +149 to +150
if not repository_ctx.capable("tag"):
raise click.ClickException(_("pulp_container 2.3.0 is required to tag images"))
Copy link
Member

Choose a reason for hiding this comment

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

(Note for later:) Ha, we should have a needs_capability that raises itself.
Rationale: All mentions of Pulp versions should be in context.py.

@mdellweg mdellweg merged commit 1102389 into pulp:main Feb 2, 2022
@mdellweg mdellweg added this to the 0.14.0 milestone Feb 2, 2022
@ggainey ggainey linked an issue Feb 2, 2022 that may be closed by this pull request
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.

Refactor: add needs_capability to context Add tagging/untagging for container repositories
3 participants