Commit Graph

3923 Commits

Author SHA1 Message Date
Valentin Rothberg ea08765f40 go fmt: use go 1.18 conditional-build syntax
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-18 09:11:53 +01:00
Matthew Heon 4b359e4598 Set names in compose tests based on version
Compose v2 uses dashes as separators instead of hyphens. This
broke some tests that relied upon container names. Set the name
conditionally to make it safe for both.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2022-03-17 15:16:13 -04:00
OpenShift Merge Robot e59f71d230
Merge pull request #13530 from vrothberg/fix-13529
podman create: building local pause image: do not read ignore files
2022-03-17 18:28:24 +01:00
Valentin Rothberg ff54aaa634 podman create: building local pause image: do not read ignore files
Make sure to ignore local {container,docker}ignore files when building a
local pause image.  Otherwise, we may mistakenly not be able to copy
catatonit into the build container.

Fixes: #13529
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-17 14:18:16 +01:00
Nirmal Patel 714e5a13d9 Separator is no longer prepended when prefix is empty on podman generate systemd
When podman generate systemd is invoked, it previously did not check if
container-prefix or pod-prefix are empty. When these are empty, the file name
starts with the separator, which is hyphen by default. This results in files
like '-containername.service'.

The code now checks if these prefixes are empty. If they are, the filename no
longer adds a separator. Instead, it uses name or ID of the container or pod.

Closes #13272

Signed-off-by: Nirmal Patel <npate012@gmail.com>
2022-03-16 20:26:59 -04:00
OpenShift Merge Robot b1d37a7e21
Merge pull request #13450 from jwhonce/bz/2052697
Exit code change BZ #2052697
2022-03-16 17:23:50 -04:00
Jhon Honce 1387b5bd8a Add test for BZ #2052697
Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-03-16 11:27:07 -07:00
Jhon Honce ca7376bb11 Exit with 0 when receiving SIGTERM
* systemctl stop podman.service will now return exit code 0
* Update test framework to support JSON boolean and numeric values

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-03-15 14:45:11 -07:00
Paul Holzinger a0ad1f2ad4
remove unneeded k8s code
There is a lot of unneeded code, k8s is the by far the biggest
dependency in podman. We should remove as much as possible so that we
only have the stuff left that we use.

This is just a quick skim over the code which removes a lot of the
generated code and many packages that are now unused.
I know that this will be impossible to properly review. I will try to
make smaller changes in follow up work.

Right now this reduces about 8 MB in binary size!!!

[NO NEW TESTS NEEDED] Hopefully existing tests will catch any problems.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-03-15 14:48:08 +01:00
Paul Holzinger 918fc88a98
move k8s deps into podman
We only need a small part of the k8s dependencies but they are the
biggest dependencies in podman by far. Moving them into podman allows us
to remove the unnecessary parts.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-03-15 14:46:29 +01:00
OpenShift Merge Robot 68ce83fe91
Merge pull request #13238 from lsm5/e2e-aardvark
test/e2e: add aardvark specific tests
2022-03-15 06:34:07 -04:00
OpenShift Merge Robot 758f2c7a09
Merge pull request #13498 from flouthoc/podman-vendor-buildah
vendor: update `c/buildah`, `c/image` and `c/storage`
2022-03-15 06:32:07 -04:00
Aditya R daebf50b89
apply-podman-deltas: skip modified test case for --add-host which adds anomaly
All podman tests in CI expects exit code 125, which might not be true since exit code from runtime
is relayed as it is without any modification both in `buildah` and `podman`. Following behviour is seen when PR https://github.com/containers/buildah/pull/3809
added a test here https://github.com/containers/buildah/blob/main/tests/bud.bats#L3183 which relays exit code from runtime as it
is, in case of both `podman` and `buildah`. However apart from this test case no other test case was able to trigger this behviour hence
marking this test as an anomaly. Since its debatable if we should override this returned error number or not hence adding a note here.

Signed-off-by: Aditya R <arajan@redhat.com>
2022-03-14 20:41:38 +05:30
LStandman e8968c867f Add support for --chrootdirs
Signed-off-by: LStandman <65296484+LStandman@users.noreply.github.com>
2022-03-14 10:31:58 +02:00
Aditya R 780d4b2d65
vendor: bump buildah, c/image and c/storage
Bumps

c/buildah to -> `v1.24.3-0.20220310160415-5ec70bf01ea5`
c/storage to -> `v1.38.3-0.20220308085612-93ce26691863`
c/image to -> `v5.20.1-0.20220310094651-0d8056ee346f`

Signed-off-by: Aditya R <arajan@redhat.com>
2022-03-14 12:26:12 +05:30
Daniel J Walsh feaa1a134a
Add podman play kube --annotation
Allow users to add annotions in the podman play kube command.
This PR Also fixes the fact that annotations in the pod spec were
not being passed down to containers.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-03-09 17:30:01 -05:00
OpenShift Merge Robot acfcecf2ae
Merge pull request #12913 from rhatdan/kube
Add --context-dir option to podman play kube
2022-03-09 16:19:59 -05:00
OpenShift Merge Robot 4e21acd7b8
Merge pull request #13455 from rhatdan/docker
Fix handling of tmpfs-mode for tmpfs creation in compat mode
2022-03-09 15:53:58 -05:00
OpenShift Merge Robot 418ab2e5e1
Merge pull request #13421 from hshiina/device-rule
Set default rule at the head of device configuration
2022-03-09 10:28:24 -05:00
Daniel J Walsh 166edf00a1
Fix handling of tmpfs-mode for tmpfs creation in compat mode
The permissions on disk were wrong since we were not converting to
octal.

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

[NO NEW TESTS NEEDED] Since we don't currently test using the docker
client

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-03-09 08:03:42 -05:00
Lokesh Mandvekar 8cfdddf509
test/e2e: add aardvark specific tests
Co-authored-by: Brent Baude <bbaude@redhat.com>
Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2022-03-08 15:07:55 -05:00
Ed Santiago e66c46441a Skip flaky pprof tests
pprof tests are way too flaky, and are causing problems for
community contributors who don't have privs to press Re-run.

There has been no activity or interest in fixing the bug,
and it's not something I can fix. So, just disable the test.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-03-08 11:26:43 -07:00
OpenShift Merge Robot a08e4e5b46
Merge pull request #13457 from ashley-cui/flake
Move secret-verify-leak containerfile into its own Directory
2022-03-08 13:18:11 -05:00
Ashley Cui 9ce3c0a87a Move secret-verify-leak containerfile into its own Directory
Secret-verify-leak is causing flakes, when running in parallel tests.
This is because remote secrets are copied into the context directory to
send to the API server, and secret-verify-leak is doing a COPY * and
then checking if the temporary secret file ends up in the container or
not. Since all the temporary files are prefixed with
"podman-build-secret", this test checks if podman-build-secret is in the
image. However, when run in parallel with other tests, other temporary
podman-build-secrets might be in the context dir. Moving
secret-verify-leak into its own directory makes sure that the context
dir is used only by this one test.

Also renamed Dockerfile -> Containerfile and cleaned up unused
Containerfiles.

Signed-off-by: Ashley Cui <acui@redhat.com>
2022-03-08 10:05:42 -05:00
😎 Mostafa Emami 611b45c517 Inspect network info of a joined network namespace
Closes: https://github.com/containers/podman/issues/13150
Signed-off-by: 😎 Mostafa Emami <mustafaemami@gmail.com>
2022-03-08 11:00:36 +01:00
Hironori Shiina d2f77c2568 Set default rule at the head of device configuration
The default rule should be set at the head of device configuration.
Otherwise, rules for user devices are overridden by the default rule so
that any access to the user devices are denied.

Signed-off-by: Hironori Shiina <shiina.hironori@jp.fujitsu.com>
2022-03-07 18:12:17 -05:00
OpenShift Merge Robot be3858bcf1
Merge pull request #13406 from jwhonce/wip/docker-py
Move all python tests to pytest
2022-03-07 06:30:57 -05:00
Urvashi Mohnani d302c08cff Throw an error if kube yaml has duplicate ctr names
Error out if the kube yaml passed to play kube has more
than one container or init container with the same name.

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2022-03-04 15:08:52 -05:00
Jhon Honce dca2e7924b Move all python tests to pytest
* Add configuration to add report header for python client used in tests
* Move report headers into the individual test runners vs runner.sh

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-03-04 10:35:29 -07:00
OpenShift Merge Robot f4d6e87772
Merge pull request #13413 from giuseppe/pod-no-use-cgroups-if-disabled
libpod: pods do not use cgroups if --cgroups=disabled
2022-03-04 04:26:22 -05:00
OpenShift Merge Robot 3cfb70f953
Merge pull request #13404 from flouthoc/bump-to-race-free-deps
deps: bump to race-free `c/image` and `c/storage` along with test to verify `concurrent/parallel` builds
2022-03-03 12:15:19 -05:00
Aditya R 63f92d0a66
test: add a test to verify race free concurrent/parallel builds
Invoking parallel/concurrent builds from podman race against each other
following behviour was fixed in
https://github.com/containers/storage/pull/1153 and https://github.com/containers/image/pull/1480

Test verifies if following bug is fixed in new race-free API or not.
Read more about this issue, see bz 2055487 for more details.

More details here: https://github.com/containers/buildah/pull/3794 and https://github.com/containers/podman/pull/13339

Co-authored-by: Ed Santiago <santiago@redhat.com>
Signed-off-by: Aditya R <arajan@redhat.com>
2022-03-03 21:03:35 +05:30
Giuseppe Scrivano a901c919ab
libpod: pods do not use cgroups if --cgroups=disabled
do not attempt to use cgroups with pods if the cgroups are disabled.
A similar check is already in place for containers.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-03-03 13:23:07 +01:00
Aditya R 0bd0ad5943
container: workdir resolution must consider symlink if explicitly configured
While resolving `workdir` we mostly create a `workdir` when `stat`
fails with `ENOENT` or `ErrNotExist` however following cases are not
true when user explicitly specifies a `workdir` while `running` using
`--workdir` which tells `podman` to only use workdir if its exists on
the container. Following configuration is implicity set with other
`run` mechanism like `podman play kube`

Problem with explicit `--workdir` or similar implicit config in `podman play
kube` is that currently podman ignores the fact that workdir can also be
a `symlink` and actual `link` could be valid.

Hence following commit ensures that in such scenarios when a `workdir`
is not found and we cannot create a `workdir` podman must perform a
check to ensure that if `workdir` is a `symlink` and `link` is resolved
successfully and resolved link is present on the container then we
return as it is.

Docker performs a similar behviour.

Signed-off-by: Aditya R <arajan@redhat.com>
2022-03-02 19:02:33 +05:30
OpenShift Merge Robot f0c6114a39
Merge pull request #13380 from jwhonce/wip/docker-py
Refactor docker-py compatibility tests
2022-03-01 15:20:38 -05:00
Jhon Honce 7729afe979 Refactor docker-py compatibility tests
* Add which python client is being used to run tests, see "python
  client" below.
* Remove redundate code from test classes
* Update/Add comments to modules and classes

======================================================= test session starts ========================================================
platform linux -- Python 3.10.0, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
python client -- DockerClient
rootdir: /home/jhonce/Projects/go/src/github.com/containers/podman
plugins: requests-mock-1.8.0
collected 33 items

test/python/docker/compat/test_containers.py ...s..............  [ 54%]
test/python/docker/compat/test_images.py ............  [ 90%]
test/python/docker/compat/test_system.py ...  [100%]

Note: Follow-up PRs will verify the test results and expand the tests.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-03-01 09:06:52 -07:00
Daniel J Walsh 675d775eb5
Add --context-dir option to podman play kube
This option was requested so that users could specify alternate
locations to find context directories for each image build. It
requites the --build option to be set.

Partion Fix: https://github.com/containers/podman/issues/12485

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-03-01 08:47:09 -05:00
OpenShift Merge Robot 8bdda91ab7
Merge pull request #13362 from keonchennl/pod-logs-add-flag
Add the names flag for pod logs
2022-03-01 08:43:50 -05:00
Xueyuan Chen 40c6192e9e Add the names flag for pod logs
Fixes containers#13261

Signed-off-by: Xueyuan Chen <X.Chen-47@student.tudelft.nl>
2022-03-01 00:18:39 +01:00
Daniel J Walsh 3dc1b8e83f
Add podman volume mount support
Fixes: https://github.com/containers/podman/issues/12768

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-02-28 14:26:22 -05:00
OpenShift Merge Robot 991c90de1f
Merge pull request #13314 from flouthoc/container-commit-squash
container-commit: support `--squash` to squash layers into one if users want.
2022-02-23 13:07:00 -05:00
Aditya R fbbcb957c7
container-commit: support --squash to squash layers into one
Allow users to commit containers into a single layer.

Usage
```bash
podman container commit --squash <name>
```

Signed-off-by: Aditya R <arajan@redhat.com>
2022-02-23 17:38:28 +05:30
OpenShift Merge Robot 8b2432422f
Merge pull request #13232 from rhatdan/volumes
Don't log errors on removing volumes inuse, if container --volumes-from
2022-02-23 03:26:59 -05:00
Daniel J Walsh 6f7a803d06
Cleanup display of trust with transports
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-02-22 15:08:58 -05:00
OpenShift Merge Robot fab82a7c9c
Merge pull request #13059 from cdoern/clone
Implement Podman Container Clone
2022-02-22 10:10:49 -05:00
Daniel J Walsh c4dfbd58f5
Don't log errors on removing volumes inuse, if container --volumes-from
When removing a container created with a --volumes-from a container
created with a built in volume, we complain if the original container
still exists.  Since this is an expected state, we should not complain
about it.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-02-21 16:47:12 -05:00
Paul Holzinger b19251242e
system tests: cleanup networks on teardown
When a test which creates a network fail it will not remove the network.
The teardown logic should remove the networks. Since there is no --all
option for network rm we use network prune --force.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-02-21 21:57:08 +01:00
OpenShift Merge Robot a746a61a17
Merge pull request #13286 from flouthoc/kube-build-false-default
kube: honor `--build=false` if specified.
2022-02-21 15:33:39 -05:00
OpenShift Merge Robot b3963e7081
Merge pull request #13296 from Romain-Geissler-1A/url-and-connection-implies-remote
Option --url and --connection should imply --remote.
2022-02-21 15:21:37 -05:00
OpenShift Merge Robot c9359e1494
Merge pull request #13306 from Luap99/flag-error
provide better error on invalid flag
2022-02-21 15:11:37 -05:00
Aditya R 9ce61e3a49
kube: honor --build=false and make --build=true by default
`podman play kube` tries to build images even if `--build` is set to
false so lets honor that and make `--build` , `true` by default so it
matches the original behviour.

Signed-off-by: Aditya R <arajan@redhat.com>
2022-02-21 23:52:48 +05:30
Paul Holzinger 44d037898e
provide better error on invalid flag
Add a extra `See 'podman command --help'` to the error output.
With this patch you now get:
```
$ podman run -h
Error: flag needs an argument: 'h' in -h
See 'podman run --help'
```

Fixes #13082
Fixes #13002

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-02-21 19:12:12 +01:00
Ed Santiago f018c07edf System tests: show one-line config overview
We're running into problems that are impossible to diagnose
because we have no idea if the SUT is using netavark or CNI.
We've previously run into similar problems with runc/crun,
or cgroups 1/2.

This adds a one-line 'echo' with important system info. Now,
when viewing a full test log, it will be possible to view
system settings in one glance.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-02-21 08:49:11 -07:00
cdoern 94df701512 Implement Podman Container Clone
podman container clone takes the id of an existing continer and creates a specgen from the given container's config
recreating all proper namespaces and overriding spec options like resource limits and the container name if given in the cli options

this command utilizes the common function DefineCreateFlags meaning that we can funnel as many create options as we want
into clone over time allowing the user to clone with as much or as little of the original config as they want.

container clone takes a second argument which is a new name and a third argument which is an image name to use instead of the original container's

the current supported flags are:

--destroy (remove the original container)
--name (new ctr name)
--cpus (sets cpu period and quota)
--cpuset-cpus
--cpu-period
--cpu-rt-period
--cpu-rt-runtime
--cpu-shares
--cpuset-mems
--memory
--run

resolves #10875

Signed-off-by: cdoern <cdoern@redhat.com>
Signed-off-by: cdoern <cbdoer23@g.holycross.edu>
Signed-off-by: cdoern <cdoern@redhat.com>
2022-02-20 21:11:14 -05:00
Romain Geissler 23a7f4e0de Option --url and --connection should imply --remote.
Closes #13242

Signed-off-by: Romain Geissler <romain.geissler@amadeus.com>
2022-02-19 14:53:37 +00:00
David Gibson db4d15e852 Propagate $CONTAINERS_CONF to conmon
The CONTAINERS_CONF environment variable can be used to override the
configuration file, which is useful for testing.  However, at the moment
this variable is not propagated to conmon.  That means in particular, that
conmon can't propagate it back to podman when invoking its --exit-command.
The mismatch in configuration between the starting and cleaning up podman
instances can cause a variety of errors.

This patch also adds two related test cases.  One checks explicitly that
the correct CONTAINERS_CONF value appears in conmon's environment.  The
other checks for a possible specific impact of this bug: if we use a
nonstandard name for the runtime (even if its path is just a regular crun),
then the podman container cleanup invoked at container exit will fail.
That has the effect of meaning that a container started with -d --rm won't
be correctly removed once complete.

Fixes #12917

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2022-02-18 12:35:25 +11:00
David Gibson d615ab81f9 tests: Remove inaccurate comment
This comment refers to overiding $PODMAN although the code below does
nothing of the sort.  Presumbly the comment has been outdated by altering
the containers.conf / $CONTAINERS_CONF instead.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2022-02-18 12:35:25 +11:00
Matthew Heon 1252f9dd33 Fix a potential flake in volume plugins tests
We could remove the container running the volume plugins, before
the containers using the volume plugins; this could cause
unmounting the volumes to fail because the plugin could not be
contacted.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2022-02-17 09:46:35 -05:00
Valentin Rothberg b62816578e e2e: merge after/since image-filter tests
Merge the two tests to speed up testing.  Both built the exact same
images.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-02-16 10:33:57 +01:00
Brent Baude 6a8d29eead Changes of docker descriptions
It looks like some descriptions have changed on the docker registry
where we had been searching for images that include 'alpine'.  We are
now seeing an image in the initial list that has 'alpine' in its
description.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2022-02-15 15:21:00 -06:00
Brent Baude 5b98efe1d1 Fix images since/after tests
For the since and after imagve filter tests, instead of using the
read-only cache of images, we just use the empty r/w store.  We then
build three images that are strictly predictable.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2022-02-15 12:33:51 -06:00
OpenShift Merge Robot eb19a7582e
Merge pull request #13144 from lsm5/e2e-netavark
enable netavark specific tests
2022-02-11 20:44:07 -05:00
OpenShift Merge Robot 1b22ad95c1
Merge pull request #13214 from adrianreber/2022-02-11-fix-tests
Fix checkpoint/restore pod tests
2022-02-11 16:46:08 -05:00
Lokesh Mandvekar 6f9f78f7f2 enable netavark specific tests
These are copies of the CNI tests with modifications wherever
neccessary.

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2022-02-11 13:34:28 -05:00
Adrian Reber 4b90542d5b
Fix checkpoint/restore pod tests
Checkpoint/restore pod tests are not running with an older runc and now
that runc 1.1.0 appears in the repositories it was detected that the
tests were failing. This was not detected in CI as CI was not using runc
1.1.0 yet.

Signed-off-by: Adrian Reber <areber@redhat.com>
2022-02-11 15:11:48 +00:00
Daniel J Walsh 4966adddbb
Make sure building with relative paths work correctly.
Fixes: https://github.com/containers/podman/issues/12763

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-02-10 20:40:09 -05:00
OpenShift Merge Robot 0144413a5a
Merge pull request #13191 from mheon/resolvconf_fixes
Modify /etc/resolv.conf when connecting/disconnecting
2022-02-10 12:24:03 -05:00
Matthew Heon 87cca4e5e3 Modify /etc/resolv.conf when connecting/disconnecting
The `podman network connect` and `podman network disconnect`
commands give containers access to different networks than the
ones they were created with; these networks can also have DNS
servers associated with them. Until now, however, we did not
modify resolv.conf as network membership changed.

With this PR, `podman network connect` will add any new
nameservers supported by the new network to the container's
/etc/resolv.conf, and `podman network disconnect` command will do
the opposite, removing the network's nameservers from
`/etc/resolv.conf`.

Fixes #9603

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2022-02-10 09:44:00 -05:00
Jhon Honce c4676c5719 Add version guard to libpod API endpoints
* Ensure meaningful behaviour when called with /v3.x.x semantics
* Change return code to 409 from 500 when client attempts to use an
  existing network name
* Update API bats test runner to support /v4.0.0 endpoints by default

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-02-09 14:22:42 -07:00
OpenShift Merge Robot cbd0980d5b
Merge pull request #13159 from Luap99/slirp4-scope
move rootless netns slirp4netns process to systemd user.slice
2022-02-08 07:10:15 -05:00
Paul Holzinger 8d0fb0a4ed
move rootless netns slirp4netns process to systemd user.slice
When running podman inside systemd user units, it is possible that
systemd kills the rootless netns slirp4netns process because it was
started in the default unit cgroup. When the unit is stopped all
processes in that cgroup are killed. Since the slirp4netns process is
run once for all containers it should not be killed. To make sure
systemd will not kill the process we move it to the user.slice.

Fixes #13153

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-02-07 17:38:53 +01:00
OpenShift Merge Robot 46d9a2570a
Merge pull request #13156 from flouthoc/fix-compat-build-response-header
compat: endpoint `/build` must set header `content type` as `application/json` in response header.
2022-02-07 10:34:22 -05:00
Ed Santiago d0d1ffa43e Cleanup: remove obsolete/misleading bug workaround
Followup to #13129: remove a no-longer-necessary workaround
for a healthcheck bug.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-02-07 06:58:19 -07:00
OpenShift Merge Robot b1dcd025c6
Merge pull request #13129 from flouthoc/healthcheck-session-read-from-pipe
healthcheck, libpod: Read healthcheck event output from os pipe
2022-02-07 08:52:23 -05:00
Aditya R 3b561a4682
compat: endpoint /build must set header content type as application/json in reponse
Lot of clients are expecting proper `Content-type: application/json`
configured in response headers of `/build` compat api. Following commit
fixes that.

Fixes issues where code is setting header field after writing header
which is wrong. We must set `content-type` before we write and flush
http header.

Signed-off-by: Aditya R <arajan@redhat.com>
2022-02-07 13:38:19 +05:30
OpenShift Merge Robot ec390d5d35
Merge pull request #13143 from Luap99/dns
append podman dns search domain
2022-02-04 11:49:11 -05:00
Aditya R 3cf64a8e9a
tests: retrofit healthcheck system tests
All the healthcheck return output now but systems tests is written to
expect empty output which seems wrong.

Modify jq output to contain newline character rather than actual newline

Signed-off-by: Aditya R <arajan@redhat.com>
2022-02-04 21:15:15 +05:30
Aditya R 4f77331c9d
healthcheck, libpod: Read healthcheck event output from os pipe
It seems we are ignoring output from healthcheck session.
Open a valid pipe to healthcheck session in order read its output.

Use common pipe for both `stdout/stderr` since that was the previous
behviour as well.

Signed-off-by: Aditya R <arajan@redhat.com>
2022-02-04 21:15:03 +05:30
Paul Holzinger d733c3baa2
append podman dns search domain
Append the podman dns seach domain to the host search domains when we
use the dnsname/aardvark server. Previously it would only use podman
seach domains and discard the host domains.

Fixes #13103

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-02-04 16:16:06 +01:00
OpenShift Merge Robot 956664f65b
Merge pull request #12930 from cdoern/podCgroup
Podman pod create --share-parent vs --share=cgroup
2022-02-04 09:41:12 -05:00
Ed Santiago 7cfe4d3fe7 System tests: revert emergency skip of checkpoint tests
Revert #13049. criu-3.16.1-6.fc36 fixes the problem and is
now in fc36 stable:

   https://bodhi.fedoraproject.org/updates/FEDORA-2022-183b337712

(Yes, I confirmed that tests pass on a rawhide vm)

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-02-03 14:48:35 -07:00
Chris Evich 642a691cbb
Cirrus: Add netavark/aardvark system test task
Also add a system-test that verifies netavark driver is in use when
magic env. var. is set.

Signed-off-by: Chris Evich <cevich@redhat.com>
2022-02-03 13:07:56 -05:00
OpenShift Merge Robot 08930b24b9
Merge pull request #13117 from Luap99/resolv
Revert "Move each search dns to its own line"
2022-02-03 09:37:20 -05:00
cdoern 9eb88ea474 Podman pod create --share-parent vs --share=cgroup
separated cgroupNS sharing from setting the pod as the cgroup parent,
made a new flag --share-parent which sets the pod as the cgroup parent for all
containers entering the pod

remove cgroup from the default kernel namespaces since we want the same default behavior as before which is just the cgroup parent.

resolves #12765

Signed-off-by: cdoern <cdoern@redhat.com>
Signed-off-by: cdoern <cbdoer23@g.holycross.edu>
Signed-off-by: cdoern <cdoern@redhat.com>
2022-02-03 09:30:17 -05:00
Paul Holzinger 55c4a1468b
system prune: remove all networks
podman system prune should also remove all networks. When we want to
users to migrate to the new network stack we recommend to run podman
system reset. However this did not remove networks and if there were
still networks around we would continue to use cni since this was
considered an old system.

There is one exception for the default network. It should not be removed
since this could cause other issues when it no longer exists. The
network backend detection logic ignores the default network so this is
fine.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-02-03 13:14:07 +01:00
OpenShift Merge Robot 89f71177aa
Merge pull request #12859 from baude/netavarke2e
Enable e2e tests with netavark
2022-02-02 16:41:26 -05:00
Brent Baude 7d3ad6081f netavark e2e tests
enabled e2e tests for netavark

Signed-off-by: Brent Baude <bbaude@redhat.com>
2022-02-02 13:03:45 -06:00
Paul Holzinger 25e073492f
Revert "Move each search dns to its own line"
This reverts commit a1bc8cb52c.
Please see resolv.conf(5) search domains must be on the same line. If
you use multiple seach key words only the last one is used. I tested this
with alpine and it works correctly when they are on the same line so I
am not sure what issues Dan had with it but this is not correct.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-02-02 19:33:21 +01:00
Daniel J Walsh a1bc8cb52c
Move each search dns to its own line
Alpine does not seem to use search correctly when there are multiple
search domains on the same line. It only uses the first with the advent.
When podman runs within a separate network we are appending on
dns.podman as a search, if you add a search domain, then this causes the
local search on network to fail.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-02-02 11:01:09 -05:00
Daniel J Walsh 4ddc4e79d7
Only change network fields if they were actually changed by the user
Fixes: https://github.com/containers/podman/issues/13065

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-02-02 10:28:34 -05:00
OpenShift Merge Robot 72c505a181
Merge pull request #13107 from rhatdan/shm
Fix size to match Docker selection
2022-02-02 09:36:45 -05:00
Giuseppe Scrivano c4dfd004ad
libpod: enforce noexec,nosuid,nodev for /dev/shm
these mount flags are already used for the /dev/shm mount on the host,
but they are not set for the bind mount itself.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-02-02 10:03:18 +01:00
Daniel J Walsh b6fe7d1191
Fix size to match Docker selection
Fixes: https://github.com/containers/podman/issues/13096

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-02-01 17:19:19 -05:00
OpenShift Merge Robot 71c3bdba0e
Merge pull request #13085 from ydayagi/main
play kube envVar.valueFrom.fieldRef
2022-02-01 15:31:37 -05:00
Giuseppe Scrivano 865f0a1977
libpod: report slirp4netns network stats
by default slirp4netns uses the tap0 device.  When slirp4netns is
used, use that device by default instead of eth0.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-02-01 16:23:58 +01:00
Daniel J Walsh 6609bb73aa
Fix use of infra image to clarify default
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-31 17:21:25 -05:00
Yaron Dayagi 2ceab11947 play kube envVar.valueFrom.fieldRef
add support for env vars values from pod spec fields
see https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#envvarsource-v1-core

relates to issue https://github.com/containers/podman/issues/12756

Signed-off-by: Yaron Dayagi <ydayagi@redhat.com>
2022-01-31 21:49:38 +02:00
OpenShift Merge Robot 1b544b7424
Merge pull request #12712 from flouthoc/volume_overlay_advanced
volume: add support for non-volatile `upperdir`,`workdir` for overlay volumes
2022-01-28 07:06:02 -05:00
Aditya Rajan e64e6500d3
volume: add support for non-volatile upperdir,workdir for overlay volumes
Often users want their overlayed volumes to be `non-volatile` in nature
that means that same `upper` dir can be re-used by one or more
containers but overall of nature of volumes still have to be `overlay`
so work done is still on a overlay not on the actual volume.

Following PR adds support for more advanced options i.e custom `workdir`
and `upperdir` for overlayed volumes. So that users can re-use `workdir`
and `upperdir` across new containers as well.

Usage
```console

$ podman run -it -v myvol:/data:O,upperdir=/path/persistant/upper,workdir=/path/persistant/work alpine sh

```

Signed-off-by: Aditya R <arajan@redhat.com>
2022-01-28 13:10:15 +05:30
Daniel J Walsh 908329c390
Merge pull request #13049 from edsantiago/bats
System tests: emergency skip of checkpoint tests
2022-01-27 13:20:41 -05:00
OpenShift Merge Robot bedbc3e6fc
Merge pull request #13042 from Luap99/subnets
network create: allow multiple subnets
2022-01-27 12:16:50 -05:00
Ed Santiago d455bb879d System tests: emergency skip of checkpoint tests
...on kernel 5.17, because it's broken

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-01-27 09:18:06 -07:00
Paul Holzinger 6961d91206
network create: allow multiple subnets
podman network create --subnet, --gateway and --ip-range can now be
specified multiple times to join the network to more than one subnet.
This is very useful if you want to use a dual stack network and assign a
fixed ipv4 and ipv6 subnet. The order of the options is important here,
the first --gateway/--ip-range will be assigned to the first subnet and
so on.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-27 16:38:39 +01:00
OpenShift Merge Robot 5b01dab618
Merge pull request #13029 from TomSweeneyRedHat/dev/tsweeney/mergepull2
Bump Buildah to v1.24.0
2022-01-27 08:38:52 -05:00
tomsweeneyredhat 4a4d86d40f Bump Buildah to v1.24.0
Bumps Buildah to v1.24.0 and adopts the new values for pull:
true, false, never, and always.  The pull-never and pull-always options
for the build command are still usable, but they have been removed from
the man page documentation with this change.

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2022-01-27 07:03:56 -05:00
cdoern 77cd38d40c switch podman image scp from depending on machinectl to just os/exec
machinectl does not propogate error messages and adds extra lines in the output, exec.Cmd is able to clear the env besides PATH and TERM,
and use the given UID and GID to execute the command properly.

machinectl is still used to create a user session. Ubuntu support is limited by this.

Signed-off-by: cdoern <cdoern@redhat.com>
2022-01-26 14:40:44 -05:00
Ed Santiago 7cdb00a459 CI: enable rootless-remote system tests
Minimal: only test Fedora.Latest.

Reason: podman 4.0.0-0.2.rc2 broke bodhi gating tests:
        https://github.com/containers/podman/issues/12989

Requires skipping two recently-added tests that use 'podman unshare',
which doesn't work on remote.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-01-24 15:09:48 -07:00
OpenShift Merge Robot 4988e39c64
Merge pull request #12982 from rhatdan/default
Show correct default values or show none
2022-01-24 15:38:46 -05:00
Daniel J Walsh 1cddd63976
Show correct default values or show none
Before this PR, the podman --help command shows the defaults
as runc and overlay even if the storage.conf and containers.conf
files do not match. This PR changes them to show the actual defaults
and in the case of storage driver, does not show the default at all.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-24 13:15:42 -05:00
Paul Holzinger 2f371cb12c
container create: do not check for network dns support
We should not check if the network supports dns when we create a
container with network aliases. This could be the case for containers
created by docker-compose for example if the dnsname plugin is not
installed or the user uses a macvlan config where we do not support dns.

Fixes #12972

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-24 16:56:11 +01:00
OpenShift Merge Robot d847ad598d
Merge pull request #12961 from rhatdan/codespell
Run codespell
2022-01-21 14:55:26 -05:00
OpenShift Merge Robot e3ea996919
Merge pull request #12951 from rhatdan/commit
Fix #2 for compat commit handling of --changes
2022-01-21 10:07:27 -05:00
Daniel J Walsh 5736649eb8
Run codespell on code
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-21 09:52:12 -05:00
OpenShift Merge Robot 3074a98378
Merge pull request #12943 from machacekondra/nil_fix
Fix nil pointer dereference for configmap optional
2022-01-21 07:29:25 -05:00
Daniel J Walsh 653da8fe8f
Fix #2 for compat commit handling of --changes
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-21 07:22:36 -05:00
Ondra Machacek 9d815707e2 Fix nil pointer dereference for configmap optional
This PR fixes nil pointer dereference for configmap optional parameter.
When optional parameter is not passed, the code tried to acces the
parameter which caused nil pointer dereference.

Signed-off-by: Ondra Machacek <omachace@redhat.com>
2022-01-21 10:01:32 +01:00
David Gibson 0b5136c7ce Make error message matching in 030-run.bats less fragile
Amongst other things 030-run.bats checks for sensible error messages when
attempting a "podman run" with a non-existent or inaccessible path.  It
checks for these messages, which come from the low-level runtime, in a lot
of detail, including separate versions for runc and crun.  This is fragile
in several ways:
  * It's likely to fail if using a runtime other than crun or runc
  * It relies on detecting whether the runtime is crun vs. runc using the
    path, which could fail if the binary has been named something unusual
  * It will break if crun or runc ever alter their error message (even if
    it's just changing case)

This replaces the checked versions with a much more accepting regex which
will work for both the runc and crun messages, while still looking for the
essential pieces.  This isn't guaranteed to work with other runtimes, but
it's much more likely to.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2022-01-21 13:51:25 +11:00
David Gibson 9241b4e340 Don't explicitly check for crun|runc in package information
Amongst other things 005-info.bats tests that the host.ociRuntime.package
field in the output from "podman info" reports something containing "crun"
or "runc".

While those are obviously the dominant runtimes in practice, it seems
undesirable to explicitly exclude them in testing.  So, remove this
specific test.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2022-01-21 13:51:25 +11:00
OpenShift Merge Robot 993c072029
Merge pull request #12942 from flouthoc/compat-load-tar-with-multiple-images
compat: `images/load` must be able to load tar with multiple images
2022-01-20 17:29:31 -05:00
OpenShift Merge Robot ca62a39985
Merge pull request #12950 from edsantiago/systemd_250
System tests: fix for new systemd on rawhide
2022-01-20 15:01:29 -05:00
Aditya R 9df31cfb77
compat: images/load must be able to load tar with multiple images
`http:/host:port/images/load` fails to accept tar with more than one
images however manual load works as expected. Remove explicit check for
`1` image and only fail if result set has value less than `1`.

Signed-off-by: Aditya R <arajan@redhat.com>
2022-01-21 00:23:54 +05:30
Ed Santiago 47df14af52 System tests: fix for new systemd on rawhide
systemd 250 on f36 has changed the output format of a message
our tests rely on. This breaks bodhi gating tests. Fix test
so it accepts a continually-growing set of systemd outputs.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-01-20 11:28:41 -07:00
Jhon Honce 1f85244abe Engine.Remote from containers.conf
Heuristic to initialize TunnelMode/remote podman:
- Podman built with remote tag
- Podman running on darwin or windows GOOS
- CONTAINER_HOST or CONTAINER_CONNECTION set in environment
- --remote flag given on command line
- From containers.conf, Engine.Remote == true and GOOS == linux

Otherwise, podman will run in ABIMode/linked against libpod library.

Fixes #12866

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-01-20 08:51:34 -07:00
OpenShift Merge Robot 7fc8bf4a42
Merge pull request #12887 from esendjer/main
Add custom defined dependencies to podman generate systemd
2022-01-19 20:29:01 -05:00
OpenShift Merge Robot d2c892c729
Merge pull request #12914 from rhatdan/commit
Handle changes in docker compat mode
2022-01-19 17:19:00 -05:00
Daniel J Walsh c674d3cc75
Handle changes in docker compat mode
Fixes: https://github.com/containers/podman/issues/12830

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-19 13:03:58 -05:00
esendjer b9a2d8698a Handlers for `generate systemd` with custom dependencies
This commit includes:
* Handlers for generate systemd unit
  with manually defined dependencies such as:
  Wants=, After= and Requires=

* The new unit and e2e tests for checking generated systemd units
  for container and pod with custom dependencies

* Documented descriptions for custom dependencies options

Signed-off-by: Eugene (Evgenii) Shubin <esendjer@gmail.com>
2022-01-19 21:46:16 +05:00
Ed Santiago abcd292396 APIv2 tests: followup to recent log test
Followup to #12919, which merged while I was writing
review feedback. This actually confirms log output.
This required a minor change to the 't' helper: stripping
NUL chars from the http result.

And, while I'm at it, a bunch of cleanup for running rootless:
- set $CONTAINERS_HELPER_BINARY_DIR, so we can find rootlessport
- add a few conditionals for different expectations

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-01-19 09:13:22 -07:00
OpenShift Merge Robot 8301a7cd82
Merge pull request #12862 from matejvasek/fix-info-ep
Add IndexConfigs info to compat /info endpoint
2022-01-19 09:29:05 -05:00
Matej Vasek 4b384e08a9 Add IndexConfigs to compat /info endpoint
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-01-19 13:46:32 +01:00
Valentin Rothberg af6a43fa49 apiv2 test: add regression test for #12904
Add a regression test for issue #12904 to make sure that attaching with
logs=true to the compact endpoint does not blow up.  Note that I did not
find a way to test the output (i.e., '123'); logs are sent in a binary
format and I did not find a way to compare the control characters.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2022-01-19 09:33:34 +01:00
OpenShift Merge Robot 094b11cbcb
Merge pull request #12908 from Luap99/network-conf-dir
rename --cni-config-dir to --network-config-dir
2022-01-18 15:42:06 -05:00
Paul Holzinger c0e0723463
rename --cni-config-dir to --network-config-dir
Since this option will also be used for netavark we should rename it to
something more generic. It is important that --cni-config-dir still
works otherwise we could break existing container cleanup commands.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-18 19:28:25 +01:00
Valentin Rothberg 7e30531f20 compat attach: fix write on closed channel
Waiting on an initialized sync.WaitGroup returns immediately.
Hence, move the goroutine to wait and close *after* reading
the logs.

Fixes: #12904
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2022-01-18 16:32:38 +01:00
OpenShift Merge Robot 0bbf8fa140
Merge pull request #12797 from edsantiago/test_image_scp_sudo
Tests for podman image scp (the sudo form)
2022-01-18 10:30:08 -05:00
Valentin Rothberg bd09b7aa79 bump go module to version 4
Automated for .go files via gomove [1]:
`gomove github.com/containers/podman/v3 github.com/containers/podman/v4`

Remaining files via vgrep [2]:
`vgrep github.com/containers/podman/v3`

[1] https://github.com/KSubedi/gomove
[2] https://github.com/vrothberg/vgrep

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2022-01-18 12:47:07 +01:00
OpenShift Merge Robot d6b0720b9c
Merge pull request #12684 from mheon/remap_states
Revamp Libpod state strings for Docker compat
2022-01-18 06:22:05 -05:00
OpenShift Merge Robot d0eb24bae0
Merge pull request #12870 from rhatdan/userns1
Use PODMAN_USERNS environment variable when running as a service
2022-01-18 06:08:06 -05:00
Ed Santiago 471a4356bf CI: rootless user: also create in some root tests
viz, rootful system tests. The rootless account will be
used by image-scp tests.

Unfortunately, having ssh available means the system-connection
tests will start running, which is very bad because they will
fail, because system connection doesn't actually work (long story).
Add a few more checks to prevent this test from running.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-01-17 14:40:30 -07:00
Ed Santiago c8124b88ae [WIP] Tests for podman image scp (the sudo form)
Start inching our way back to having tests for the sudo form
of podman image scp. Basically, copy an image to another user
and then back, using a pseudorandom name. Confirm that the
image makes it to the remote end, and that when we copy it
back, the original image digest is preserved.

When scp'ing as root, we identify the destination rootless
user account via the $PODMAN_ROOTLESS_USER envariable. Setting
this and creating the account is left as an exercise for the
CI framework (be it github, or Fedora/CentOS/RHEL gating, or
other).

Also: amend hack/bats to set and relay $PODMAN_ROOTLESS_USER,
so developers can test locally.

Also: remove what I'm 99% sure is a debugging printf.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-01-17 14:40:30 -07:00
Matthew Heon 141de86862 Revamp Libpod state strings for Docker compat
Improve our compatibility with Docker by better handling the
state strings that we print in `podman ps`. Docker capitalizes
all states in `ps` (we do not) - fix this in our PS code. Also,
stop normalizing ContainerStateConfigured to the "Created" state,
and instead make it always be Created, with the existing Created
state becoming Initialized.

I didn't rename the actual states because I'm somewhat reticent
to make such a large change a day before we leave for break. It's
somewhat confusing that ContainerStateConfigured now returns
Created, but internally and externally we're still consistent.

[NO NEW TESTS NEEDED] existing tests should catch anything that
broke.

I also consider this a breaking change. I will flag appropriately
on Github.

Fixes RHBZ#2010432 and RHBZ#2032561

Signed-off-by: Matthew Heon <mheon@redhat.com>
2022-01-17 13:56:07 -05:00
OpenShift Merge Robot 8514ebd182
Merge pull request #12860 from rhatdan/cgroups
Use CONTAINERS_CONF cgroups flag for remote API.
2022-01-17 12:57:20 +01:00
Daniel J Walsh 10d969ff1a
Use PODMAN_USERNS environment variable when running as a service
Fixes: https://github.com/containers/podman/issues/11350#issuecomment-1011562526

Also add inspect information about the idmappings if they exists.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-17 06:48:54 -05:00
Erik Sjölund 3c2a5947c2 fix default branch links
* Replace https://github.com/containers/podman/blob/master
  with https://github.com/containers/podman/blob/main
  to match the new default branch "main". Previously
  the default branch was "master". This is the only
  occurence found in the code.

* Replace https://raw.githubusercontent.com/containers/libpod/master
  with https://raw.githubusercontent.com/containers/podman/main

Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
2022-01-15 22:08:42 +01:00
OpenShift Merge Robot a50d0837b6
Merge pull request #12527 from jwhonce/wip/manifest4
Refactor manifest list operations
2022-01-15 15:53:16 +01:00
Jhon Honce 8a7e70919f Refactor manifest list operations
* Update method/function signatures use the manifest list name and
  images associated with the operation explicitly, in general

  func f(ctx context.Context, manifestListName string,
         ImageNames []string, options *fOptions)

* Leverage gorilla/mux Subrouters to support API v3.x and v4.x for
  manifests
* Make manifest API endpoints more RESTful
* Add PUT /manifest/{id} to update existing manifests
* Add manifests.Annotate to go bindings, uncommented unit test
* Add DELETE /manifest/{Id} to remove existing manifest list, use
  PUT /manifest/{id} to remove images from a list
* Deprecated POST /manifest/{id}/add and /manifest/{id}/remove, use
  PUT /manifest/{id} instead
* Corrected swagger godoc and updated to cover API changes
* Update podman manifest commands to use registry.Context()
* Expose utils.GetVar() to obtain query parameters by name
* Unexpose server.registerSwaggerHandlers, not sure why this was ever
  exposed.
* Refactored code to use http.Header instead of map[string]string when
  operating on HTTP headers.
* Add API-Version header support in bindings to allow calling explicate
  versions of the API. Header is _NOT_ forwarded to the API service.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-01-14 16:13:35 -07:00
OpenShift Merge Robot ecf818a1cd
Merge pull request #12858 from rhatdan/hosts
test/system: podman run update /etc/hosts
2022-01-14 18:48:17 +01:00
Daniel J Walsh 607cb80bf7
Fix cgroup mode handling in api server
Also change code to globably be consistent when refering to capatilized
Cgroup.

Fixed: https://github.com/containers/podman/issues/12550

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-14 12:32:35 -05:00
Daniel J Walsh a15dfb3648
Standardize on capatalized Cgroups
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-14 12:30:20 -05:00
OpenShift Merge Robot 7ab99227e6
Merge pull request #12825 from elezar/update-cdi
Update use of CDI API
2022-01-14 15:17:21 +01:00
Daniel J Walsh 13917dfab9
test/system: podman run update /etc/hosts
This test case is used for covering rhbz#1902979.

Signed-off-by: Alex Jia <ajia@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-14 07:51:23 -05:00
Evan Lezar 72ab66d886 Use fully-qualified device name in CDI test
Signed-off-by: Evan Lezar <elezar@nvidia.com>
2022-01-14 13:35:22 +01:00
OpenShift Merge Robot 9686216f9d
Merge pull request #12853 from cdoern/buildRelative
Podman Build use absolute filepath
2022-01-14 13:12:16 +01:00
OpenShift Merge Robot 482e0b11d9
Merge pull request #12849 from cdoern/podProhibit
Prohibit --uid/gid map and --pod for container create/run
2022-01-14 13:08:17 +01:00
cdoern bf3734ad53 Podman Build use absolute filepath
podman build always finds the abs path but was never using it for the containerfile path. This
was causing the remote client to be given a relative path that does not exist. Switch to evaluating and using absolute paths only.

resolves #12841

Signed-off-by: cdoern <cdoern@redhat.com>
2022-01-13 16:44:10 -05:00
cdoern 6996830104 Prohibit --uid/gid map and --pod for container create/run
add a check in namespaceOptions() that ensures the user is not setting a new uid/gid map
if entering or creating a pod that has an infra container

resolves #12669

Signed-off-by: cdoern <cdoern@redhat.com>
2022-01-13 14:03:51 -05:00
OpenShift Merge Robot 48e63975aa
Merge pull request #12826 from vrothberg/force-rm-pod
podman container rm: remove pod
2022-01-13 18:40:52 +01:00
OpenShift Merge Robot eeb76db0fd
Merge pull request #12642 from Luap99/libnetwork
use libnetwork from c/common
2022-01-13 18:06:54 +01:00
Valentin Rothberg a4cef54350 podman container rm: remove pod
Support removing the entire pod when --depend is used on an infra
container.  --all now implies --depend to properly support removing all
containers and not error out when hitting infra containers.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2022-01-13 17:08:31 +01:00
OpenShift Merge Robot ab7228b3c2
Merge pull request #12836 from cdoern/podSysCtl
Podman Pod Create --sysctl support
2022-01-13 16:44:52 +01:00
Ed Santiago ece768ff9e
Manual fixes for PR #12642:
- reenable git:// tests
 - git command fails with (EVIL) status 128. Deal with it.
 - skip a bunch more podman-remote tests. Filed an issue for
   one of them (#12838), the others may not be fixable.

Signed-off-by: Ed Santiago <santiago@redhat.com>
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-13 16:24:13 +01:00
OpenShift Merge Robot e98058a3cf
Merge pull request #12837 from rhatdan/events
use events_logfile_path from containers.conf for events log.
2022-01-13 15:54:53 +01:00
OpenShift Merge Robot 1b970e8598
Merge pull request #12644 from leahneukirchen/events-timestamp
remote events: convert TimeNano properly
2022-01-13 15:26:53 +01:00
Daniel J Walsh fa6405c3c3
use events_logfile_path from containers.conf for events log.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-13 08:14:50 -05:00
cdoern f257d98394 Podman Pod Create --sysctl support
added support for pod wide sysctls. The sysctls supported are the same as the continer run controls.

These controls are only valid if the proper namespaces are shared within the pod, otherwise only the infra ctr gets the sysctl

resolves #12747

Signed-off-by: cdoern <cdoern@redhat.com>
2022-01-12 20:49:04 -05:00
Giuseppe Scrivano 194d14ca2f
libpod: fix check for systemd session
move the check after the cgroup manager is set, so to correctly detect
--cgroup-manager=cgroupfs and do not raise a warning about dbus not
being present.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-01-12 21:18:15 +01:00
Paul Holzinger b24063582d
fix buildah-bud test diff
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-12 20:32:17 +01:00
Paul Holzinger 85f9cf3903
upgrade test: check that network backend is cni
Since we test an update from an older version we should check the the
network backend is correctly set to CNI.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-12 17:40:25 +01:00
Paul Holzinger 495884b319
use libnetwork from c/common
The libpod/network packages were moved to c/common so that buildah can
use it as well. To prevent duplication use it in podman as well and
remove it from here.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-12 17:07:30 +01:00
Daniel J Walsh fde6ad6373
Add --noout option to prevent the output of ids
Fixes: https://github.com/containers/podman/issues/11515

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-12 08:32:42 -05:00
Leah Neukirchen 5aedcb3643 remote events: convert TimeNano properly
e.TimeNano contains nanoseconds since epoch, not just the nanoseconds
after e.Time.

time.Unix supports nanoseconds > 999999999 and converts them to seconds,
so just passing e.TimeNano is enough.

Signed-off-by: Leah Neukirchen <leah@vuxu.org>
2022-01-12 13:25:17 +01:00
OpenShift Merge Robot 6945b37850
Merge pull request #12813 from rhatdan/secrets
Fix permission on secrets directory
2022-01-12 09:04:19 +01:00
Ed Santiago 6fa077750a buildah bud tests: skip failing tests
Emergency workaround for github's deprecation of git://

   https://github.blog/2021-09-01-improving-git-protocol-security-github/

Two buildah tests rely on 'git://' URLs. These now fail. They
have been fixed in the buildah repo[1] but it will take time
to vendor that in. ITM, we need to get CI passing. Skip those
two failing tests.

 [1] https://github.com/containers/buildah/pull/3701

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-01-11 14:20:29 -07:00
Daniel J Walsh 83b0fb4696
Fix permission on secrets directory
This directory needs to be world searchable so users can access it from
different user namespaces.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-11 16:19:50 -05:00
Daniel J Walsh 8f2358eeaa
Add podman rm --depend
This option causes Podman to not only remove the specified containers
but all of the containers that depend on the specified
containers.
Fixes: https://github.com/containers/podman/issues/10360

Also ran codespell on the code

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-11 14:33:54 -05:00
OpenShift Merge Robot ed9ef59e7e
Merge pull request #12780 from rhatdan/pod
Use the InfraImage defined in containers.conf
2022-01-11 00:25:09 +01:00
Daniel J Walsh 19a4759066
Use the InfraImage defined in containers.conf
Remove hard code use of the DefaultInfraImage and rely on
getting this from containers.conf.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-10 16:13:33 -05:00
Ed Santiago 508f9b76ea System tests: fix RHEL8 gating tests
Add a fix for RHEL8 gating tests. This resolves yet another
journald/file events/logger mismatch bug.

Also, while I'm at it, more log cleanup: a recently-added test was
missing final rm/rmi, resulting in big red scary output in test logs.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-01-10 12:14:53 -07:00
OpenShift Merge Robot 8af574fdaa
Merge pull request #12757 from umohnani8/cm
Don't add env if optional and not found
2022-01-10 18:53:08 +01:00
Valentin Rothberg b7380a7c36 vendor c/common
Also update the e2e pull test to account for the changes when pulling
from the dir transport.  Images pulled via the dir transport are not
tagged anymore; the path is not a reliable source.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2022-01-10 16:25:37 +01:00
Urvashi Mohnani 4dc5a5b15d Don't add env if optional and not found
If the pod yaml has env from secret and condifg map but they are optional
and the secret cannot be found, don't add the env key as well
as the env value will not be found. Matches behavior with k8s.

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2022-01-10 05:51:19 -05:00
OpenShift Merge Robot 41934acc51
Merge pull request #12733 from rhatdan/copy
Set volume NeedsCopyUp to false iff data was copied up
2022-01-07 20:38:59 +01:00
OpenShift Merge Robot 7dd7b983b6
Merge pull request #12764 from edsantiago/bats
Emergency system-test fixes
2022-01-07 13:19:51 +01:00
OpenShift Merge Robot 67dab9e360
Merge pull request #12726 from hikhvar/remove-superflous-pod-rename
Don't rename pod if container has the same name
2022-01-07 13:11:50 +01:00
Ed Santiago f688908151 Emergency system-test fixes
Emergency fix to image-scp tests. DO NOT CREATE A USER!
These tests are run in all sorts of environments. We
do not have the right to vandalize a production system.

Also remove some misleading unneeded tests; and refactor a
little; and add a bunch of FIXMEs which will need to be
addressed later.

Also, super-low priority, add 'crun: ' to expected error
message in a run test (minor followup to #12758).

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-01-06 15:54:01 -07:00
OpenShift Merge Robot 8a22384406
Merge pull request #12758 from rhatdan/runtime
add OCI Runtime name to errors
2022-01-06 23:42:09 +01:00
Daniel J Walsh 1941d45e32
add OCI Runtime name to errors
It would be easier to diagnose OCI runtime errors if the error actually
had the name of the OCI runtime that produced the error.

[NO NEW TESTS NEEDED]

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-06 16:21:02 -05:00
Brent Baude 2a524fcaec fix healthcheck timeouts and ut8 coercion
this commit fixes two bugs and adds regression tests.

when getting healthcheck values from an image, if the image does not
have a timeout defined, this resulted in a 0 value for timeout.  The
default as described in the man pages is 30s.

when inspecting a container with a healthcheck command, a customer
observed that the &, <, and > characters were being converted into a
unicode escape value.  It turns out json marshalling will by default
coerce string values to ut8.

Fixes: bz2028408

Signed-off-by: Brent Baude <bbaude@redhat.com>
2022-01-06 13:56:54 -06:00
Christoph Petrausch 4191616cc5 Don't rename pod if container has the same name
We enforce the naming scheme "<podname>-<containername>" here [1].
Therefore we must not rename the pod in case of a naming conflict
between pod name and container name. Not renaming the pod increases the
usability for the user and easies scripting based on the name. Otherwise
a user must set some label to reliable find a pod after creation. Or
have to implement the renaming logic in the script.

[1] https://github.com/containers/podman/blob/main/pkg/specgen/generate/kube/kube.go#L140

Fixes #12722

Signed-off-by: Christoph Petrausch <chrobbert@gmail.com>
2022-01-06 16:48:20 +01:00
Daniel J Walsh 13f3fd2555
Set volume NeedsCopyUp to false iff data was copied up
Currently Docker copies up the first volume on a mountpoint with
data.

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

Also added NeedsCopyUP, NeedsChown and MountCount to the podman volume
inspect code.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-06 10:42:34 -05:00
OpenShift Merge Robot 755b7aa521
Merge pull request #12687 from rhatdan/volume
Support volume bind mounts for rootless containers
2022-01-06 15:16:13 +01:00
OpenShift Merge Robot d67f178563
Merge pull request #12750 from rhatdan/error
Change Tests to ignore missing containers when removing --all
2022-01-05 18:10:37 +01:00
OpenShift Merge Robot 50e156b605
Merge pull request #12208 from cdoern/podSecurityOpt
Pod Security Option support and Infra Inheritance changes
2022-01-05 17:56:36 +01:00
OpenShift Merge Robot 2157414cf8
Merge pull request #12168 from mtrmac/socket-collision
Avoid RemoteSocket collisions in e2e tests
2022-01-05 17:52:39 +01:00
OpenShift Merge Robot cbb2b68fc9
Merge pull request #12429 from cdoern/scp
podman image scp never enter podman user NS
2022-01-05 17:50:37 +01:00
Daniel J Walsh 64df41755a
Change Tests to ignore missing containers when removing --all
Fixes: https://github.com/containers/podman/issues/12740

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-05 10:46:53 -05:00
Kir Kolyshkin 79c5b73ed7 test/e2e/pod_initcontainers: fix a flake
Commit 3c3fa6fac4 added a few test cases for the init containers.
The "podman ensure always init containers always run" implicitly assumes
that restarting a pod will take more than 1 second. When this assumption
is not met (because computers are fast!), we get a flake.

The fix (without using sleep) is to print nanoseconds in date output.
This format option (%N) is not supported by date in Alpine Linux, so
switch to Fedora.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2022-01-04 17:45:34 -08:00
Kir Kolyshkin cf7fc36953 test/e2e/run: don't use date +%N on Alpine
Commit e1443fe05d added a test case that ran "date +%N" inside
a Fedora container (without actually using its output).

Commit ccc5bc167f changed that test case to use Alpine. Problem
is, %N is not supported by date in Alpine (it only prints a newline).

To eliminate the ambiguity, replace date with touch.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2022-01-04 17:33:44 -08:00
OpenShift Merge Robot ec9d67b7e4
Merge pull request #12735 from rhatdan/mount
Fix Container List API call to return mount info
2022-01-04 19:52:05 +01:00
OpenShift Merge Robot 9a35494141
Merge pull request #12643 from leahneukirchen/events-compat
legacy events: also set Action="die"
2022-01-04 19:50:09 +01:00
Daniel J Walsh 2e0d3e9ea4
Support all volume mounts for rootless containers
Fix handling of "bind" and "tmpfs" olumes to actually work.
Allow bind, tmpfs local volumes to work in rootless mode.

Also removed the string "error" from all error messages that begine with it.
All Podman commands are printed with Error:, so this causes an ugly
stutter.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-04 13:48:03 -05:00
Daniel J Walsh 0c6ae3ab26
Fix Container List API call to return mount info
We are hard coding mounts to return nil in compat API,
since we have the data, we should return it.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-04 10:56:03 -05:00
OpenShift Merge Robot aaf90c5596
Merge pull request #12611 from Luap99/ipv6
add --ip6 flag to podman create/run
2022-01-03 18:42:12 +01:00
Paul Holzinger c496001d03
add --ip6 flag to podman create/run
Add the --ipv6 flag to podman create/run and pod create. We support the
--network name:ip6=<ip> syntax now but for docker compat we should also
support the --ip6 flag.
Note that there is no validation if the ip is actually a v6 or v4 address
because the backend does not care either.

Fixes #7511

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-03 14:26:34 +01:00
Leah Neukirchen 116a276e8c legacy events: also set exitCode
For Status = "die", Docker sets the exit code of the container
to a field "exitCode".  Podman uses "containerExitCode".
Copy the value into "exitCode" as well, for compatibility.

Signed-off-by: Leah Neukirchen <leah@vuxu.org>
2022-01-03 14:00:13 +01:00
Miloslav Trmač f6a3eddd2c Don't initialize the global RNG with GinkgoRandomSeed() in e2e tests
- It probably doesn't actually make a difference: in experiments,
  the github.com/containers/storage/pkg/stringid RNG initialization
  has been happening later
- This makes the RNG caller-controlled (which we don't benefit from),
  but also the same on all nodes of multi-process Ginkgo execution.
  So, if it works at all, it may make collisions of random ID values
  more likely, and our tests are not robust against that. So don't
  go out of our way to make collisions more likely.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-01-03 12:31:47 +01:00
Miloslav Trmač 90e74e794c Avoid collisions on RemoteSocket paths
Add lock files and re-generate the UUID if we
are not a known-unique user of the socket path.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-01-03 12:31:47 +01:00
Miloslav Trmač ee146a9ab0 Refactor remote socket path determination in tests
Separate the code that determines the directory and file prefix
from the code that chooses and applies a UUID; we will make the
second part more complex in a bit.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-01-03 12:31:47 +01:00
Daniel J Walsh 2ff5644bf8
test/system: podman run image with filesystem permission
This test case is used for covering rhbz#1854566.

Replaces: #12220
Signed-off-by: Alex Jia <ajia@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-31 08:59:09 -05:00
Daniel J Walsh fc65b0f73c
test/system: podman run with log-opt option
This test case is used for covering rhbz#1763007.
Replaces: #12221

Signed-off-by: Alex Jia <ajia@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-31 08:49:21 -05:00
Oliver a2687783d4 prefix imageId with sha256: in containers list
test for compat API ImageId

Signed-off-by: Oliver Thallmair <oliver.thallmair@mailbox.org>
2021-12-29 00:26:12 +01:00
cdoern 289270375a Pod Security Option support
Added support for pod security options. These are applied to infra and passed down to the
containers as added (unless overridden).

Modified the inheritance process from infra, creating a new function Inherit() which reads the config, and marshals the compatible options into an intermediate struct `InfraInherit`
This is then unmarshaled into a container config and all of this is added to the CtrCreateOptions. Removes the need (mostly) for special additons which complicate the Container_create
code and pod creation.

resolves #12173

Signed-off-by: cdoern <cdoern@redhat.com>
2021-12-27 13:39:36 -05:00
OpenShift Merge Robot 73a54ea54d
Merge pull request #12627 from rhatdan/passwd
Allow users to add host user accounts to /etc/passwd
2021-12-23 19:28:08 +01:00
cdoern f6d00ea6ef podman image scp never enter podman user NS
Podman image scp should never enter the Podman UserNS unless it needs to. This allows for
a sudo exec.Command to transfer images to and from rootful storage. If this command is run using sudo,
the simple sudo podman save/load does not work, machinectl/su is necessary here.

This modification allows for both rootful and rootless transfers, and an overall change of scp to be
more of a wrapper function for different load and save calls as well as the ssh component

Signed-off-by: cdoern <cdoern@redhat.com>
2021-12-23 10:10:51 -05:00
Daniel J Walsh e8c06fac97
Allow users to add host user accounts to /etc/passwd
Some containers require certain user account(s) to exist within the
container when they are run. This option will allow callers to add a
bunch of passwd entries from the host to the container even if the
entries are not in the local /etc/passwd file on the host.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1935831

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-23 07:51:27 -05:00
Valentin Rothberg 1aa4e4d4d1 container creation: don't apply reserved annotations from image
Do not apply reserved annotations from the image to the container.
Reserved annotations are applied during container creation to retrieve
certain information (e.g., custom seccomp profile or autoremoval)
once a container has been created.

Context: #12671
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-23 13:40:46 +01:00
OpenShift Merge Robot fbdfd55e2d
Merge pull request #12672 from adrianreber/2021-12-21-check-for-memtrack
Error out early if system does not support pre-copy  checkpointing
2021-12-23 13:16:10 +01:00
OpenShift Merge Robot 1b9a5964db
Merge pull request #12599 from rhatdan/kernelmemory
Warn on use of --kernel-memory
2021-12-23 10:56:08 +01:00
Adrian Reber d669dbfb9f
Error out early if system does not support pre-copy checkpointing
CRIU's pre-copy migration support relies on the soft dirty page tracking
in the Linux kernel:

 https://www.kernel.org/doc/Documentation/vm/soft-dirty.txt

This functionality is not implemented for all architectures and it can
also be turned off in the kernel.

CRIU can check if the combination of architecture/kernel/CRIU supports
the soft dirty page tracking and exports this feature checking
functionality in go-criu.

This commit adds an early check if the user selects pre-copy
checkpointing to error out if the system does not support it.

Signed-off-by: Adrian Reber <areber@redhat.com>
2021-12-23 09:51:38 +00:00
Radostin Stoyanov 207823eb05
e2e: Add dev/shm checkpoint/restore test
Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2021-12-23 05:47:33 +00:00
OpenShift Merge Robot 2aea0a5e9b
Merge pull request #12375 from rhatdan/hosts
Use hosts public ip address in rootless containers
2021-12-22 16:40:10 +01:00
Daniel J Walsh a5e49d9668
Warn on use of --kernel-memory
It has been deprecated and is no longer supported.  Fully remove it and
only print a warning if a user uses it.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2011695

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-22 06:20:21 -05:00
OpenShift Merge Robot 3280204f72
Merge pull request #12668 from vrothberg/fix-12667
support hosts without /etc/hosts
2021-12-22 12:13:57 +01:00
OpenShift Merge Robot 85f21fb2bd
Merge pull request #12664 from cdoern/noManagePasswd
Podman run --passwd
2021-12-22 12:09:56 +01:00
Valentin Rothberg 04dbbd96b6 support hosts without /etc/hosts
Fixes: #12667
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-22 10:15:24 +01:00
cdoern 20ce6e5c60 Podman run --passwd
added support for a new flag --passwd which, when false prohibits podman from creating entries in
/etc/passwd and /etc/groups allowing users to modify those files in the container entrypoint

resolves #11805

Signed-off-by: cdoern <cdoern@redhat.com>
2021-12-21 17:19:41 -05:00
OpenShift Merge Robot 253fddbdfd
Merge pull request #12663 from vrothberg/compat-normalization
compat: image normalization: handle sha256 prefix
2021-12-21 16:00:22 +01:00
Daniel J Walsh 64ce6949f2
Use hosts public ip address in rootless containers
Add first non localhost ipv4 of all host interfaces as destination
for host.contaners.internal for rootless containers.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-21 08:50:40 -05:00
OpenShift Merge Robot da7de332b6
Merge pull request #12621 from giuseppe/honor-userns-auto-conf-file
specgen: honor userns=auto from containers.conf
2021-12-21 14:42:19 +01:00
Valentin Rothberg b1f5e861b0 compat: image normalization: handle sha256 prefix
When normalizing image names on the compat API, make sure to take the
`sha256:` prefix into account when matching against the image ID.
Otherwise, the name will mistakingly be subject to docker.io
normalization.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-20 17:27:02 +01:00
Giuseppe Scrivano 89ee302a9f
specgen: honor userns=auto from containers.conf
when using the default userns value, make sure its value is parsed so
that userns=auto is parsed and the options for the storage are filled.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-12-20 17:03:40 +01:00
OpenShift Merge Robot 76d32a1eb9
Merge pull request #12640 from vrothberg/fix-12631
apiv2 tests: use quay.io/libpod/testimage:20210610 for platform tests
2021-12-20 16:56:29 +01:00
OpenShift Merge Robot 516c16c366
Merge pull request #12648 from ttys3/fix-generate-kube-env-missing
fix(generate): fix up podman generate kube missing env field bug
2021-12-20 12:52:30 +01:00
Giuseppe Scrivano 46a094a7a2
test: add --rm to podman run commands
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-12-20 09:00:52 +01:00
Daniel J Walsh f45070ee0e
Merge pull request #12626 from vrothberg/may-the-force-be-with-removal
image rm: allow for force-remove infra images
2021-12-19 06:18:21 -05:00
荒野無燈 af6bcd0867
fix(generate): fix up podman generate kube missing env field bug
the logic is: if the process env vars key exists in podman default or in image defined, and the value is equal, skip the env var key.
the typo make it compare to itself -_-
so, here comes the simple fixup.

Signed-off-by: 荒野無燈 <ttys3.rust@gmail.com>
2021-12-18 09:25:37 +08:00
OpenShift Merge Robot 59766ebe76
Merge pull request #12625 from adrianreber/2021-12-16-podman-inspect
Add more checkpoint/restore information to 'inspect'
2021-12-17 16:04:26 +01:00
Valentin Rothberg 5cbc6b62da apiv2 tests: use quay.io/libpod/testimage:20210610 for platform tests
The quay.io/libpod/testimage:20210610 is known not to change and to
remain stable over time.  While the same should apply for alpine image
on quay.io/libpod, we've seen it flake and return the wrong image.

The reasons for that observation are unknown.

Fixes: #12631
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-17 14:15:11 +01:00
Valentin Rothberg 12d762f8ee image rm: allow for force-remove infra images
Force removal of images will also remove associated containers.
Historically, infra containers have been excluded resulting in
rather annoying errors, for instance, when running `rmi -af`.

Since there is not reasons to exclude infra containers, allow for
removing the entire pod when an infra image is force removed.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-17 13:23:11 +01:00
OpenShift Merge Robot 820cf0e066
Merge pull request #12622 from flouthoc/return_exit_code_for_build
build: relay `exitcode` from imagebuildah to registry
2021-12-17 13:16:23 +01:00
Aditya Rajan 6423174c67
tests: adjust old build test to expect exit code
Old build tests were expecting genric error code `125` however another
commit in this PR ensures that we relay exact exit code from build to
registry.

Hence adjusting tests

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-12-17 16:20:03 +05:30
Adrian Reber 28018ce604
Test for checkpoint specific inspect fields
This extends one of the checkpoint/restore tests to see if the
newly introduced checkpoint specific fields in 'inspect' work as
intended.

Signed-off-by: Adrian Reber <areber@redhat.com>
2021-12-17 10:02:35 +00:00
Aditya Rajan f566d8b8e5
build: relay exitcode from imagebuildah to registry
Podman does not relay exit code from buildah instead returns a generic
error code `125`. Following PR allows `podman` to relay exit code from
`imagebuildah` to `registry` as it is.

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-12-17 15:07:50 +05:30
Brent Baude e88c21366d Removed .service file for healthchecks
when a container with healthchecks exits due to stopping or failure, we
need the cleanup process to remove both the timer file and the service
file.

Bz#:2024229

Signed-off-by: Brent Baude <bbaude@redhat.com>
2021-12-16 14:11:50 -06:00
OpenShift Merge Robot d1c91c128e
Merge pull request #12618 from giuseppe/dev-cgroup-add-default-devices
oci: configure the devices cgroup with default devices
2021-12-16 15:15:49 +01:00
Giuseppe Scrivano 4243ca93a4
oci: configure the devices cgroup with default devices
always set the default devices to the devices cgroup when not running
in a user namespace.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-12-16 13:25:43 +01:00
Valentin Rothberg 3b6510da68 kill: fix output
Make sure that `kill -a` is printing the IDs of killed containers.
Previously, it was only printing empty lines.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-16 13:04:58 +01:00
Valentin Rothberg 5392ff51cc e2e: search flake: skip test on registry.redhat.io
The search endpoint on registry.redhat.io is broken.
Skip one test and update another to avoid hitting it.
Also leave some breadcrumbs to revert once it's back
in a working state.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-16 11:14:42 +01:00
OpenShift Merge Robot 91ef5fb85e
Merge pull request #12601 from edsantiago/apiv2_catch_errs
APIv2 tests: fail on syntax/logic errors
2021-12-16 02:02:56 +01:00
OpenShift Merge Robot 9212c74ff1
Merge pull request #12600 from rhatdan/external
Show --external containers even without --all option
2021-12-15 15:43:11 +01:00
OpenShift Merge Robot 7dabcbd7bc
Merge pull request #12534 from Luap99/network-db
network db rewrite
2021-12-15 15:25:14 +01:00
Ed Santiago 7b51acd4c4 APIv2 tests: fail on syntax/logic errors
(i.e. not test failures, but actual programming bugs).

We've had a number of syntax errors creep into this test, usually
caused by a missing backslash on a test command. I've long wanted
to 'set -e' but that causes other problems. This PR introduces
error handling via 'trap', with useful diagnostics on failure.

This PR also catches and fixes two previously-unknown bugs that
were causing tests to not actually run.

And, since /events takes eons on my high-uptime laptop, add /since

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-12-14 18:28:50 -07:00
Daniel J Walsh 51a4bef2e6
Show --external containers even without --all option
We currently do not show --external containers when the user specifies
it, unless they also specify the --all flag. This has led to confusion.
I see no reason not to list them without the --all flag if the user
specifies the option.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-14 16:03:21 -05:00
Ed Santiago 0a2eb7b185 apiv2 tests: refactor complicated curls
Some months ago, apiv2 tests got added that needed new
functionality: passing a tarball to the remote server.
There was no mechanism to do so in the 't' helper, so
these tests used complicated (and actually not-really-
working) curl commands.

This PR introduces and documents a new usage of 't', in
which passing an argument ending in '.tar' adds the
right magic syntax (--data-binary @PATH) to the existing
curl. This lets us use all standard 't' checks, making
for simpler tests and in the process fixing some bugs.

Also: drive-by fix of a typo bug in the networks test.

Also: set CONTAINERS_REGISTRIES_CONF when starting server
and when running direct podman, to avoid docker.io throttling.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-12-14 12:10:19 -07:00
OpenShift Merge Robot a0894b5ecd
Merge pull request #12586 from jmguzik/secret-cmd
Add secret list --filter to cli
2021-12-14 18:40:58 +01:00
OpenShift Merge Robot e4e21522d1
Merge pull request #12091 from ananthb/docker-api-compat
Fixes #12063 Add docker compatible output after image build.
2021-12-14 18:32:57 +01:00
Ananth Bhaskararaman 52b12fe985
Fixes #12063 Add docker compatible output after image build.
Signed-off-by: Ananth Bhaskararaman <antsub@gmail.com>
2021-12-14 21:08:31 +05:30
OpenShift Merge Robot c501c1d642
Merge pull request #12585 from Luap99/network-ls-sort
network ls: show networks in deterministic order
2021-12-14 16:05:42 +01:00
Paul Holzinger 3e9af2029f
play kube add support for multiple networks
Allow the same --network options for play kube as for podman run/create.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-14 15:23:40 +01:00
Paul Holzinger 535818414c
support advanced network configuration via cli
Rework the --network parse logic to support multiple networks with
specific network configuration settings.
--network can now be set multiple times. For bridge network mode the
following options have been added:
  - **alias=name**: Add network-scoped alias for the container.
  - **ip=IPv4**: Specify a static ipv4 address for this container.
  - **ip=IPv6**: Specify a static ipv6 address for this container.
  - **mac=MAC**: Specify a static mac address address for this container.
  - **interface_name**: Specify a name for the created network interface inside the container.

So now you can set --network bridge:ip=10.88.0.10,mac=44:33:22:11:00:99
for the default bridge network as well as for network names.
This is better than using --ip because we can set the ip per network
without any confusion which network the ip address should be assigned
to.
The --ip, --mac-address and --network-alias options are still supported
but --ip or --mac-address can only be set when only one network is set.
This limitation already existed previously.

The ability to specify a custom network interface name is new
Fixes #11534

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-14 15:23:39 +01:00
Paul Holzinger 4791595b5c
network connect allow ip, ipv6 and mac address
Network connect now supports setting a static ipv4, ipv6 and mac address
for the container network. The options are added to the cli and api.

Fixes #9883

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-14 15:23:39 +01:00
Paul Holzinger 5f1f62f0bb
network ls: show networks in deterministic order
The new network backend stores the networks in a map so the returned
order is not deterministic. Lets sort the network names alphabetically
to ensure a deterministic order.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-14 13:52:38 +01:00
Valentin Rothberg 1fff76c3c3 pprof flakes: bump timeout to 20 seconds
This is the third and hopefully the last attempt to address the flakes
in the pprof tests.  We first bumped the timeouts to 2 seconds, then to
5, and since I am running out of ideas let's bump it now to 20 seconds.

Since the timeouts poll, the tests will terminate much earlier but 20
seconds should now really be enough even under highly loaded CI VMs.

Fixes: #12167
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-14 10:59:56 +01:00
Jakub Guzik 50501f49a3 Add secret list --filter to cli
This PR is a follow-up of #11431. It adds possibility of filtering
secret list based on id and name.

Signed-off-by: Jakub Guzik <jguzik@redhat.com>
2021-12-14 10:41:03 +01:00
Valentin Rothberg 81a0a79844 compat build: adhere to q/quiet
Fixes: #12566
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-13 09:52:24 +01:00
OpenShift Merge Robot e993b88c03
Merge pull request #12573 from Luap99/fix-test
fix e2e test missing network cleanup
2021-12-10 17:56:28 +00:00
Paul Holzinger bc191ca7d3
fix e2e test missing network cleanup
I noticed that this test will fail its flake rerun because the network
was not removed and it tried to create a network with the same name.
Also network disconnect works rootless now.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-10 16:23:40 +01:00
Valentin Rothberg 99bc00421b pprof CI flakes: enforce 5 seconds grace period
This gives the service 5 seconds to digest the signal and 5 more seconds
to shutdown.  Create a new variable to make bumping the timeout easier
in case we see re-flake in the future.

Fixes: #12167
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-10 15:01:44 +01:00
Daniel J Walsh 593d0907c5
--hostname should be set when using --pod new:foobar
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2030599

When you create pod, it shares the UTS namespace with Containers.
Currently the --hostname is not passed to the pod created when
you create a container and pod in the same command.

Also fix error message on supported --share flags

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-09 13:09:02 -05:00
Ed Santiago 18854f5666 System tests: remove rm_pause_image()
...it's not needed: teardown() already does it. Or, it would,
if it had been updated to deal with the new pause image naming
convention, which I've just done.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-12-09 08:23:43 -07:00
OpenShift Merge Robot 4a52a457d1
Merge pull request #12545 from vrothberg/fix-12477
generate systemd: support entrypoint JSON strings
2021-12-09 08:41:29 +00:00
OpenShift Merge Robot 02eaebda46
Merge pull request #12541 from flouthoc/remote_blank_entrypoint
specgen: honor empty args for entrypoint specified as `--entrypoint ""`
2021-12-08 16:50:20 +00:00
Aditya Rajan b526a0ccdc
specgen: honor empty args for entrypoint
Users should be able to override containers entrypoint using
`--entrypoint ""` following works fine for podman but not for podman
remote.

Specgen ignores empty argument for entrypoint so make specgen honor
empty arguments.

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-12-08 20:26:36 +05:30
Valentin Rothberg 2d517b687b generate systemd: support entrypoint JSON strings
Make sure to preserve the quoting of entrypoint JSON strings.

Fixes: #12477
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-08 15:51:23 +01:00
Valentin Rothberg d7f6f4e881 remove runlabel test for global opts
GLOBAL_OPTS haven't been supported for at least two major versions of
Podman.  The runlabel code is extremely fragile and I think it should
be rewritten before adding new features.

Fixes: #12436
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-08 11:37:13 +01:00
OpenShift Merge Robot 23ce826a84
Merge pull request #12498 from rhatdan/cgroups
Update vendor or containers/common moving pkg/cgroups there
2021-12-07 12:49:57 +00:00
Daniel J Walsh 2130d18539
Update vendor or containers/common moving pkg/cgroups there
[NO NEW TESTS NEEDED] This is just moving pkg/cgroups out so
existing tests should be fine.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-07 06:17:11 -05:00
Aditya Rajan 7d0fd175f1
volume: apply exact permission of target directory without adding extra 0111
While trying to match permissions of target directory podman adds
extra `0111` which should not be needed if target path does not have
execute permission.

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-12-07 15:42:12 +05:30
OpenShift Merge Robot 9af07fd3ed
Merge pull request #12522 from edsantiago/minor_test_cleanup
tests: clean up FIXMEs and noise
2021-12-06 17:55:24 +00:00
OpenShift Merge Robot 6663d7289e
Merge pull request #12519 from vrothberg/fix-9597
fix remote run/start flake
2021-12-06 17:15:23 +00:00
Ed Santiago eee3a42b7e tests: clean up FIXMEs and noise
e2e tests:
 * remove two FIXMEs:
   * one of them is expected behavior, not a FIXME
   * the other is easily fixed

 * File issue #12521 for a real podman-remote bug, and
   update the Skip() message

system tests:
 * in command-completion test, clean up stray podman-pause image
   (followup to #12322, in which I missed this instance). This
   removes distracting warnings from test logs.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-12-06 08:30:59 -07:00
Valentin Rothberg 207065ce9f fix remote run/start flake
Fix the flake reported in #9597 with a workaround to at least stop
wasting energy until the root cause has been found and fixed.

It seems that a remote run returns before the container has transitioned
into the `exited` state which ultimately breaks a subsequent remote
start with attach.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-06 15:30:31 +01:00
Valentin Rothberg 6d7e6d7447 e2e: fix pprof flakes
Give the services some more time after SIGINT to shutdown.
`Eventually(session, 5)` will poll the session for the specific
condition at a frequency of 10ms for at most 5 seconds.

Fixes: #12167
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-06 14:28:34 +01:00
OpenShift Merge Robot 188f1989fa
Merge pull request #12487 from jwhonce/issues/10974-2
Refactor podman system to report.Formatter
2021-12-06 13:09:23 +00:00
Valentin Rothberg 76f5100be5 vendor c/common@main
Update the `--filter reference=...` tests to reflect recent changes in
c/common.  The reference values now match as specified without
implicitly adding wildcards arounds.

Fixes: #11905
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-06 09:33:39 +01:00
Jhon Honce 7d22cc88ef Refactor podman system to report.Formatter
[NO NEW TESTS NEEDED]

Support better compatibility output for podman system commands

* Format and content of output from podman version changed to
  be more compatible

See #10974
Depends on containers/common#831

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-12-03 13:48:58 -07:00
OpenShift Merge Robot a93fa5e0c9
Merge pull request #12466 from dispensable/respect_pod_yaml_spec_hostname_when_play
Hostname in `spec.hostname` should be passed to infra ctr init opt
2021-12-03 19:20:45 +01:00
OpenShift Merge Robot dd109daa45
Merge pull request #12440 from umohnani8/cm
Add support for configmap volumes to play kube
2021-12-03 14:54:47 +01:00
Ondra Machacek c9ad1da51c Add restart-sec option to systemd generate
Signed-off-by: Ondra Machacek <omachace@redhat.com>
2021-12-03 12:11:28 +01:00
Urvashi Mohnani 7d331d35dd Add support for configmap volumes to play kube
If the k8s yaml has volumes from a configmap, play kube
will now create a volume based on the data from the
configmap and volume source and set it to the right path
in the container accordingly.
Add tests for this and update some test for ENV from configmap.

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2021-12-02 14:48:04 -05:00
OpenShift Merge Robot 87de344eeb
Merge pull request #12482 from edsantiago/e2e_have
e2e tests: use HaveKey() and HaveLen() when possible
2021-12-02 20:06:47 +01:00
OpenShift Merge Robot 4ff0ba4c87
Merge pull request #12455 from jwhonce/issues/10974
Refactor podman image command output
2021-12-02 19:28:48 +01:00
Jhon Honce 61792de36e Refactor podman image command output
Leverage new report.Formatter allowing better compatibility from
podman command output.

Follow on PR's will cover containers, etc.

See #10974

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-12-02 09:07:27 -07:00
OpenShift Merge Robot ee39281c35
Merge pull request #12480 from vrothberg/fix-12453
compat: images/json
2021-12-02 16:12:47 +01:00
Ed Santiago 6cb25b3d14 Manual fixes
Fix a handful of instances not covered by earlier automated
replacements. Found via:

   ack 'Expect\(len' test/e2e

There are still a bunch of BeNumerically(">", ...) that cannot (yet)
be handled by HaveLen(). Leave those as they are.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-12-02 07:54:53 -07:00
Ed Santiago eb1212bed9 Same thing, with BeNumerically("==", x)
sed -i -e 's/Expect(len(\(.*\)))\.To(BeNumerically("==", \(.*\)))/Expect(\1).To(HaveLen(\2))/' test/e2e/*.go

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-12-02 07:54:53 -07:00
Ed Santiago c0a8814fb4 Use HaveLen(x) instead of Expect(len(y)).To(Equal(x))
sed -i -e 's/Expect(len(\(.*\)))\.To(Equal(\(.*\)))/Expect(\1).To(HaveLen(\2))/' test/e2e/*.go

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-12-02 07:54:53 -07:00
Ed Santiago 92f9e11767 Same thing, for BeNumerically("==", 0)
sed -i -e 's/Expect(len(\(.*\)))\.To(BeNumerically("==", 0))/Expect(\1).To(BeEmpty())/' test/e2e/*.go

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-12-02 07:54:53 -07:00
Ed Santiago 7c6123f8e1 Use BeEmpty() instead of len(x).To(Equal(0))
sed -i -e 's/Expect(len(\(.*\)))\.To(Equal(0))/Expect(\1).To(BeEmpty())/' test/e2e/*.go

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-12-02 07:54:53 -07:00
Ed Santiago c676495468 Same as previous, for assertions other than Equal()
sed -i -e 's/Expect(\(.*\)\[\(\".*\"\)\])\.To(\(.*\)/Expect(\1).To(HaveKeyWithValue(\2, \3)/' test/e2e/*_test.go

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-12-02 07:54:53 -07:00