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 --compat-auth-file to login and logout #20621

Merged
merged 3 commits into from
Nov 17, 2023

Conversation

mtrmac
Copy link
Collaborator

@mtrmac mtrmac commented Nov 7, 2023

Add --compat-auth-file to login/logout, allowing to update Docker-compatible files.

This mostly inherits the feature from c/common/pkg/auth.

Completely untested at this point.

TBD tests that the updated files can be correctly consumed by Docker.

Fixes: #18617 (users will need to switch to the new option)

Does this PR introduce a user-facing change?

`login` and `logout` now support editing Docker-compatible config files, using a `--compat-auth-file` option.

@openshift-ci openshift-ci bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note labels Nov 7, 2023
Copy link
Contributor

openshift-ci bot commented Nov 7, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mtrmac

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 Nov 7, 2023
Copy link

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

@mtrmac
Copy link
Collaborator Author

mtrmac commented Nov 10, 2023

Manually smoke-tested operation and interoperability with

# docker pull localhost:5000/foo
Using default tag: latest
Error response from daemon: Head "http://localhost:5000/v2/foo/manifests/latest": no basic auth credentials
# bin/podman login --tls-verify=false --compat-auth-file ~/.docker/config.json localhost:5000
Username: …
Password: 
Login Succeeded!
# docker pull localhost:5000/foo
Using default tag: latest
Error response from daemon: manifest for localhost:5000/foo:latest not found: manifest unknown: manifest unknown
# bin/podman logout --compat-auth-file ~/.docker/config.json localhost:5000
Removed login credentials for localhost:5000
# docker pull localhost:5000/foo
Using default tag: latest
Error response from daemon: Head "http://localhost:5000/v2/foo/manifests/latest": no basic auth credentials

@mtrmac mtrmac force-pushed the docker-compat-login branch from 3fd29ec to ebd50ae Compare November 10, 2023 02:56
setup := SystemExec("bash", []string{"-c", "systemctl status docker 2>&1"})

if setup.LineInOutputContains("Active: inactive") {
setup = SystemExec("systemctl", []string{"start", "docker"})
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So far it seems that this test always skips, because docker is not installed on our CI systems. If so, I should just rip this untested code out.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I have dropped that.

@mtrmac
Copy link
Collaborator Author

mtrmac commented Nov 16, 2023

For the record, in case I am not around: containers/buildah#5143 needs to be merged first, and then the DO NOT MERGE: Use bud tests from UNMERGED buildah commit needs to be dropped. Other than that (and presumably merge conflicts on go.*), this is ready to go.

@mtrmac mtrmac force-pushed the docker-compat-login branch from 4b516ca to 07fe0ad Compare November 17, 2023 04:46
@mtrmac mtrmac changed the title WIP: Add --compat-auth-file to login and logout Add --compat-auth-file to login and logout Nov 17, 2023
@mtrmac mtrmac marked this pull request as ready for review November 17, 2023 04:46
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 17, 2023
@mtrmac
Copy link
Collaborator Author

mtrmac commented Nov 17, 2023

Hopefully mergeable now. Cc: @TomSweeneyRedHat

@Luap99
Copy link
Member

Luap99 commented Nov 17, 2023

@mtrmac Bud tests are failing, looks like the error text differs.

This mostly just inherits the c/common/pkg/auth implementation,
except that AuthFilePath and DockerCompatAuthFilePath can not be set
simultaneously, so don't unnecessarily explicitly set AuthFilePath.
c/common already handles that.

Signed-off-by: Miloslav Trmač <[email protected]>
@mtrmac mtrmac force-pushed the docker-compat-login branch from 07fe0ad to d0b3225 Compare November 17, 2023 15:44
@mtrmac
Copy link
Collaborator Author

mtrmac commented Nov 17, 2023

@mtrmac Bud tests are failing, looks like the error text differs.

If I understand that correctly, I need to vendor Buildah’s main with updated tests. Done, let’s see…

@TomSweeneyRedHat
Copy link
Member

LGTM

@TomSweeneyRedHat
Copy link
Member

@mheon this seems to be taking forever and then some. Is that expected?

@mheon
Copy link
Member

mheon commented Nov 17, 2023

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 17, 2023
@openshift-merge-bot openshift-merge-bot bot merged commit a6bb601 into containers:main Nov 17, 2023
93 checks passed
@mtrmac mtrmac deleted the docker-compat-login branch November 18, 2023 20:25
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Feb 17, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
4.8 approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression in 4.4 and 4.5: podman login can no longer be used with docker-compose
4 participants