Commit graph

4177 commits

Author SHA1 Message Date
Lokesh Mandvekar
5a9bf964fb
Fix run_podman to support exit code with warnings notation (+w)
(cherry picked from commit 652ec9578b)

The test framework was not parsing the '+w' suffix in expected exit
codes (e.g., '0+w' meaning "expect exit code 0 and warnings allowed").
This caused the literal string to be passed as a command argument to
podman, resulting in "unrecognized command" errors.

Added pattern matching for:
- [0-9]+w (single digit with warnings)
- [1-9][0-9]+w (double digit with warnings)
- [12][0-9][0-9]+w (triple digit with warnings)

The '+w' suffix is stripped off and only the numeric exit code is used
for validation. Note: The actual warning validation is not implemented
yet, but this allows tests using the '+w' notation to run correctly.

This fixes the "podman-remote: non-default connection" test failure.

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2026-03-30 15:13:32 -04:00
Lokesh Mandvekar
cb253620b8
Fix image events system test for non-deterministic event ordering
(cherry picked from commit 141e6cddfa)

The events file backend writes events as they're generated, which may
not match chronological order due to race conditions during concurrent
operations in rmi -f. The remove and untag events from rmi can appear
in any order in the events file.

This matches the approach used in main branch (see commit 111a4bbe71)
which recognizes that event ordering is not guaranteed for concurrent
operations, especially in podman-remote.

This fix:
- Simplifies initial validation to check for event presence (not order)
- Checks deterministic events (0-6) in exact order
- Validates rmi events (7-9) are present without requiring specific order
- Checks final event (10) is the second loadfromarchive
- Does NOT modify runtime code to enforce ordering (events remain as-generated)

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2026-03-30 15:13:31 -04:00
Chris Evich
83163f87d6
Fix protobuf registration conflict by removing go-criu/v5 dependency
Commit "Fix compilation errors for v4.4.1-rhel compatibility"
introduced both go-criu/v5 and go-criu/v6 dependencies, causing a
protobuf registration conflict error:

    panic: proto: file "stats/stats.proto" is already registered
            previously from: "github.com/checkpoint-restore/go-criu/v5/stats"
            currently from:  "github.com/checkpoint-restore/go-criu/v6/stats"

Fix this by:
- Removing go-criu/v5 from go.mod
- Updating all imports from v5 to v6 in:
  * pkg/criu/criu_linux.go
  * pkg/checkpoint/crutils/checkpoint_restore_utils.go
  * test/e2e/checkpoint_test.go
- Regenerating vendor directory with 'make vendor'

Generated with the Assistance of AI: Cursor <auto>

Signed-off-by: Chris Evich <cevich@redhat.com>
2026-03-30 15:13:31 -04:00
Chetan Giradkar
47afed388c
Change priority for cli-flags for remotely operating
(cherry picked from commit 6597a24d6c)

... Podman
cli flags couldn't override the active-destination when env variables were set. As a remedy, the precedence of cli flags has been changed.

Note: This commit is from #19997 and it brought in some pretty massive changes
to how the remote connections are created.

Signed-off-by: Chetan Giradkar <cgiradka@redhat.com>
Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
Signed-off-by: Chris Evich <cevich@redhat.com>
2026-01-28 10:48:05 -05:00
Chris Evich
a865a68620
[v4.2.0-rhel] Add conditional release-checking system test
Unfortunately on a number of occasions, Podman has been released
officially with a `-dev` suffix in the version number.  Assist in
catching this mistake at release time by the addition of a simple
conditional test.  Note that it must be positively enabled by a
magic env. var. before executing the system tests.

Ref. original PR: https://github.com/containers/podman/pull/26540

Signed-off-by: Chris Evich <cevich@redhat.com>
2025-07-14 12:29:17 -04:00
Paul Holzinger
4ea3ea3535
Merge pull request #22306 from edsantiago/gating-fixes
[v4.2.0-rhel] Gating-test fixes
2024-04-09 17:43:41 +02:00
Ed Santiago
a1be9a4c0d RHEL gating tests: skip some tests under runc
Manual cherrypick of (portions of) #14972, for tests that
don't work under runc.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-04-08 10:45:53 -06:00
Toshiki Sonoda
11edb39d63 system tests: fix noexistent labels test in the remote
In the remote environment, this test will be failed,
because an error message is different from the local environment.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2024-04-08 10:45:53 -06:00
Ed Santiago
0b309439f3 system tests: health-on-failure: fix broken logic
Basically, in the timeout loop where we checked for new CID
on the restarted container, we were running 'podman inspect'
(not 'inspect --format ID'), and comparing full hundred-line
output against single-line CID string.

While I'm in here, add 'c_' prefix to container to make it
easier for my old eyes to recognize "oh, that's a container name"
vs "is that a name? a SHA? a woozle?"

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-04-08 10:45:53 -06:00
Toshiki Sonoda
7848291d89 system tests: fix volume exec/noexec test
The return code is "126" in the current version of runc.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2024-04-08 10:45:53 -06:00
Ed Santiago
f3355f9591 (Temporary) Emergency CI fix: quay search is broken
Someone please revert this once quay search is fixed.

Signed-off-by: Ed Santiago <santiago@redhat.com>

<MH: Cherry-pick into v4.2.0-rhel to fix CI>

Signed-off-by: Matt Heon <mheon@redhat.com>
2024-02-02 13:45:52 -05:00
Kir Kolyshkin
f19c0335c2 [v4.2.0-rhel] all: stop using deprecated GenerateNonCryptoID
Cherry-pick #15788 to v4.2.0-rhel branch per RHBZ 2157930

In view of https://github.com/containers/storage/pull/1337, do this:

	for f in $(git grep -l stringid.GenerateNonCryptoID | grep -v '^vendor/'); do
		sed -i 's/stringid.GenerateNonCryptoID/stringid.GenerateRandomID/g' $f;
	done

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2023-02-01 16:35:50 -05:00
Daniel J Walsh
b8b9f57aae
Merge pull request #17008 from Romain-Geissler-1A/backport-docker-client-build-compat-v4.2.0-rhel
[release-v4.2.0-rhel] compat,build: handle docker's preconfigured cacheTo,cacheFrom
2023-01-10 13:01:35 -05:00
Giuseppe Scrivano
dce4a44c6f
podman: podman rm -f doesn't leave processes
follow-up to 6886e80b45

when "podman -rm -f" is used on a container in "stopping" state, also
make sure it is terminated before removing it from the local storage.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit 4cf06fe7e0)
2023-01-10 11:18:37 +01:00
Aditya R
75b236a2b4 compat,build: handle docker's preconfigured cacheTo,cacheFrom
Docker's newer clients popuates `cacheFrom` and `cacheTo` parameter
by default as empty array for all commands but buildah's design of
distributed cache expects this to be a repo not image hence parse
only the first populated repo and igore if empty array.

Signed-off-by: Aditya R <arajan@redhat.com>
2023-01-05 22:44:01 +00:00
Giuseppe Scrivano
cbe15ef706
libpod: fix race condition rm'ing stopping containers
do not allow removing containers that are in the stopping state,
otherwise it can lead to a race condition where a "podman rm" removes
the container from the storage while another process is stopping the
same container.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2155828

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
(cherry picked from commit 6886e80b45)
2023-01-04 13:27:21 +01:00
Valentin Rothberg
c7ea09bbb6 fix search flake
There's no guarantee that the searched image will be returned, so only
make sure that "alpine" is mentioned somewhere.

Fixes: #16248
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-11-28 13:53:49 +01:00
Daniel J Walsh
3ca8271d53 Fix search_test to return correct version of alpine
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-11-28 13:53:42 +01:00
Valentin Rothberg
525ef3e38d container restart: clean up healthcheck state
When restarting a container, clean up the healthcheck state by removing
the old log on disk.  Carrying over the old state can lead to various
issues, for instance, in a wrong failing streak and hence wrong
behaviour after the restart.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2144754
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-11-28 12:55:58 +01:00
Ed Santiago
7023e4bfa1 FIXME: Temporary workaround for ubi8 CI breakage
Emergency import of https://github.com/containers/buildah/pull/4377
required because the ubi8 image changed behind our backs.

On podman main, this commit will be reverted by Ed's
treadmill as soon as a new buildah is vendored into podman.

On side branches, the human doing the vendoring will need to
perform manual surgery. I hope the instructions are good enough.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-11-07 05:36:19 -07:00
Valentin Rothberg
def13bea77 healthcheck: fix --on-failure=stop
Fix the "stop" on-failure action by not removing the transient systemd
timer and service during container stop.  Removing the service will
in turn cause systemd to terminate the Podman process attempting to
stop the container and hence leave it in the "stopping" state.

Instead move the removal into the restart sequence.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-10-11 16:15:43 +02:00
OpenShift Merge Robot
d752133e2d
Merge pull request #16074 from mheon/backport_15437
[v4.2.0-rhel] Backport #15437
2022-10-09 13:50:17 +02:00
Valentin Rothberg
0b7e634798 health checks: make on-failure action retry aware
Make sure that the on-failure actions only kick in once the health check
has passed its retries.  Also fix race conditions on reading/writing the
log.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>

<MH: Addressed cherry-pick conflicts>

Backported to v4.2.0-rhel per RHBZ 2097708

Signed-off-by: Matthew Heon <mheon@redhat.com>
2022-10-07 13:47:06 -04:00
Matthew Heon
dce3d6ee9d Add support for containers.conf volume timeouts
Also, do a general cleanup of all the timeout code. Changes
include:
- Convert from int to *uint where possible. Timeouts cannot be
  negative, hence the uint change; and a timeout of 0 is valid,
  so we need a new way to detect that the user set a timeout
  (hence, pointer).
- Change name in the database to avoid conflicts between new data
  type and old one. This will cause timeouts set with 4.2.0 to be
  lost, but considering nobody is using the feature at present
  (and the lack of validation means we could have invalid,
  negative timeouts in the DB) this feels safe.
- Ensure volume plugin timeouts can only be used with volumes
  created using a plugin. Timeouts on the local driver are
  nonsensical.
- Remove the existing test, as it did not use a volume plugin.
  Write a new test that does.

The actual plumbing of the containers.conf timeout in is one line
in volume_api.go; the remainder are the above-described cleanups.

Backported to v4.2.0-rhel per RHBZ 2125241

Signed-off-by: Matthew Heon <mheon@redhat.com>
2022-10-06 15:07:10 -04:00
Valentin Rothberg
fb536046a3 health check: add on-failure actions
For systems that have extreme robustness requirements (edge devices,
particularly those in difficult to access environments), it is important
that applications continue running in all circumstances. When the
application fails, Podman must restart it automatically to provide this
robustness. Otherwise, these devices may require customer IT to
physically gain access to restart, which can be prohibitively difficult.

Add a new `--on-failure` flag that supports four actions:

- **none**: Take no action.

- **kill**: Kill the container.

- **restart**: Restart the container.  Do not combine the `restart`
               action with the `--restart` flag.  When running inside of
               a systemd unit, consider using the `kill` or `stop`
               action instead to make use of systemd's restart policy.

- **stop**: Stop the container.

To remain backwards compatible, **none** is the default action.

Backport of commit aad29e759c

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2097708
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-09-27 10:40:36 +02:00
Matthew Heon
21540161f2 Add container GID to additional groups
Mitigates a potential permissions issue. Mirrors Buildah PR #4200
and CRI-O PR #6159.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2022-09-08 15:33:29 +00:00
Valentin Rothberg
8e52d98c61 fix CI: remove hardcodeded alpine version
The apiv2 test hardcoded the tag of the alpine image.
Remove it to unblock CI.

Fixes: #15388
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-09-07 13:39:41 -04:00
Giuseppe Scrivano
fa1085ed01 cmd: refuse --userns if a mapping is specified
if an explicit mapping is specified, do not accept `--userns` since it
overriden to "private".

Closes: https://github.com/containers/podman/issues/15233

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-08-10 16:46:05 -04:00
Toshiki Sonoda
91a1f3022b e2e: Add rootless mount cleanup test
`podman run -d mount cleanup test` adapt to rootless environment.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2022-08-10 16:46:05 -04:00
Karthik Elango
a6ea3325a0 start filter flag changes
Tying filtering logic for podman stop and start to same place in getContainersAndInputByContext() to reduce code redundancy

Signed-off-by: Karthik Elango <kelango@redhat.com>
2022-08-10 16:46:05 -04:00
Toshiki Sonoda
8c36b8c521 Cirrus: Fix e2e tests for "mount_rootless_test"
e2e `mount_rootless_test` did not load `podman binary path` successfully.
This PR fix this problem.

[It] podman unshare podman mount:
```
[+1596s] Running: ... unshare  mount <cid>
[+1596s] Error: exec: no command
[+1596s] output:
```

[It] podman unshare image podman mount:
```
[+1599s] Running: ... unshare  image mount quay.io/libpod/alpine:latest
[+1599s] Error: exec: no command
[+1599s] output:
```

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2022-08-10 16:46:05 -04:00
Aditya R
5c17d1b14b test: verify manifest inspect must contain OCI annotations
Signed-off-by: Aditya R <arajan@redhat.com>
2022-08-10 16:46:05 -04:00
Daniel J Walsh
7efd81cb8d With --rm option remove container if podman run fails
Fixes https://github.com/containers/podman/issues/15049

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matthew Heon <mheon@redhat.com>
2022-08-10 16:46:05 -04:00
dependabot[bot]
346b22f070 Bump golang.org/x/tools from 0.1.11 to 0.1.12 in /test/tools
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.1.11 to 0.1.12.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.1.11...v0.1.12)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-10 16:46:05 -04:00
Toshiki Sonoda
b7feafcb06 Fix: manifest push --rm removes a correct manifest list
This bug is reproduced when we execute the following command:

1. podman manifest add <manifest list> <images exist on local storage>
2. podman manifest push --rm <manifest list> dir:<directory>

If pushing succeeds, it is expected to remove only a manifest list.
However, manifest list remains on local storage and images are removed.

This commit fixes `podman manifest push --rm` to remove only a manifest list.

And, supports `manifest push --rm option` in remote environment,
like host environment.

Fixes: https://github.com/containers/podman/issues/15033

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2022-08-10 16:46:05 -04:00
Toshiki Sonoda
24f219efb7 Fix: Restore a container which name is equal to a image name
If there is a match for both container and image, we restore the container.

Fixes: https://github.com/containers/podman/issues/15055

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2022-08-10 16:46:05 -04:00
Daniel J Walsh
32848b95f6 When removing objects specifying --force,podman should exit with 0
This Patch will cause podman COMMAND rm --force bogus not fail

This is how Docker works, so Podman should follow this to allow existing
scripts to convert from Docker to Podman.

Fixes: #14612
Oprignal version of this patch came from wufan 1991849113@qq.com

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-08-10 16:46:05 -04:00
Aditya R
312bef288b test: update apply-podman-deltas for new tests
Skip some newly added test for remote and modify error output of a test
case which is reporter early in case of podman.

[NO NEW TESTS NEEDED]
[NO TESTS NEEDED]

Signed-off-by: Aditya R <arajan@redhat.com>
2022-08-10 16:46:04 -04:00
Miloslav Trmač
5c95c0920f Add support for creating sigstore signatures, and providing passphrases
- Allow creating sigstore signatures via --sign-by-sigstore-private-key .
  Like existing --sign-by, it does not work remote (in this case
  because we would have to copy the private key to the server).
- Allow passing a passphrase (which is mandatory for sigstore private keys)
  via --sign-passphrase-file; if it is not provided, prompt interactively.
- Also, use that passphrase for --sign-by as well, allowing non-interactive
  GPG use. (But --sign-passphrase-file can only be used with _one of_
  --sign-by and --sign-by-sigstore-private-key.)

Note that unlike the existing code, (podman build) does not yet
implement sigstore (I'm not sure why it needs to, it seems not to
push images?) because Buildah does not expose the feature yet.

Also, (podman image sign) was not extended to support sigstore.

The test for this follows existing (podman image sign) tests
and doesn't work rootless; that could be improved by exposing
a registries.d override option.

The test for push is getting large; I didn't want to
start yet another registry container, but that would be an
alternative.  In the future, Ginkgo's Ordered/BeforeAll
would allow starting a registry once and using it for two
tests.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-02 16:52:56 +02:00
Miloslav Trmač
62cc871c66 Update the registry server we test against from 2.6 to 2.8
... primarily so that it can support OCI artifacts.

2.8 already seems to exist in the repo.

This requires changing WaitContainerReady to also check
stderr (ultimately because docker/distribution was
updated to a more recent sirupsen/logrus, which logs
by default to stderr instead of stdout).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-02 16:52:56 +02:00
Miloslav Trmač
52db763737 Use existing REGISTRY_IMAGE variables in more places
... instead of hard-coding a copy of the value.

Notably this makes hack/podman_registry actually
support the documented -i option.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-02 16:52:56 +02:00
Miloslav Trmač
2303632250 Use httpasswd from the surrouding OS instead of the registry image
htpasswd is no longer included in docker.io/library/distribution
after 2.7.0, per https://github.com/docker/distribution-library-image/issues/107 ,
and we want to upgrade to a recent version.

At least system tests currently execute htpasswd from the OS,
so it seems that it is likely to be available.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-02 16:52:56 +02:00
Valentin Rothberg
74155705e4 fix e2e sign tests
The key used in the tests has expired.  Remove the expiration date to
turn CI happy and green.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-08-02 16:52:56 +02:00
Matthew Heon
bf6f796304 Skip one failing test on Ubuntu
Probably a result of the Ubuntu images being bumped on Main but
not in this branch. Not worth chasing down exactly what's going
wrong, so let's just disable it.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2022-07-27 09:29:33 -04:00
Charlie Doern
c85722eb9f pod create --share none should not create infra
for podman pod create, when we are not sharing any namespaces there is no point for the infra container.
This is especially true since resources have also been decoupled from the container recently.

handle this on the cmd level so that we can still create infra if set explicitly

resolves #15048

Signed-off-by: Charlie Doern <cdoern@redhat.com>
2022-07-26 14:46:12 -04:00
Vladimir Kochnev
e6ebfbd1e0 Set TLSVerify=true by default for API endpoints
Option defaults in API must be the same as in CLI.

```
% podman image push --help
% podman image pull --help
% podman manifest push --help
% podman image search --help
```

All of these CLI commands them have --tls-verify=true by default:
```
--tls-verify  require HTTPS and verify certificates when accessing the registry (default true)
```

As for `podman image build`, it doesn't have any means to control
`tlsVerify` parameter but it must be true by default.

Signed-off-by: Vladimir Kochnev <hashtable@yandex.ru>
2022-07-26 14:44:05 -04:00
Ed Santiago
64bc2ee97f Semiperiodoc cleanup of obsolete FIXMEs
Some refer to issues that are closed. Remove them.

Some are runc bugs that will never be fixed. Say so, and remove
the FIXME.

One (bps/iops) should probably be fixed. File an issue for it, and
update comment to include the issue# so my find-obsolete-skips script
can track it.

And one (rootless mount with a "kernel bug?" comment) is still
not fixed. Leave the skip, but add a comment documenting the symptom.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-07-26 14:43:23 -04:00
Valentin Rothberg
b339045db5 benchmarks: fix create test
And a new one for `run --detach`.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-07-26 14:43:08 -04:00
Paul Holzinger
fd1f5f55ab integration test: fix network backend option with remote
I honestly do not understand all this extra option parsing here but
there is really no reason to exclude  the option for remote, all the
other global options are also set there.

This fixes a problem with mixed cni/netavark use because the option was
unset.

Fixes #15017

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-07-26 14:42:48 -04:00
Paul Holzinger
c4616510a2 API: libpod/create use correct default umask
Make sure containers created via API have the correct umask from
containers.conf set.

Fixes #15036

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-07-26 14:39:39 -04:00