-
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,build: pull must accept string #18583
compat,build: pull must accept string #18583
Conversation
4dddbcd
to
293f51f
Compare
LGTM, but a possible breaking change |
pullPolicy = pullPolicyMap[query.PullPolicy] | ||
} else { | ||
if _, found := r.URL.Query()["pull"]; found { | ||
if query.Pull { | ||
pullPolicy = buildahDefine.PullAlways | ||
} | ||
pullPolicy = pullPolicyMap[query.Pull] |
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.
Both cases do not seem to validate the input at all? If no match is found in the map the pullPolicy will be empty instead of returning error when an invalid value is specified.
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.
Added a case to handle this.
64e6b8f
to
2c65cae
Compare
if foundPolicy { | ||
pullPolicy = policyFromMap | ||
} else { | ||
utils.BadRequest(w, "pull", query.Pull, fmt.Errorf("invalid pull policy: %q", query.Pull)) |
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.
missing return statement, and just guessing but I think the linter would love to see a switch case here but CI will tell you that anyway.
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.
Yes linter was unhappy and suggested a switch case here, amend and repushed.
2c65cae
to
1c89ce6
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
1c89ce6
to
c5f13a4
Compare
`pull` parameter in `build` must accept string just like docker. Ref: https://docs.docker.com/engine/api/v1.42/#tag/Image/operation/ImageBuild Closes: containers#17778 Signed-off-by: Aditya R <arajan@redhat.com>
c5f13a4
to
5b148a0
Compare
To be 100% clear, this isn't a breaking change because the query parameters used "true" and "false" for bools, which still are handled properly, right? |
/approve |
[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 |
@mheon Yes |
pull
parameter inbuild
must accept string just like docker.Ref: https://docs.docker.com/engine/api/v1.42/#tag/Image/operation/ImageBuild
Closes: #17778
Does this PR introduce a user-facing change?