Skip to content

Conversation

StefanNienhuis
Copy link

This PR implements a new libpod REST API endpoint providing the autoupdate functionality, as it is included in the podman CLI. It accepts the same options as the CLI version. The end goal of this is to allow applications, such as cockpit-podman, to perform container updates in a similar manner to what is possible with the CLI.

This PR also modifies the swagger-check script. Since the endpoint is /libpod/autoupdate, the linter expected the response to be named autoupdateListResponse. The name autoupdateResponse made more sense in my mind so I added an exception for this in the swagger-check script. If this is not intended, I can remove it and use the suggested name instead.

Does this PR introduce a user-facing change?

Added auto update endpoint to the REST API

@github-actions github-actions bot added the kind/api-change Change to remote API; merits scrutiny label Sep 9, 2025
@StefanNienhuis
Copy link
Author

Regarding tests, this will require running a container from a systemd unit and performing tests on the api. Is this currently supported in the test system, and if so, can someone with more knowledge of the project point me in the right direction?

@Honny1
Copy link
Member

Honny1 commented Sep 10, 2025

The simplest way to test this feature is by adding an auto-update capability to the remote client and then enabling the test for it.

Remote client code

@Luap99
Copy link
Member

Luap99 commented Sep 10, 2025

I agree with podman-remote we can reuse the existing tests, and podman-remote used the remote APi so that is tested as well.

There are api only tests in test/apiv2 but there is no good way to run systemd unit containers there at the same time so I would definitely prefer the podman-remote option.

@StefanNienhuis
Copy link
Author

These changes implement autoupdate support for podman-remote. Using the existing test for this is a good idea I think. Looking through the test file it interacts with systemd, but wouldn't these commands be executed on the client side?

If not, is it enough to just remove the skip_if_remote statement in the setup?

@Luap99
Copy link
Member

Luap99 commented Sep 10, 2025

If not, is it enough to just remove the skip_if_remote statement in the setup?

yes removing the skip_if_remote will make the test run via podman-remote. And yeah systenctl command are still local but we only test these tests locally so remote and server are the same system so that should work fine.

One note though the podman-auto-update --authfile will need the skip_if_remote now though as the local registry only work with the local podman.

@StefanNienhuis
Copy link
Author

If not, is it enough to just remove the skip_if_remote statement in the setup?

yes removing the skip_if_remote will make the test run via podman-remote. And yeah systenctl command are still local but we only test these tests locally so remote and server are the same system so that should work fine.

Okay, that's good.

One note though the podman-auto-update --authfile will need the skip_if_remote now though as the local registry only work with the local podman.

Not exactly sure what you mean here. I took some inspiration from here to add the registry auth to the request. I see now that I don't handle this in the api endpoint like here. I assume I'll need to add that in and would that not make the test case work too?

@Luap99
Copy link
Member

Luap99 commented Sep 10, 2025

One note though the podman-auto-update --authfile will need the skip_if_remote now though as the local registry only work with the local podman.

Not exactly sure what you mean here. I took some inspiration from here to add the registry auth to the request. I see now that I don't handle this in the api endpoint like here. I assume I'll need to add that in and would that not make the test case work too?

start_registry will only ever work locally, so this test needs skip_if_remote for just that one test, i.e. compare

@test "podman pull with policy flag" {
skip_if_remote "tests depend on start_registry which does not work with podman-remote"
start_registry

@StefanNienhuis
Copy link
Author

Apologies for the delay, I had a few busy weeks. Last three commits do the following:

  • Use authfiles from the client machine, like is done for other remote commands.
    • Previously it would take the path from the client and attempt to find a file on the server, now it actually takes the authfile on the client and uses the MakeXRegistryAuthHeader function to send it to the server.
  • Report pull errors back to the client
    • Previously the API would only return the auto update reports, causing pull errors to not be shown on the client.
  • Enable the auto update tests for podman-remote, skipping for registries as suggested.

@StefanNienhuis StefanNienhuis force-pushed the feat/api-autoupdate branch 2 times, most recently from 0af4ce4 to 5715338 Compare September 25, 2025 16:39
@StefanNienhuis
Copy link
Author

@Luap99 could you help me out with these last failing test cases? It seems to be failing on something related to the local cache registry, from the containers-cached.conf file. It is rewriting the location but it is somehow ignoring the insecure flag and the test cases fail on it being a http repository.

I do see some references like skip_if_remote "containers.conf settings not set for remote connections" in some test cases (like 150-login.bats). Could it be that the cached registry is not supported for podman-remote?

@Luap99
Copy link
Member

Luap99 commented Sep 29, 2025

Oh and please squash the commits into one once you are done.

@StefanNienhuis
Copy link
Author

That seems to fix those cases. Thanks a lot!

These two failing test cases seem unrelated to this PR. Is that right?

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

Copy link
Contributor

openshift-ci bot commented Sep 30, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Luap99, StefanNienhuis

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 30, 2025
@Luap99
Copy link
Member

Luap99 commented Sep 30, 2025

machines tests are quite flaky I restarted them they are definitely unrelated to your changes.

Signed-off-by: Stefan Nienhuis <stefan@nienhuisdevelopment.com>
@StefanNienhuis
Copy link
Author

Okay. I rebased on main. Not really familiar with the PR process here, but looking through the document linked by the bot it seems I need a LGTM from someone?

Copy link

[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore.

@StefanNienhuis
Copy link
Author

Now all systemd units are failing to start. Can't reproduce it when running tests locally though.

@Luap99
Copy link
Member

Luap99 commented Oct 2, 2025

We require two reviews so the second person is merging the PR normally.

Looking at the tests the big rework from #24601 likely broke it, I need to figure out how to deal with that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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 release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants