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

compat,build: pull must accept string #18583

Merged

Conversation

flouthoc
Copy link
Collaborator

pull parameter in build 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?

compat,build: pull must accept string

@openshift-ci openshift-ci bot added release-note approved Indicates a PR has been approved by an approver from all required OWNERS files. labels May 16, 2023
@github-actions github-actions bot added the kind/api-change Change to remote API; merits scrutiny label May 16, 2023
@flouthoc flouthoc force-pushed the compat-pull-accept-string branch from 4dddbcd to 293f51f Compare May 16, 2023 11:10
@umohnani8
Copy link
Member

LGTM, but a possible breaking change

pkg/api/handlers/compat/images_build.go Outdated Show resolved Hide resolved
Comment on lines 581 to 584
pullPolicy = pullPolicyMap[query.PullPolicy]
} else {
if _, found := r.URL.Query()["pull"]; found {
if query.Pull {
pullPolicy = buildahDefine.PullAlways
}
pullPolicy = pullPolicyMap[query.Pull]
Copy link
Member

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.

Copy link
Collaborator Author

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.

@flouthoc flouthoc force-pushed the compat-pull-accept-string branch 2 times, most recently from 64e6b8f to 2c65cae Compare May 16, 2023 14:32
@flouthoc flouthoc requested a review from Luap99 May 16, 2023 14:33
if foundPolicy {
pullPolicy = policyFromMap
} else {
utils.BadRequest(w, "pull", query.Pull, fmt.Errorf("invalid pull policy: %q", query.Pull))
Copy link
Member

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.

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 linter was unhappy and suggested a switch case here, amend and repushed.

@flouthoc flouthoc force-pushed the compat-pull-accept-string branch from 2c65cae to 1c89ce6 Compare May 16, 2023 14:51
Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

LGTM

@flouthoc flouthoc force-pushed the compat-pull-accept-string branch from 1c89ce6 to c5f13a4 Compare May 16, 2023 17:00
`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>
@flouthoc flouthoc force-pushed the compat-pull-accept-string branch from c5f13a4 to 5b148a0 Compare May 16, 2023 17:34
@mheon
Copy link
Member

mheon commented May 16, 2023

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?

@rhatdan
Copy link
Member

rhatdan commented May 16, 2023

/approve
/lgtm
/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 16, 2023
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label May 16, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented May 16, 2023

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@rhatdan
Copy link
Member

rhatdan commented May 16, 2023

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 16, 2023
@openshift-merge-robot openshift-merge-robot merged commit a120184 into containers:main May 16, 2023
@flouthoc
Copy link
Collaborator Author

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?

@mheon Yes

@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 Aug 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2023
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. kind/api-change Change to remote API; merits scrutiny 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.

Build image pull field type mismatch with Docker
6 participants