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

API: container wait endpoint regression in 3.0.0 #9351

Closed
edigaryev opened this issue Feb 12, 2021 · 8 comments · Fixed by #9414
Closed

API: container wait endpoint regression in 3.0.0 #9351

edigaryev opened this issue Feb 12, 2021 · 8 comments · Fixed by #9414
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@edigaryev
Copy link
Contributor

In #9048, which was included in the 3.0.0, the condition parameter was changed to be a slice, however, the assumptions behind the change explained in #9048 (comment) does not seem to be valid. Two examples to demonstrate this:

Here's a Podman 3.0.0 with the fix from #9347 applied:

$ curl --unix-socket /tmp/podman.sock -d '' 'http://d/v1.0.0/libpod/containers/84138634fb08/wait?condition=running'
{"cause":"schema: error converting value for index 0 of \"condition\"","message":"failed to parse parameters for /v1.0.0/libpod/containers/84138634fb08/wait?condition=running: schema: error converting value for index 0 of \"condition\"","response":400}

However, in 2.2.1 everything works fine:

$ curl --unix-socket /tmp/podman.sock -d '' 'http://d/v1.0.0/libpod/containers/84138634fb08/wait?condition=running'                                                                          
-1
@mheon
Copy link
Member

mheon commented Feb 13, 2021

We were OK with this as 3.0 is a major version bump, including a major API version bump (to v3.0.0). It's obviously not ideal and we would like to keep breaking changes to a minimum, but 3.0 offered an opportunity to batch necessary ones together in one release - this was one of those.

@mheon
Copy link
Member

mheon commented Feb 13, 2021

Though it looks like the v1.0.0 in the URL should be causing errors... @jwhonce Minimum API version is set to 3.0.0, but we're happily accepting v1.0.0 URLs still.

@edigaryev
Copy link
Contributor Author

this was one of those

But note that the #9048 (comment) implies that this wasn't intentional.

Moreover, current 3.0 API docs show that the parameter is named condition and it's a string, whereas currently to get it working you have to use the name condition[].

This prevents the proper API bindings to be generated from the Swagger spec, which is currently the only realistic way to get things working for Golang consumers (aside from writing everything by hand), because the Podman package cannot be used directly due to multiple dependency issues.

@mheon
Copy link
Member

mheon commented Feb 14, 2021

Alright, that definitely sounds like a bug - the expectation was to change parameter type but keep the name, from my understanding.

@edigaryev
Copy link
Contributor Author

Looks like this:

whereas currently to get it working you have to use the name condition[]

...actually "works" only in terms of API simply ignoring the parameter by the virtue of:

d.IgnoreUnknownKeys(true)

So the actual parameter name remained the same (condition), but the error converting value for index 0 happens due to type change from string in 2.2.1:

Condition string `schema:"condition"`

...to an int alias in 3.0.0:

Condition []define.ContainerStatus `schema:"condition"`

edigaryev added a commit to cirruslabs/cirrus-cli that referenced this issue Feb 16, 2021
edigaryev added a commit to cirruslabs/cirrus-cli that referenced this issue Feb 16, 2021
* Work around containers/podman#9390

* Work around containers/podman#9393

* Stream launched container's logs to the CLI's logger

* Work around containers/podman#9351

* Ignore bodyclose linter false-positive

* .cirrus.yml: run "go test" on Windows verbosely

* Use sub-context for the ContainerLogs() call

To avoid potential hangs in stdcopy.StdCopy().

* ContainerLogs: use buffered channels

To avoid a case when stdcopy.StdCopy() waits for the io.Pipe()
to unlock, while the connection from which it reads the logs
gets closed.

This presumably results in the tail part of the logs getting lost.

* TestContainerLogs: skip last line check for Podman
@rhatdan
Copy link
Member

rhatdan commented Feb 17, 2021

@edigaryev Can you open a PR to fix this?

@jwhonce jwhonce self-assigned this Feb 17, 2021
@jwhonce jwhonce added the kind/bug Categorizes issue or PR as related to a bug. label Feb 17, 2021
@edigaryev
Copy link
Contributor Author

@edigaryev Can you open a PR to fix this?

See #9414.

@matejvasek
Copy link
Contributor

I believe the incompatibility is not related to the "slice thing".

I suspect it's caused by preceding PR: https://github.com/containers/podman/pull/9051/files#diff-58b335c77eb3163bb2dec31c4e20ba5a62bafa143a1fbafe1a0e02dc1372fa31R327-R330

@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 Sep 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants