Skip to content

Checking for multiple registries when login/logout - #24888

Closed
lslavkov wants to merge 1 commit into
podman-container-tools:mainfrom
lslavkov:lslavkov-22400
Closed

lslavkov wants to merge 1 commit into
podman-container-tools:mainfrom
lslavkov:lslavkov-22400

Conversation

@lslavkov

Copy link
Copy Markdown

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

@openshift-ci

openshift-ci Bot commented Dec 21, 2024

Copy link
Copy Markdown
Contributor

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.

Details

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
@packit-as-a-service

Copy link
Copy Markdown

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

rhatdan commented Dec 23, 2024

Copy link
Copy Markdown
Contributor

Please rebase and squash your commit.

Thanks for the PR.

@rhatdan

rhatdan commented Dec 23, 2024

Copy link
Copy Markdown
Contributor

/approve

@openshift-ci

openshift-ci Bot commented Dec 23, 2024

Copy link
Copy Markdown
Contributor

[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

Details 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 <slavkovic.lazar96@gmail.com>

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

Copy link
Copy Markdown
Author

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

@rhatdan

rhatdan commented Jan 2, 2025

Copy link
Copy Markdown
Contributor

Any chance you could add a test?

@lslavkov

lslavkov commented Jan 3, 2025

Copy link
Copy Markdown
Author

Could try but no promises.

@lslavkov

lslavkov commented Jan 6, 2025

Copy link
Copy Markdown
Author

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

@mheon

mheon commented Jan 7, 2025

Copy link
Copy Markdown
Contributor

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

@Luap99 Luap99 left a comment

Copy link
Copy Markdown
Member

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 thread cmd/podman/login.go
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
Copy Markdown
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

@lslavkov lslavkov Jan 9, 2025 •

Copy link
Copy Markdown
Author

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
Copy Markdown
Author

/assign

@lslavkov

Copy link
Copy Markdown
Author

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

@Luap99

Luap99 commented Jan 24, 2025

Copy link
Copy Markdown
Member

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.

@lslavkov lslavkov closed this Feb 3, 2025
@stale-locking-app stale-locking-app Bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label May 5, 2025
@stale-locking-app stale-locking-app Bot locked as resolved and limited conversation to collaborators May 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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 locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docker login with docker.io creds "successfully" logs-into registry.fedoraproject.org then fails to push to registry-1.docker.io

5 participants