957 Commits

Author SHA1 Message Date
65b20bd521 Correct use of reexec.Init()
A true result from reexec.Init() isn't an error, but it indicates that
main() should exit with a success exit status.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-09-26 18:19:07 -04:00
f4723beac6 Change ginkgo Wait() to Eventually() test
Changing the test in WaitWithDefaultTimeout() to use Eventually() and
gexec.Exit(). Using ExitCode() before command has really exited returns
a -1, which can cause issues for tests testing for podman to return
non-zero values.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2019-09-26 14:11:54 -07:00
437d9d2cde Move noCache logic lower in stack
One or more tests are not taking advantage of the local image cache.
This has been observed to cause a testing flake in at least one
`--sigproxy` test which uses `PodmanTestIntegration.PodmanPID()`.
It has a rather short timeout of 15-seconds, which isn't always
enough time to pull down a remote image.

Fix this by reloacing the `noCache` logic from
`PodmanTest.PodmanAsUserBase()` down the stack into
`PodmanTestIntegration.makeOptions()`.  This also eliminates the need to
also check if a remote-client is being used - since it uses a different
function.

Also reverse the parameter order in `PodmanTest.PodmanBase` so that
everywhere is consistently `noEvents` then `noCache`.

Signed-off-by: Chris Evich <cevich@redhat.com>
2019-09-26 10:56:24 -04:00
0144c3796b fix cp none exists dest path ends with '/'
close #3894
This patch let podman cp return 'no such file or directory' error if DEST_PATH does not exist and ends with / when copying file.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2019-09-25 12:48:05 -04:00
d89414b1f0 Handle conflict between volumes and --read-only-tmpfs
When a named volume is mounted on any of the tmpfs filesystems
created by read-only tmpfs, it caused a conflict that was not
resolved prior to this.

Fixes BZ1755119

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-09-24 15:57:17 -04:00
b300b981e7 Merge pull request #3756 from gabibeyer/rootlessOrdering
rootless: Rearrange setup of rootless containers
2019-09-24 18:47:18 +02:00
c146f8d7d2 system tests: run test: reenable and fix
Test had incorrectly been disabled for all podman; it
should've been disabled only for podman-remote. Fixed
that, and fixed the problem that was causing failures:
podman-remote is gobbling up stdin (#4095), so no
tests were actually being run at all, or only one.
Fixed by redirecting input on the run_podman invocation.
Added, as backup, a confirmation mechanism to ensure
that all expected tests are being run.

Note that test is reenabled, but the output check is
disabled for podman-remote due to #4096; this at least
lets us check exit status.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-09-24 08:46:40 -06:00
65d5a9823e add list mount tests
Add two unit tests to determine whether mounts are being listed
correctly. One tests that a created container is not listed
until mounted. The second checks that running containers are
mounted, and then no longer listed as mounted when they stop
running. The final test creates three containers, mounts two,
and checks that mount correctly only lists the two mounted.

Signed-off-by: gabi beyer <gabrielle.n.beyer@intel.com>
2019-09-24 11:01:28 +02:00
fb353f6f42 execuser: look at the source for /etc/{passwd,group} overrides
look if there are bind mounts that can shadow the /etc/passwd and
/etc/group files.  In that case, look at the bind mount source.

Closes: https://github.com/containers/libpod/pull/4068#issuecomment-533782941

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-09-21 22:11:09 +02:00
e42e1c45ae container: make sure $HOME is always set
If the HOME environment variable is not set, make sure it is set to
the configuration found in the container /etc/passwd file.

It was previously depending on a runc behavior that always set HOME
when it is not set.  The OCI runtime specifications do not require
HOME to be set so move the logic to libpod.

Closes: https://github.com/debarshiray/toolbox/issues/266

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-09-20 16:01:38 +02:00
52c4df0f9a System-test: Temporarily disable 030-run
While investigating issue
https://github.com/containers/libpod/issues/4044 there is no sense
subjecting forward progress elsewhere.  Skip the test with a note
temporarily, until a resolution to 4044 and any other related issues
is found and fix implemented.

Signed-off-by: Chris Evich <cevich@redhat.com>
2019-09-17 12:54:49 -04:00
34d22a4e5c Fix exit code failure
Be less precise on the exit code and lot the exit code to the journal when it fails.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-09-17 12:01:02 -04:00
42e080bcd3 Merge pull request #4043 from haircommander/preserve-fd-fix
exec: fix --preserve-fds
2019-09-16 23:23:59 +02:00
2a4e062c71 Merge pull request #3941 from gabibeyer/fix_unit_test
fix unit test using strings.Contains
2019-09-16 22:24:05 +02:00
5f97721afc exec: fix --preserve-fds
There were two problems with preserve fds.
libpod didn't open the fds before passing _OCI*PIPE to conmon. This caused libpod to talk on the preserved fds, rather than the pipes, with conmon talking on the pipes. This caused a hang.
Libpod also didn't convert an int to string correctly, so it would further fail.

Fix these and add a unit test to make sure we don't regress in the future

Note: this test will not pass on crun until crun supports --preserve-fds

Signed-off-by: Peter Hunt <pehunt@redhat.com>
2019-09-16 15:27:00 -04:00
7875e00c66 Merge pull request #3934 from rhatdan/wait
Podman-remote run should wait for exit code
2019-09-13 18:12:25 +02:00
a6836eae52 Do not support wildcards on cp
* symlink processing and wildcarding led to unexpected files
  being copied

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2019-09-12 16:56:38 -07:00
69c58236ae fix unit test to use Expect
The Expect function does not return a result of True or False
depending on the value of the first instance, but instead requires
a comparison using ".To(", so change to use ".To(ContainSubstring("

Signed-off-by: gabi beyer <gabrielle.n.beyer@intel.com>
2019-09-12 21:01:43 +00:00
82ac0d8925 Podman-remote run should wait for exit code
This change matches what is happening on the podman local side
and should eliminate a race condition.

Also exit commands on the server side should start to return to client.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-09-12 16:20:01 -04:00
535111b5d5 Use exit code constants
We have leaked the exit number codess all over the code, this patch
removes the numbers to constants.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-09-12 16:20:01 -04:00
137ec81634 Test that PTYs created by 'podman exec --tty' have the ONLCR flag
Signed-off-by: Debarshi Ray <rishi@fedoraproject.org>
2019-09-12 18:34:56 +02:00
9cf852c305 Merge pull request #3927 from openSUSE/manager-annotations
Add `ContainerManager` annotation to created containers
2019-09-11 09:34:14 +02:00
7ac6ed3b4b Merge pull request #3581 from mheon/no_cgroups
Support running containers without CGroups
2019-09-11 00:58:46 +02:00
997c4b56ed Merge pull request #3961 from mheon/copy_volume_contents
When first mounting any named volume, copy up
2019-09-10 22:24:43 +02:00
c2284962c7 Add support for launching containers without CGroups
This is mostly used with Systemd, which really wants to manage
CGroups itself when managing containers via unit file.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-09-10 10:52:37 -04:00
df036f9f8e Add ContainerManager annotation to created containers
This change adds the following annotation to every container created by
podman:

```json
"Annotations": {
    "io.containers.manager": "libpod"
}
```

Target of this annotaions is to indicate which project in the containers
ecosystem is the major manager of a container when applications share
the same storage paths. This way projects can decide if they want to
manipulate the container or not. For example, since CRI-O and podman are
not using the same container library (libpod), CRI-O can skip podman
containers and provide the end user more useful information.

A corresponding end-to-end test has been adapted as well.

Relates to: https://github.com/cri-o/cri-o/pull/2761

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2019-09-10 09:37:14 +02:00
b6106341fb When first mounting any named volume, copy up
Previously, we only did this for volumes created at the same time
as the container. However, this is not correct behavior - Docker
does so for all named volumes, even those made with
'podman volume create' and mounted into a container later.

Fixes #3945

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-09-09 17:17:39 -04:00
9a55bce9e4 Merge pull request #3896 from mheon/volume_lookup
Add ability to look up volumes by unambiguous partial name
2019-09-09 21:48:30 +02:00
046178e55f Add function for looking up volumes by partial name
This isn't included in Docker, but seems handy enough.

Use the new API for 'volume rm' and 'volume inspect'.

Fixes #3891

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-09-09 12:06:10 -04:00
ee432cf279 podman network create
initial implementation of network create.  we only support bridging
networks with this first pass.

Signed-off-by: baude <bbaude@redhat.com>
2019-09-09 09:32:43 -05:00
88980859ec Merge pull request #3958 from haircommander/play-kube-sec
play kube: fix segfault
2019-09-06 15:40:13 +02:00
9259693826 play kube: fix segfault
when securityContext wasn't specified in yaml.
add a test as well

Signed-off-by: Peter Hunt <pehunt@redhat.com>
2019-09-06 08:41:04 -04:00
a760e325f3 Add ability for volumes with options to mount/umount
When volume options and the local volume driver are specified,
the volume is intended to be mounted using the 'mount' command.
Supported options will be used to volume the volume before the
first container using it starts, and unmount the volume after the
last container using it dies.

This should work for any local filesystem, though at present I've
only tested with tmpfs and btrfs.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-09-05 17:12:27 -04:00
b962b1e353 Merge pull request #3943 from gabibeyer/fix_tests
Fix unit tests missing comparative for 'Expect'
2019-09-05 12:49:21 +02:00
95f5411e88 Fix unit tests missing comparative for 'Expect'
Add '.To(BeTrue())' to 'Expect(' statements in unit tests that
are missing them. These tests weren't being compared to anything,
thus reporting false positives.

Signed-off-by: gabi beyer <gabrielle.n.beyer@intel.com>
2019-09-04 23:30:24 +00:00
e74fcd7335 Merge pull request #3940 from edsantiago/bats
System tests: support for crun on f31/rawhide
2019-09-04 23:13:22 +02:00
ab44484bec Merge pull request #3876 from mheon/fix_mount_flags
Allow suid, exec, dev mount options to cancel nosuid/noexec/nodev
2019-09-04 22:43:41 +02:00
acf55e1f87 System tests: support for crun on f31/rawhide
crun emits wildly different error messages than runc in
two cases:

    podman run ... /no/such/path   (enoent)
    podman run ... /etc            (trying to exec a directory)

Deal with it by getting the runtime from 'podman info' and,
if crun, changing what we expect.

There may be more tweaks needed to get system tests working
with crun, but right now podman rawhide is too broken to
have any hope of finding them all.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-09-04 14:03:55 -06:00
5f15501578 Add test to verify noexec works with volume mounts
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-09-04 13:19:19 -04:00
ba1c57030f rootless: bind mount devices instead of creating them
when running in rootless mode, --device creates a bind mount from the
host instead of specifying the device in the OCI configuration.  This
is required as an unprivileged user cannot use mknod, even when root
in a user namespace.

Closes: https://github.com/containers/libpod/issues/3905

Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
2019-09-02 13:03:19 +02:00
d110998744 Merge pull request #3907 from baude/commitcaps
dont panic when using varlink commit and uppercase image names
2019-08-29 14:13:09 -07:00
2fb6cc2cea dont panic when using varlink commit and uppercase image names
when using an upper case image name for container commit, we observed
panics due to a channel closing early.

Fixes: #3897

Signed-off-by: baude <bbaude@redhat.com>
2019-08-29 14:08:29 -05:00
c13a52cfde Add a test for the new suid/exec/dev options
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-08-28 14:28:52 -04:00
bdf9e56813 Merge pull request #3893 from mheon/readd_volume_locks
Re-add volume locks
2019-08-28 11:25:12 -07:00
ced3ebb512 Merge pull request #3728 from mheon/systemd_container_test
Add an integration test for systemd in a container
2019-08-28 11:25:05 -07:00
e563f41116 Re-add locks to volumes.
This will require a 'podman system renumber' after being applied
to get lock numbers for existing volumes.

Add the DB backend code for rewriting volume configs and use it
for updating lock numbers as part of 'system renumber'.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-08-28 11:35:00 -04:00
ca0dfca5c9 Temporarily disable systemd test for CGroups V2
Revert this one CGroups V2 support for systemd containers is
added.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2019-08-28 09:28:49 -04:00
63d989a344 Add an integration test for systemd in a container
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-08-28 09:28:49 -04:00
4e2cccd9af podman cp: big set of system tests
podman cp has had some unexpected bugs, and still has
some surprising behavior. It looks like this part of
the code is fragile. Add tests to try to prevent
future breakages.

Note that two of the new tests are disabled (skipped)
until #3829 gets fixed.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-08-26 15:33:38 -06:00
67926d86b5 Merge pull request #3824 from baude/varlinkendpointtest
Create framework for varlink endpoint integration tests
2019-08-26 17:11:12 +02:00