Commit graph

662 commits

Author SHA1 Message Date
OpenShift Merge Robot 2c23729c84
Merge pull request #4001 from kunalkushwaha/podman-import-fix
podman import syntax fix
2019-09-30 07:20:09 -07:00
OpenShift Merge Robot 01a802e546
Merge pull request #4118 from cevich/fix_sig_proxy
Move noCache logic lower in stack
2019-09-27 23:21:25 -07:00
OpenShift Merge Robot d4399eebb9
Merge pull request #4121 from jwhonce/issue/4021
Change ginkgo Wait() to Eventually() test
2019-09-27 20:09:17 +02:00
Kunal Kushwaha 039b44ea11 new testcase for podman import --change added
Signed-off-by: Kunal Kushwaha <kunal.kushwaha@gmail.com>
2019-09-27 17:17:12 +09:00
Nalin Dahyabhai 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
Jhon Honce 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
Chris Evich 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
Qi Wang 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
Matthew Heon 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
gabi beyer 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
Giuseppe Scrivano 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
Giuseppe Scrivano 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
Daniel J Walsh 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
OpenShift Merge Robot 42e080bcd3
Merge pull request #4043 from haircommander/preserve-fd-fix
exec: fix --preserve-fds
2019-09-16 23:23:59 +02:00
OpenShift Merge Robot 2a4e062c71
Merge pull request #3941 from gabibeyer/fix_unit_test
fix unit test using strings.Contains
2019-09-16 22:24:05 +02:00
Peter Hunt 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
OpenShift Merge Robot 7875e00c66
Merge pull request #3934 from rhatdan/wait
Podman-remote run should wait for exit code
2019-09-13 18:12:25 +02:00
Jhon Honce 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
gabi beyer 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
Daniel J Walsh 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
Daniel J Walsh 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
Debarshi Ray 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
OpenShift Merge Robot 9cf852c305
Merge pull request #3927 from openSUSE/manager-annotations
Add `ContainerManager` annotation to created containers
2019-09-11 09:34:14 +02:00
OpenShift Merge Robot 7ac6ed3b4b
Merge pull request #3581 from mheon/no_cgroups
Support running containers without CGroups
2019-09-11 00:58:46 +02:00
OpenShift Merge Robot 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
Matthew Heon 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
Sascha Grunert 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
Matthew Heon 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
OpenShift Merge Robot 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
Matthew Heon 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
baude 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
OpenShift Merge Robot 88980859ec
Merge pull request #3958 from haircommander/play-kube-sec
play kube: fix segfault
2019-09-06 15:40:13 +02:00
Peter Hunt 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
Matthew Heon 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
OpenShift Merge Robot b962b1e353
Merge pull request #3943 from gabibeyer/fix_tests
Fix unit tests missing comparative for 'Expect'
2019-09-05 12:49:21 +02:00
gabi beyer 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
OpenShift Merge Robot 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
Matthew Heon 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
Giuseppe Scrivano 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
Matthew Heon 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
OpenShift Merge Robot bdf9e56813
Merge pull request #3893 from mheon/readd_volume_locks
Re-add volume locks
2019-08-28 11:25:12 -07:00
Matthew Heon 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
Matthew Heon 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
Matthew Heon 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
OpenShift Merge Robot b263dd9e81
Merge pull request #3800 from vrothberg/generate-pod
generate systemd pod
2019-08-22 19:08:08 +02:00
Valentin Rothberg 56a65cffac generate systemd: support pods and geneartig files
Support generating systemd unit files for a pod.  Podman generates one
unit file for the pod including the PID file for the infra container's
conmon process and one unit file for each container (excluding the infra
container).

Note that this change implies refactorings in the `pkg/systemdgen` API.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-08-21 17:28:30 +02:00
TomSweeneyRedHat 9ced2488c9 Add --digestfile option to push
Add the digestfile option to the push command so the digest can
be stored away in a file when requested by the user.  Also have added
a debug statement to show the completion of the push.

Emulates Buildah's https://github.com/containers/buildah/pull/1799/files

Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2019-08-21 10:11:52 -04:00
Peter Hunt cc3d8da968 exec: run with user specified on container start
Before, if the container was run with a specified user that wasn't root, exec would fail because it always set to root unless respecified by user.
instead, inherit the user from the container start.

Signed-off-by: Peter Hunt <pehunt@redhat.com>
2019-08-20 11:44:27 -04:00
Ashley Cui 8c7014f11d Implement healthcheck for remote client
Previously unimplemented. Works the same way the local one does, except its remote.

Signed-off-by: Ashley Cui <ashleycui16@gmail.com>
2019-08-19 12:14:54 -04:00
OpenShift Merge Robot c137e8fcf9
Merge pull request #3849 from openSUSE/directory-pull
Fix directory pull image name for OCI images
2019-08-19 17:50:39 +02:00