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

Checking for multiple registries when login/logout #24888

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lslavkov
Copy link

Creating a check for podman login if there is a multiple registries in the registry.conf to avoid any issues where credential getting replaced by docker login

Fixes #22400

Copy link
Contributor

openshift-ci bot commented Dec 21, 2024

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-ci openshift-ci bot added the do-not-merge/release-note-label-needed Enforce release-note requirement, even if just None label Dec 21, 2024
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 21, 2024
Copy link

Ephemeral COPR build failed. @containers/packit-build please check.

@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 21, 2024
@rhatdan
Copy link
Member

rhatdan commented Dec 23, 2024

Please rebase and squash your commit.

Thanks for the PR.

@rhatdan
Copy link
Member

rhatdan commented Dec 23, 2024

/approve

Copy link
Contributor

openshift-ci bot commented Dec 23, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lslavkov, rhatdan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 23, 2024
Signed-off-by: Lazar Slavković-Raco <[email protected]>

# Conflicts:
#	cmd/podman/login.go
#	cmd/podman/logout.go
@lslavkov
Copy link
Author

@rhatdan I was able to squash it but my commit description got messed up. Hope that is nothing groundbreaking issue

@rhatdan
Copy link
Member

rhatdan commented Jan 2, 2025

Any chance you could add a test?

@lslavkov
Copy link
Author

lslavkov commented Jan 3, 2025

Could try but no promises.

@lslavkov
Copy link
Author

lslavkov commented Jan 6, 2025

@rhatdan should I create separate file for this test or adding additional test case in test/e2e/login_logout_test.go?

@mheon
Copy link
Member

mheon commented Jan 7, 2025

@lslavkov Existing login_logout_test file is the preferred place, thanks!

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

IMO this is a breaking change and shouldn't be done without a major version. And if we want this then I think it needs to go into c/common so we can make skopeo and buildah match the behavior.

Comment on lines +103 to +106
registriesFromFile, _ := sysregistriesv2.UnqualifiedSearchRegistries(sysCtx)
if len(registriesFromFile) > 1 {
return errors.New("multiple registries in registry.conf, a registry must be provided")
}
Copy link
Member

Choose a reason for hiding this comment

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

This is a breaking change so we cannot accept this until a 6.0 IMO.
And most importantly this code is broken. You always reject more than one registry even if one was specifed as argument on the cli (in the args array)

Any the login code seem shared between buildah and skopeo as well so if we decide to fix this we should fix this for all in https://github.com/containers/common/blob/main/pkg/auth/auth.go

And if you look into that code you see there is already an AcceptUnspecifiedRegistry option which is quite whay you do here but it we can add another case there for this new behavior.
https://github.com/containers/common/blob/514bf04d8e6a6ac19b71147b534875ca8001785f/pkg/auth/auth.go#L137

Copy link
Author

@lslavkov lslavkov Jan 9, 2025

Choose a reason for hiding this comment

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

So if I understand correctly that registriesFromFile is gonna fail regardless if we add which registry we wish to login?

I understand your point now. The approach there is more elegant that this one. Do you want me to modify to something similar to that? https://github.com/containers/common/blob/514bf04d8e6a6ac19b71147b534875ca8001785f/pkg/auth/auth.go#L137

@lslavkov
Copy link
Author

/assign

@lslavkov
Copy link
Author

@Luap99 should I close this PR and redirect my focus to the c/common?

@Luap99
Copy link
Member

Luap99 commented Jan 24, 2025

I think it would be best to add this in c/common behind a new option yes.
Then we can update it in the callers by setting that new option. I still think such a change can be breaking so likely something that should wait for a major version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/release-note-label-needed Enforce release-note requirement, even if just None
Projects
None yet
5 participants