Commit Graph

21108 Commits

Author SHA1 Message Date
Ed Santiago f95dd21d5d deferred test failures: handle a corner case
Followup to #20797 (defer assertion failures). The bail-now()
helper was being defined only in setup() ... and some tests,
particularly 001-basic.bats, define their own minimalist setup().

Symptom was "bail-now: command not found", which still caused
test to fail (so no failures were hidden) but led to concern
and wasted time when analyzing failures.

Solution: add one more definition of bail-now(), in outer scope.

There is still one pathological case I'm not addressing: a
bats file that defines its own teardown() which does not invoke
basic_teardown(), then has a test that runs defer-assertion-failures
without a followup immediate-assertion-failures. This would lead
to failures that are never seen. Since teardown() without basic_teardown()
is invalid, I choose not to worry about this case.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-11-30 06:33:46 -07:00
openshift-merge-bot[bot] 6b9221d852
Merge pull request #20837 from dfr/freebsd-vnet
libpod: Allow using just one jail per container on FreeBSD
2023-11-30 08:38:20 +00:00
openshift-merge-bot[bot] 572a7692e3
Merge pull request #20828 from alexlarsson/quadlet-snippets
quadlet: Support systemd style dropin files
2023-11-29 23:24:33 +00:00
openshift-merge-bot[bot] 385f8526b3
Merge pull request #20834 from edsantiago/gating_fixes
Gating test fixes
2023-11-29 23:10:50 +00:00
openshift-merge-bot[bot] ea549c9163
Merge pull request #20836 from ashley-cui/vendor
Vendor c/common
2023-11-29 23:02:34 +00:00
Ashley Cui 42ea211211 Fix locking error in WSL machine rm -f
Fixed a bug where `podman machine rm -f` would cause a deadlock when
running with WSL.

The deadlock is caused by the Remove() function calling the Stop()
function after Remove() locks the VM. Stop() also has a lock call, which
fails and deadlocks because Remove() already claimed lock. Fix this by
moving the stop call before the lock

[NO NEW TESTS NEEDED]

Signed-off-by: Ashley Cui <acui@redhat.com>
2023-11-29 16:28:59 -05:00
openshift-merge-bot[bot] 5da1790a28
Merge pull request #20838 from Luap99/sqlite-timeout
sqlite: set busy timeout to 100s
2023-11-29 19:21:12 +00:00
Paul Holzinger 5b3d82f9bc
sqlite: set busy timeout to 100s
Only one process can write to the sqlite db at the same time, if another
process tries to use it at that time it fails and a database is locked
error is returned. If this happens sqlite should keep retrying until it
can write. To do that we can just set the _busy_timeout option. A 100s
timeout should be enough even on slower systems but not to much in case
there is a deadlock so it still returns in a reasonable time.

[NO NEW TESTS NEEDED] I think we strongly need to consider some form of
parallel stress testing to catch bugs like this.

Fixes #20809

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-11-29 18:07:29 +01:00
Doug Rabson d4ac2f3dd5 libpod: Allow using just one jail per container on FreeBSD
In FreeBSD-14.0, it is possible to configure a jail's network settings
from outside the jail using ifconfig and route's new '-j' option. This
removes the need for a separate jail to own the container's vnet.

[NO NEW TESTS NEEDED]

Signed-off-by: Doug Rabson <dfr@rabson.org>
2023-11-29 16:18:34 +00:00
Ashley Cui 55373dcce0 Vendor c/common
Vendor c/common@main

Signed-off-by: Ashley Cui <acui@redhat.com>
2023-11-29 10:17:54 -05:00
Ed Santiago 3e70415089 Gating test fixes
Two newly-added tests, fail in gating:
 - system connection: difference in how sockets are set up
   between CI and gating
 - ulimit: gating seems to run with ulimit -c -H 0. Check, and
   skip if ulimit is less than what we need

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-11-29 07:51:43 -07:00
Paul Holzinger 86296ff8da
pkg/bindings: add new APIVersionError error type
When a new API call is added to the bindings we should guard it based on
the version and throw a useful error. Right now an old server that does
not implement a given endpoint would throw a "NOT FOUND" error which is
not good for callers.

Instead implement a custom error type to give a usefule error instead.
This allows bindings users to call errors.As() to know if they call and
to old version.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-11-29 15:31:42 +01:00
Sander Maijers a5d11f4041
Set `BUILDAH_ISOLATION=chroot` within Podman containers
See: https://developers.redhat.com/blog/2019/08/14/best-practices-for-running-buildah-in-a-container

See: 06c41b614d/docs/source/markdown/options/isolation.md

Signed-off-by: Sander Maijers <3374183+sanmai-NL@users.noreply.github.com>
2023-11-29 14:45:21 +01:00
Urvashi Mohnani f35d1c1c25 Don't update health check status during initialDelaySeconds
When InitialDelaySeconds in the kube yaml is set for a helthcheck,
don't update the healthcheck status till those initial delay seconds are over.
We were waiting to update for a failing healtcheck, but when the healthcheck
was successful during the initial delay time, the status was being updated as healthy
immediately.
This is misleading to the users wondering why their healthcheck takes
much longer to fail for a failing case while it is quick to succeed for
a healthy case. It also doesn't match what the k8s InitialDelaySeconds
does. This change is only for kube play, podman healthcheck run is
unaffected.

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2023-11-29 08:37:39 -05:00
Alexander Larsson 8ee2622028 quadlet: Support systemd style dropin files
For a source file like `foo.container`, look for drop in named
`foo.container.d/*.conf` and merged them into the main file.  The
dropins are applied in alphabetical order, and files in earlier
diretories override later files with same name.

This is similar to how systemd dropins work, see:
https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html

Also adds some tests for these

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2023-11-29 13:46:52 +01:00
Paul Holzinger 93bcd2a25d
fix podman-remote exec regression with v4.8
Commit f48a706abc added a new API endpoint to remove exec session
correctly. And the bindings try to call that endpoint for exec every
time. Now since client and server must not be the same version this
causes a problem if a new 4.8 client calls an older 4.7 server as it has
no idea about such endpoint and throws an ugly error. This is a common
scenario for podman machine setups.

The client does know the server version so it should make sure to not
call such endpoint if the server is older than 4.8.

I added a exec test to the machine tests as this can be reproduced with
podman machine as at the moment at least the VM image does not contain
podman 4.8. And it should at least make sure podman exec keeps working
for podman machine without regressions.

Fixes #20821

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-11-29 13:22:46 +01:00
openshift-merge-bot[bot] 06c41b614d
Merge pull request #20595 from containers/renovate/github.com-gorilla-schema-1.x
fix(deps): update module github.com/gorilla/schema to v1.2.1
2023-11-29 12:06:38 +00:00
openshift-merge-bot[bot] e0a524f630
Merge pull request #20823 from nalind/close-that-readcloser
utils: close a couple of ReadClosers
2023-11-29 02:18:06 +00:00
openshift-merge-bot[bot] d6fefe0ba7
Merge pull request #20822 from mtrmac/chown-cleanup
Fix transferring data using tar
2023-11-29 02:15:17 +00:00
openshift-merge-bot[bot] 6d9d8f06ce
Merge pull request #20517 from rhatdan/mask
Get masked paths and readonly masked patchs from containers/common @rhatdan
2023-11-29 02:12:37 +00:00
openshift-merge-bot[bot] 828ef9e174
Merge pull request #20817 from eriksjolund/fix-markdown-bugs
[CI:DOCS] Fix markdown bugs
2023-11-29 02:09:43 +00:00
openshift-merge-bot[bot] e14d095243
Merge pull request #20794 from eriksjolund/document-sometimes-slow-native-overlayfs
[CI:DOCS] performance: document sometimes slow native overlayfs
2023-11-29 01:22:57 +00:00
openshift-merge-bot[bot] 5ab4513b26
Merge pull request #20798 from n1hility/fix-user-mode-disable
Fix wsl.conf generation when user-mode-networking is disabled
2023-11-29 01:20:12 +00:00
openshift-merge-bot[bot] 21951e2376
Merge pull request #20799 from edsantiago/symlink-mounts
[systests] podman mount no-dereference: complete rewrite
2023-11-29 01:14:48 +00:00
Nalin Dahyabhai cf1ad300bb utils: close a couple of ReadClosers
utils.Tar() and utils.TarWithChroot() both return ReadClosers, but when
we called them from utils.TarToFilesystem() and utils.TarChrootToFilesystem()
respectively, they were not being closed.

[NO NEW TESTS NEEDED]

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2023-11-28 15:48:00 -05:00
Miloslav Trmač 4314b1c344 Fix transferring data using tar
Instead of relying on the remote server to create tar files
with the right account IDs (which the remote server doesn't
even know, when the client and server run under different accounts),
have the remote client ignore the account IDs when unpacking.

Then just hard-code 0 in the remote server, so that the remote
server's account identity does not leak in the tar file contents.

Compare https://github.com/containers/image/issues/1627 .

[NO NEW TESTS NEEDED] : https://github.com/containers/podman/pull/18563
suggests that existing tests already cover these code paths / properties.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2023-11-28 20:44:17 +01:00
openshift-merge-bot[bot] 443e779a1f
Merge pull request #20804 from BlackHole1/improve-vmtype
refactor(machine): improve machine marker value
2023-11-28 19:12:51 +00:00
Erik Sjölund 7b4d6a295e [CI:DOCS] Fix markdown bugs
Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
2023-11-28 17:28:08 +01:00
openshift-merge-bot[bot] 83c08a2f5c
Merge pull request #20609 from cgiradkar/19124_remove_event_fix
Set correct exitcode in remove events
2023-11-28 16:21:17 +00:00
openshift-merge-bot[bot] 2645f91bfe
Merge pull request #20813 from Luap99/sqlite-removepodcontainers
sqlite: fix missing Commit() in RemovePodContainers()
2023-11-28 16:07:18 +00:00
openshift-merge-bot[bot] 9627d3043d
Merge pull request #20810 from Luap99/sqlite-validate
sqlite: fix issue in ValidateDBConfig()
2023-11-28 16:04:42 +00:00
openshift-merge-bot[bot] 545daed1e4
Merge pull request #20762 from ygalblum/quadlet-pod
Quadlet - Add support for .pod units
2023-11-28 14:44:00 +00:00
openshift-merge-bot[bot] 9a120321c7
Merge pull request #20807 from giuseppe/fix-mount-tmpfs-mode
docs: drop default for tmpfs-mode
2023-11-28 14:17:25 +00:00
Black-Hole1 a2bf8c6d50
refactor(machine): improve machine marker value
1. Set the marker to the current virtual machine type instead of fixed qemu.
2. Update containers/common

[NO NEW TESTS NEEDED]

Signed-off-by: Black-Hole1 <bh@bugs.cc>
2023-11-28 21:47:12 +08:00
Chetan Giradkar 572f38c0db Set correct exitcode in remove events and change ContainerExitCode from int to int ptr
Added additional check for event type to be remove and set the correct exitcode.
While it was getting difficult to maintain the omitempty notation for Event->ContainerExitCode, changing the type from int to int ptr gives us the ability to check for ContainerExitCode to be not nil and continue operations from there.

closes #19124

Signed-off-by: Chetan Giradkar <cgiradka@redhat.com>
2023-11-28 13:31:18 +00:00
Paul Holzinger d7b970a4c4
sqlite: fix issue in ValidateDBConfig()
If a transaction is started it must either be committed or rolled back.
The function uses defer to call `tx.Rollback()` if there is an error
returned. However it also called `tx.Commit()` and afterwards further
errors can be returned which means it tries to roll back a already
committed transaction which cannot work.

This fix is to make sure tx.Commit() is the last call in that function.
see https://github.com/containers/podman/issues/20731

[NO NEW TESTS NEEDED]

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-11-28 14:27:49 +01:00
Paul Holzinger e26f677b16
sqlite: fix missing Commit() in RemovePodContainers()
We have to Commit() the transaction. Note this is only in a rare pod
remove code path and very unlikely to ever be used.

[NO NEW TESTS NEEDED]

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-11-28 14:26:29 +01:00
Giuseppe Scrivano 248cbc6f69
docs: drop default for tmpfs-mode
The default is OCI runtime specific, there is no way for Podman to
know it.

[CI:DOCS]

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2023-11-28 13:51:28 +01:00
Ygal Blum 6b2f48129e Quadlet - Add support for .pod units
Add support for .pod unit files with only PodmanArgs, GlobalArgs, ContainersConfModule and PodName
Add support for linking .container units with .pod ones
Add e2e and system tests
Add to man page

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2023-11-28 14:31:53 +02:00
Ed Santiago c664cfe886 [systests] podman mount no-dereference: complete rewrite
Existing test was very good, but as a multidimensional table it
was unmaintainable... and actually missed one corner case.

This version isn't much better. It's far longer, codewise. It
is a little harder to understand at first glance. It has three
uncomfortable magic conditionals. But I believe it is more
long-term maintainable: beyond the first glance, it is possible
for a human to check it for correctness. It is also extensible,
as proved by the new test cases I added.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-11-28 04:45:51 -07:00
Erik Sjölund 13e548820e [CI:DOCS] performance: document sometimes slow native overlayfs
Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
2023-11-28 12:34:08 +01:00
openshift-merge-bot[bot] 8387d2dfaa
Merge pull request #20802 from rhatdan/chown
Use idtools.SafeChown and SafeLchown everywhere
2023-11-28 11:02:25 +00:00
openshift-merge-bot[bot] 720a0ead3a
Merge pull request #20797 from edsantiago/defer_assert_failures
[systests] new defer-assertion-failure
2023-11-28 10:56:56 +00:00
openshift-merge-bot[bot] bb48c2efd0
Merge pull request #20788 from Luap99/play-kube-swagger
[CI:DOCS] swagger: document play kube annotations param
2023-11-28 10:54:11 +00:00
renovate[bot] b39f764743
fix(deps): update module github.com/gorilla/schema to v1.2.1
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-28 10:08:56 +00:00
openshift-merge-bot[bot] 3a841ce6a9
Merge pull request #20796 from containers/renovate/golang.org-x-net-0.x
fix(deps): update module golang.org/x/net to v0.19.0
2023-11-28 08:31:11 +00:00
openshift-merge-bot[bot] a3ad9f0cf7
Merge pull request #20803 from containers/renovate/golang.org-x-tools-0.x
fix(deps): update module golang.org/x/tools to v0.16.0
2023-11-28 08:28:26 +00:00
renovate[bot] 07a7b3ae5d
fix(deps): update module golang.org/x/tools to v0.16.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-28 01:59:00 +00:00
Daniel J Walsh c8f262fec9
Use idtools.SafeChown and SafeLchown everywhere
If we get an error chowning a file or directory to a UID/GID pair
for something like ENOSUP or EPERM, then we should ignore as long as the UID/GID
pair on disk is correct.

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

[NO NEW TESTS NEEDED]

Since this is difficult to test and existing tests should be sufficient
to ensure no regression.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-11-27 20:41:56 -05:00
openshift-merge-bot[bot] e4cdd4b35a
Merge pull request #20795 from Luap99/compose-debug-leftover
test/compose: remove debug leftovers
2023-11-27 23:20:13 +00:00