-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
compat: add layer caching compatiblity for non-podman
clients.
#12381
compat: add layer caching compatiblity for non-podman
clients.
#12381
Conversation
@stac47 Could you please try this with |
584ad53
to
0ba5007
Compare
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.
LGTM, thank you @flouthoc
0ba5007
to
c05d8c2
Compare
Hi, |
@flouthoc, it looks like tests break. I did not check but suspect that the libpod endpoint is calling the same handler, so we may need to make setting the default conditional (i.e., do not set for libpod calls). |
LGTM once tests go green, and concur that @vrothberg is on the right track on the cause of the failures |
c05d8c2
to
6fed507
Compare
@vrothberg ackd then i guess previous version of commit should handle this, which only sets it |
// if layers field not set assume its not from a valid podman-client | ||
// could be a docker client, set `layers=true` since that is the default | ||
// expected behviour | ||
if _, found := r.URL.Query()["layers"]; !found { |
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.
That's not enough. We need to check whether the handler was called via libpod or compat. Otherwise we depend on behavior that may change.
Wrap that into if !utils.IsLibpodRequest(r) { ..}
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.
Why should layers not default to true in the libpod API? podman build defaults to true so should the API IMO.
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.
@Luap99 i guess because podman-remote
has a option to configure it as false
so we must honor it.
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.
@vrothberg ackd.
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.
We will always honor it, this is just the default.
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.
@vrothberg @mheon Why should the API have a different default then the podman cli?
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.
Tests broke so there is an expectation on these libpod defaults. Changing them seems like a separate issue to me.
@flouthoc Can you please document that parameter in the swagger doc. It looks like |
Non-podman clients do not set `layers` while making request. This is supposed to be `true` bydefault but `non-podman-clients i.e Docker` dont know about this field as a result they end up setting this values to `false`. Causing builds to never use cache for layers. Adds compatiblity for `docker SDK`. [NO NEW TESTS NEEDED] Signed-off-by: Aditya Rajan <arajan@redhat.com>
Add missing `layer` entry to swagger docs for `/build`. Signed-off-by: Aditya Rajan <arajan@redhat.com>
6fed507
to
13ee178
Compare
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.
LGTM
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: flouthoc, 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 |
/hold cancel |
Non podman clients do not set
layers
while making request. This issupposed to be
true
by default butnon-podman-clients i.e Docker
dontknow about this field as a result they end up setting this value to
false
. Causing builds to never use cache for layers.Adds compatibility for
non-podman (docker SDK)
.[NO NEW TESTS NEEDED]
Cant find any convenient way to add a new test for this via podman client.
Closes: #12378