Commit graph

325 commits

Author SHA1 Message Date
Paul Holzinger
2e589e7465
pkg/machine/e2e: lower command timeout
Even on the slowest of CI systems a normal VM start does not seem to
take more than 1 minute.

Instead we seem to have flakes which cause our command to hang on
startup. In that case we thought waiting longer might help but instead
it just wastes 10 minutes.

Se the default command timeout to 3 minutes which should be plenty even
on the slowest of CI systems. Anything above will likely never finish
and we can just abort the test as failed.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-09-08 12:31:04 +02:00
Paul Holzinger
d42ad4aae3
pkg/machine/e2e: combine one --import-native-ca test
Combine the no volume and --import-native-ca test into one.

This removes one full machine init/start/stop cycle.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-09-08 12:24:17 +02:00
Paul Holzinger
ee7d3c534c
pkg/machine/e2e: combine build context test
Instead of creating a fresh machine which is slow reuse an existing
test for this test.

Also fix the test to actually check the file content properly, it was
using the wrong build output. And then just use one cat for both files
to make it a tiny bit faster.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-09-08 12:24:17 +02:00
Paul Holzinger
66a1bee8d5
pkg/machine/e2e: inline one remove test
Avoid another init/start cycle by reusing an existing test which has a
VM running already.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-09-08 12:24:17 +02:00
Paul Holzinger
f1f52763cb
pkg/machine/e2e: combine api test cases
Only start a machine once, not three times to safe time.

Also include stdout/err as part of the curl command so errors are
visible. And lastly the latest moby client code should support unix
sockets on windows so we can test it there as well.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-09-08 12:16:45 +02:00
Paul Holzinger
49aec99596
pkg/machine/e2e: inline stop running machine
Instead of having to start a new machine again here just drop the test
and do the stop check as part of another test which already has a
machine running.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-09-08 12:16:45 +02:00
Paul Holzinger
9002dce687
pkg/machine/e2e: use withFakeImage for excessive cpus test
The test should fail before booting a real VM so we can use the fake
image which should make the test a few seconds faster.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-09-08 12:16:45 +02:00
Paul Holzinger
1b6d77299e
pkg/machine/e2e: remove simple init with start
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-09-08 12:16:44 +02:00
Paul Holzinger
ccd3778087
pkg/machine/e2e: remove start simple machine
The test starts a machine 3 times taking almost 180 seconds in linux CI.

We have a lot of machine starts elsewhere already so we really do not
need a basic start and for the quiet/noinfo checks we can just add them
to another existing start command.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-09-08 12:16:44 +02:00
Paul Holzinger
d99f1d5564
pkg/machine/e2e: rename toQemuInspectInfo to toInspectInfo
There is nothing qemu specifc about this for a long time. Just drop it
from the name.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-09-08 12:16:44 +02:00
Paul Holzinger
3ffe582563
pkg/machine/e2e: combine machine set rootful tests
Each machine start/stop adds up in CI, combine several related tests to
reduce the machine init/start/stops cycles.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-09-08 12:16:44 +02:00
Paul Holzinger
d3f30f698e
pkg/machine/e2e: correctly handle set --rootful=false
On podman machine set we have three modes, not set (keep user),
--rootful (set user to root), --rootful=false (set to rootless user).

The later could not be passed at all before this.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-09-08 12:16:44 +02:00
Paul Holzinger
f4df65a859
pkg/machine/e2e: combine two restart machine tests
The restart tests are rather slow. On the linux CI 60 seconds for the
stopped case and almost 120 seconds for the restart running case.

Combine both cases into one so we only have to start a machine twice,
not three times and only need to init it once.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-09-08 12:16:43 +02:00
Paul Holzinger
53a9bcbe13
run golangci-lint --fix
In order to fix the new formatting issues reported.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-09-04 16:30:10 +02:00
Paul Holzinger
eb96a9d5b8
run go fix ./...
Plus manually deleting the left over inline functions because go fix
doesn't do that even though they are private functions.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-09-04 11:53:04 +02:00
Jude Ruben Fernando
73657e9267 Fix machine init failure with read-only disk image
Fixes: #2756

Signed-off-by: Jude Ruben Fernando <rubenfdo@gmail.com>

machine: fix stdpull internal imports

Signed-off-by: Jude Ruben Fernando <rubenfdo@gmail.com>
2026-08-24 14:35:33 +00:00
Vishnu Kothakapu
2dac3a97fb Refactor: use %w for error wrapping in pkg/machine
Signed-off-by: Vishnu Kothakapu <vishnukothakapu27@gmail.com>
2026-08-12 02:23:44 +05:30
Danish Prakash
e121ed6264
Merge pull request #28687 from jaitjacob/add-podman-machine-restart-command
Add `podman machine restart` subcommand
2026-07-22 09:53:10 +05:30
Jait Jacob
2ad3a79631
Add podman machine restart subcommand
Signed-off-by: Jait Jacob <jai8.jacob@gmail.com>
2026-07-16 21:51:11 +05:30
Mario Loriedo
452c40a1b6 Add machine e2e test for host.containers.internal
Add one more test to the basic podman commands e2e tests:
- starts an HTTP server on the host
- verify HTTP requests from a container, using
`host.containers.internal` or `host.docker.internal`, are routed
successfully to the server running on the host

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>

test

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2026-07-16 14:33:18 +02:00
Mario Loriedo
48f21de496 Fixing machine e2e gvproxy test
The lookup for the gvproxy process was broken on Windows:
- We looked for gvproxy, not gvproxy.exe, and `tasklist` was always
failing
- But `pgrep` wasn't failing because we looked for the wrong `tasklist`
error message (the correct error message on my laptop is "INFO: No tasks
are running which match the specified criteria.")
- WSL uses win-sshproxy.exe, not gvproxy.exe

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2026-07-15 11:42:11 +02:00
Paul Holzinger
114bb1efa7
machine/wsl: fix config mount logic
The current systemd service to mount /etc/containers is not working
right. The Before=podman.socket causes a ordering conflict which causes
the socket to be disabled and thus all podman remote connections fail.

The problem is the unit is wanted by the default.target while the socket
is wanted by sockets.target which can be before the default.target is
triggered. That means that the Before= line cannot be fulfilled and
sometimes systemd thus seems to not start the socket. It is unclear to
me why this is racy as it is sometimes also works.

This was reported by Vladimir Lazar from the PD team, our CI did not
caught this as we use rootless machines by default and the problem only
happens for the rootful socket so we do not see connection failures.
To fix this add at least one rootful socket check.

We do however have a different CI flake that was also caused by the
incorrect mount dependencies. The mount could happen after sshd or other
programs run. So to fix this we must hook the podman-mnt-config.service
into the local-fs.target which runs much earlier and is used for all the
mounts.

Fixes: #29003

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-07-02 14:01:43 +02:00
Mario Loriedo
12ea195526 Add new machine test that covers interrupted start command
Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2026-06-24 18:52:15 +02:00
Paul Holzinger
e34f3bce0c
machine: remove SSL_CERT_DIR/SSL_CERT_FILE copy
With podman 6 we have a --import-native-ca option that handles the
copying of certs much better.

As such remove our old legacy way of copying files these envs and also
the static certs.d dir. Since we now mount the full containers config
dir the certs from the cert.d are mounted already.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-05-11 15:58:03 +02:00
Paul Holzinger
b14e833ef6
machine: add test to check config mount
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-05-11 15:58:03 +02:00
Paul Holzinger
41adad8ce9
machine test: combine three test cases
Each machine init boot takes a while, we can easily do this as part of
one test run to speed the overall machine test time up.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-05-11 15:58:03 +02:00
Mario Loriedo
3f883706ba Import local certificates to machines on macOS and Linux
This is a follow up of https://github.com/containers/podman/pull/28336 where we
implemented the import of the certificates on Windows. This PR implements the
same feature on macOS and Linux.

Fixes https://redhat.atlassian.net/browse/RUN-4552

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2026-05-01 00:42:52 +02:00
jait jacob
efc6ddfcc4 cleanup: run go fix on pkg/machine for windows
Signed-off-by: jait jacob <jai8.jacob@gmail.com>
2026-04-29 13:56:01 +05:30
Brent Baude
2cc3be7332
RUN-4539: Change podman module paths
The podman module paths are moving from github.com/containers/podman to
go.podman.io/podman.  This will help with future mobility.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2026-04-22 14:02:25 -05:00
Matt Heon
3279767614
Merge pull request #28336 from l0rd/import_native_ca
Import host trusted certificates into the guest machine - Windows part
2026-04-22 13:04:55 -04:00
Matthew Heon
5e94c95ad0 Move to deterministic network setup order
This was implemented by containers/netavark #1369; this commit
completes the process by wiring it into Podman. We now respect
the CLI order for configured networks - if a user passes
`--net net1,net2` we guarantee that net1 will be configured
before net2.

For containers created before this patch, we don't retain enough
information to configure networks in CLI order, so we use
alphabetical order instead to still guarantee consistency.

No breaking API changes have been made, but we do add a new
field to supplement the existing map to (optionally) provide
ordering information. The Podman CLI will always pass this.
Existing applications that do not will, again, receive]
deterministic ordering based on an alphabetical sort of network
names.

This requires the latest version of Netavark to work properly.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2026-04-17 10:00:32 -04:00
Mario Loriedo
f7dd6156d3 Import host certificates at machine startup on Windows
Implements the feature introduced in the design
document added with commit 4bdc1d37

Fixes https://redhat.atlassian.net/browse/RUN-4260

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2026-04-16 13:35:40 +02:00
Mario Loriedo
24ee5aec48 Add new flag --import-native-ca for machine init/set
Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2026-04-01 14:12:30 +02:00
Tom Sweeney
8c3af49bef
Merge pull request #28347 from Honny1/machine-cpu-limits
Reject `--cpus` above host CPU count on podman machine init and set
2026-03-25 11:05:37 -04:00
Jan Rodák
bb4dda4855
Reject --cpus above host CPU count on podman machine init and set
Fixes: https://github.com/containers/podman/issues/28322

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-03-23 18:22:14 +01:00
Brent Baude
48d36932e2 Error on WSL machine os apply|upgrade
Given that apply and upgrade do not work on WSL, we should error out
with an error as such.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2026-03-23 10:01:53 -05:00
Jan Kaluza
56e555bfc2 api/compat: switch to moby/moby
Replace github.com/docker/docker API imports with github.com/moby/moby
across compat handlers, swagger models, and tests to align with upstream
type definitions.

Fixes: #27536.

Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2026-03-09 11:09:23 +01:00
dvorst
84eff9ef3b Fix: Rootless Podman-in-Podman on WSL
closes: #27411

Adjust SUB_UID and SUB_GID ranges to support running rootless Podman inside a rootless run Podman container.
Also add a test to verify the change and prevent regression.

By default, a new user is assigned the following sub-ID ranges:
  SUB_UID_MIN=100000, SUB_GID_MIN=100000, SUB_UID_COUNT=65536, SUB_GID_COUNT=65536
This means the user’s sub-UID and sub-GID ranges are 100000–165535.

When the container is run rootless with the user defined below, ID mappings occur as follows:
- Container ID 0 (root) maps to user ID 1000 on the host (which is the user created below).
- Container IDs 1–65536 map to IDs 100000–165535 on host (the subid range previously mentioned).

If a new user is created inside this container (to build containers for example), it will
attempt to use the default sub-ID range (100000–165535). However, this exceeds the container’s
available ID mapping, since only IDs up to 65536 are mapped. This causes nested rootless Podman
to fail.

To enable container-in-container builds, the sub-ID ranges for the user must be large enough
to provide at least 65536 usable IDs. A minimum SUB_UID_COUNT and SUB_GID_COUNT of 165536 is
required, but 1,000,000 is used here to provide additional margin.

1,000,000 matches the subid range other machines are using, defined in [ignition.go](69b397af49/pkg/machine/ignition/ignition.go (L284-L289)).
The script of other machines modify the subid files directly for 1 user, the `sed` command used in
this fix mimics that.

The test is added as en extension to the 'simple init with username' test case, to prevent having
to create a new VM.

Signed-off-by: dvorst <87502756+dvorst@users.noreply.github.com>
2026-02-27 10:52:14 +01:00
Kir Kolyshkin
94442ae44e pkg/machine/e2e: simplify runWslCommand
runWslCommand never returns err != nil because if there's an error, it
calls Fail (which panics, so the code after it is unreachable).

Remove error returning and checking.

Inspired by the following linter warning:

> pkg/machine/e2e/config_windows_test.go:59:56: runWslCommand - result 1 (error) is always nil (unparam)
> func runWslCommand(cmdArgs []string) (*machineSession, error) {
>                                                        ^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-02-11 11:41:11 -08:00
openshift-merge-bot[bot]
095ddfe995
Merge pull request #26277 from lstocchi/i25038
HyperV machine should reuse hvsock registry entries when possible
2025-11-21 11:32:09 +00:00
openshift-merge-bot[bot]
18aa784988
Merge pull request #27546 from jakecorrenti/libkrun-as-default
machine: change default macOS provider to libkrun
2025-11-20 16:00:23 +00:00
lstocchi
23a297198e
add test to verify init reuse hvsock entries for hyperv machines
Signed-off-by: lstocchi <lstocchi@redhat.com>
2025-11-20 16:51:45 +01:00
openshift-merge-bot[bot]
dfdd3b5074
Merge pull request #27557 from baude/issue27556
Ignore prompt if stdin not a tty on machine start
2025-11-20 10:03:32 +00:00
Brent Baude
6541fc4fb2
Merge pull request #27510 from baude/fakehyperv
fake images: windows hyperv
2025-11-19 12:12:22 -06:00
Brent Baude
3d566d85cf Ignore prompt if stdin not a tty on machine start
When starting a machine and the user has not explicitly passed
-u=true|false AND stdin is a not a tty, we should not prompt to update
connections.

Fixes: #27556

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-11-19 11:50:25 -06:00
Jake Correnti
453a45142f
machine: change default macOS provider to libkrun
Now that Podman 6.0 no longer supports Intel Macs, use libkrun as the
default machine provider.

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
2025-11-17 09:32:29 -05:00
openshift-merge-bot[bot]
d388f9bbd2
Merge pull request #27342 from inknos/run-3578
Remove hardcoded refs from ociartifact code
2025-11-14 12:39:32 +00:00
Nicola Sella
df4905d68b
Remove hardcoded refs from ociartifact code
Fixes: https://issues.redhat.com/browse/RUN-3578

Signed-off-by: Nicola Sella <nsella@redhat.com>
2025-11-13 22:57:21 +01:00
Brent Baude
d58dddee66 fake images: windows hyperv
this pr is a follow on to #27493.  it adds support for hyperv "fake"
images and suggests a benefit in terms of test speed.  for hyperv, we
create a generic 4MB vhdx and stick it into the temp dir.  this saves us
from any image copy or compression.

i also followed up on a few comments Paul made about using windows|unix
instead of each platform.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-11-12 12:53:42 -06:00
Brent Baude
57052a8cc7 Fix regression in podman machine ssh
While doing the provider obfuscation, I injected a regression where
podman ssh machine failed.  The regression was added in
0f22c1c772.  I have fixed the regression
and added a test to prevent future occurance.

Fixes: #27491

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-11-12 10:37:48 -06:00