-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Resolves #13629 Add RegistryAuthHeader to manifest push #13653
Resolves #13629 Add RegistryAuthHeader to manifest push #13653
Conversation
You are either going to need to add a test or add the |
460d0c8
to
677f4b1
Compare
@mtrmac @vrothberg PTAL |
test/e2e/manifest_test.go
Outdated
lock := GetPortLock("5000") | ||
defer lock.Unlock() | ||
|
||
session = podmanTest.Podman([]string{"run", "-d", "-p", "5000:5000", "--name", "registry", "-e", "REGISTRY_AUTH=htpasswd", "-e", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to @containers/podman-maintainers:
We should migrate the tests to be using github.com/containers/podman/v4/hack/podman-registry-go
: https://github.com/containers/podman/blob/main/pkg/bindings/test/auth_test.go#L10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also squash the two commits into one? |
390dae9
to
3d19293
Compare
This now also contains #13651 and the last two steps effectively test it. The last would return zero without the fix @jwmatthews provided. |
I squashed the commits and I think I fixed |
@vrothberg @rhatdan The add commands are working for me locally, but I had to replace podman on the remote machine/vm because of the changes to the handler. https://github.com/containers/podman/pull/13653/files#diff-044d310f157316ea3de231effda8f6822c587dd263482131fc09b6a2c12b0dda Is this accounted for in the tests and I've messed something up, or will there need to be an updated image for the tests somehow? |
There's something else going on with the Handlers. It seems like the v4 create handler is going off for every post request. I'm not sure what to make of it; seems like something is very wrong. |
3d19293
to
f6a1aca
Compare
@@ -271,7 +290,7 @@ func ManifestPushV3(w http.ResponseWriter, r *http.Request) { | |||
utils.Error(w, http.StatusBadRequest, errors.Wrapf(err, "error pushing image %q", query.Destination)) | |||
return | |||
} | |||
utils.WriteResponse(w, http.StatusOK, digest) | |||
utils.WriteResponse(w, http.StatusOK, handlers.IDResponse{ID: digest}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Aligns with swagger now.
@vrothberg Can the migration to hack/podman-registry-go be a follow-on PR? |
I can have a look and try to adapt it for the PR. Hopefully not too hard now that it's working. |
222476e
to
7a4b861
Compare
@@ -36,6 +36,8 @@ do | |||
fi | |||
done | |||
|
|||
cp hack/podman-registry /bin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a better way to do this?
e675746
to
6d9f72c
Compare
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jmontleon, 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 |
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Disclaimer: I’m not very familiar with the HTTP code)
pkg/api/handlers/libpod/manifests.go
Outdated
query.ManifestAddOptions.Authfile = authfile | ||
query.ManifestAddOptions.Username = username | ||
query.ManifestAddOptions.Password = password | ||
query.ManifestAddOptions.All = query.All |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems unrelated to the description of the PR. Is it intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mtrmac Sorry for the stupid question, did you mean specifically the last line here query.ManifestAddOptions.All = query.All
or all of it
query.ManifestAddOptions.Authfile = authfile
query.ManifestAddOptions.Username = username
query.ManifestAddOptions.Password = password
query.ManifestAddOptions.All = query.All
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry, I meant just the .All
line.
(I’m not saying it’s incorrect, or unwanted, I haven’t checked; it just seems unrelated and I can‘t see any mention of that part.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems unnecessary. I removed it and tests are passing. I was working through getting credentials passed through properly and wasn't sure based on looking at the ImagePushOptions for Push whether this should also be added.
pkg/api/handlers/libpod/manifests.go
Outdated
body.ManifestAddOptions.Authfile = authfile | ||
body.ManifestAddOptions.Username = username | ||
body.ManifestAddOptions.Password = password | ||
body.ManifestAddOptions.All = body.All |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems unrelated to the description of the PR. Is it intentional?
Signed-off-by: Jason Montleon <[email protected]>
6d9f72c
to
3cc1739
Compare
/lgtm |
Signed-off-by: Jason Montleon [email protected]