1399 Commits

Author SHA1 Message Date
fd184fa4a1 Merge pull request #6522 from mheon/unless-stopped
Add support for the unless-stopped restart policy
2020-06-17 15:25:09 -04:00
03e99c9b40 Revert #6591 to fix issue with failed tests
Signed-off-by: jgallucci32 <john.gallucci.iv@gmail.com>
2020-06-17 08:31:09 -07:00
6f1440a3ec Add support for the unless-stopped restart policy
We initially believed that implementing this required support for
restarting containers after reboot, but this is not the case.
The unless-stopped restart policy acts identically to the always
restart policy except in cases related to reboot (which we do not
support yet), but it does not require that support for us to
implement it.

Changes themselves are quite simple, we need a new restart policy
constant, we need to remove existing checks that block creation
of containers when unless-stopped was used, and we need to update
the manpages.

Fixes #6508

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-06-17 11:16:12 -04:00
1acd2adccb Merge pull request #6640 from edsantiago/fix_flaky_logs_test
"streaming output" logs test: fix flake
2020-06-17 17:06:16 +02:00
200afe7a94 Merge pull request #6583 from mheon/inspect_ctr_before_img
Fix podman inspect on overlapping/missing objects
2020-06-17 16:27:15 +02:00
6d5a432c2e "streaming output" logs test: fix flake
Test has been flaking excessively. A quick look shows that
the test itself is broken, making a bad assumption.

'podman logs -f' is guaranteed to exit when a container
terminates. This does not (and should not) mean that the
container has been cleaned up. It is undefined and unsafe
to run 'podman run -n same-name-as-terminated-container'
immediately after 'podman logs' exits.

Solution: instead of 'podman run', do 'podman inspect'.
This, too, is unsafe, but we can expect to see one of
two possible conditions:

  1) command succeeds, in which case we require that
     container State.Status be "exited"; or
  2) command fails, in which case we expect "no such
     container" in error output

For full coverage we should add a small delay-check test
to (1) to ensure that the container is cleaned up after
a short amount of time. Leaving that as a TODO because
it's more than my Go skills can handle, and I want to
get this checked in ASAP to get rid of the flake hassle.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-06-17 07:04:00 -06:00
6589d75565 Fix podman inspect on overlapping/missing objects
This started as a small fix to `podman inspect` where a container
and image, with the same name/tag, were present, and
`podman inspect` was run on that name. `podman inspect` in 1.9
(and `docker inspect`) will give you the container; in v2.0, we
gave the image. This was an easy fix (just reorder how we check
for image/container).

Unfortunately, in the process of testing this fix, I determined
that we regressed in a different area. When you run inspect on
a number of containers, some of which do not exist,
`podman inspect` should return an array of inspect results for
the objects that exist, then print a number of errors, one for
each object that could not be found. We were bailing after the
first error, and not printing output for the containers that
succeeded. (For reference, this applied to images as well). This
required a much more substantial set of changes to properly
handle - signatures for the inspect functions in ContainerEngine
and ImageEngine, plus the implementations of these interfaces,
plus the actual inspect frontend code needed to be adjusted to
use this.

Fixes #6556

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-06-16 14:33:33 -04:00
eb8bfdad3e Fix --init and --init-path
Init properly passed into specgen
Allow --init with --systemd=true but not --systemd=always.

Signed-off-by: Joseph Gooch <mrwizard@dok.org>
2020-06-16 17:37:39 +00:00
e0dd227912 Merge pull request #6605 from ypu/apiv2-pods
APIv2 tests: Add some tests for podman pods
2020-06-16 05:26:07 -04:00
d072de6efc APIv2 tests: Add some tests for podman pods
Add some tests for podman pods subcommand:
  restart
  rm
  start
  stas
  stop
  top
  unpause

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
2020-06-16 11:53:48 +08:00
8a42a32c71 Merge pull request #6591 from jgallucci32/patch-1
Merged request to fix -f to stop following logs
2020-06-15 13:57:13 -04:00
5a82a559c6 Merge pull request #6601 from zhangguanzhang/podman-cp-dir
fix podman cp can create an extra directory when the source is the container's root directory
2020-06-15 13:20:35 -04:00
2716234af3 Merge pull request #6603 from sujil02/python-test
Adds more docker py test
2020-06-15 13:11:24 -04:00
9d293bd2de fix podman cp can create an extra directory level
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2020-06-15 23:56:45 +08:00
fe488b5f11 pod create --replace
Add a `--replace` flag to the `pod create` command.  If another pod with
the same name already exists, it will be replaced and removed.

Adding this flag is motivated by #5485 to make running Podman in systemd
units (or any other scripts/automation) more robust.  In case of a
crash, a pod may not be removed by a sytemd unit anymore.  The
`--replace` flag allows for supporting crashes.

Note that the `--replace` flag does not require the `--name` flag to be
set, so it can be set unconditionally in `podman generate systemd`.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-15 15:55:55 +02:00
fa3b8a75c4 {create,run} --replace
Add a `--replace` flag to the `container {create,run}` commands.
If another container with the same name already exists, it will
be replaced and removed.

Adding this flag is motivated by #5485 to make running Podman in systemd
units (or any other scripts/automation) more robust.  In case of a
crash, a container may not be removed by a sytemd unit anymore.  The
`--replace` flag allows for supporting crashes.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-15 15:53:51 +02:00
4a3f3b5c02 Adds more docker py test
Addes more docker py test
Optimize test to import images from cache
Rename test class and dir for python unittest framework

Signed-off-by: Sujil02 <sushah@redhat.com>
2020-06-15 02:57:55 -04:00
2386a2ef2d Do not default WorkingDir to / on client side
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-06-12 07:15:57 -04:00
033743cbee Fix -f logs follow with stopped container
Fix -f logs follow with stopped container. Close #6531

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-06-11 17:55:26 -04:00
39ad0387ca Merge pull request #6415 from vrothberg/systemd-new-pod
podman-generate-systemd --new for pods
2020-06-11 10:56:11 -04:00
b62e50f53b Merge pull request #6256 from theunrealgeek/play_kube_deployment
Support k8s Deployment in play kube
2020-06-11 08:53:00 -04:00
09e4faa7df Merge pull request #6529 from mheon/v6_ports
Enable IPv6 port binding
2020-06-11 08:50:13 -04:00
c7c81a8c08 e2e: sanity check --infra-conmon-pidfile
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-11 11:01:13 +02:00
8d8746adee generate systemd: create pod template
Create a new template for generating a pod unit file. Eventually, this
allows for treating and extending pod and container generation
seprately.

The `--new` flag now also works on pods.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-11 11:01:13 +02:00
402c68b41d pod create: add --infra-conmon-pidfile
Add an `--infra-conmon-pidfile` flag to `podman-pod-create` to write the
infra container's conmon process ID to a specified path.  Several
container sub-commands already support `--conmon-pidfile` which is
especially helpful to allow for systemd to access and track the conmon
processes.  This allows for easily tracking the conmon process of a
pod's infra container.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-11 11:01:13 +02:00
144c6bb76d generate systemd: rename "cid" to "ctr-id"
Rename the container ID file from "cid" to "ctr-id" to make the
generated unit files a) easier to read and to b) pro-actively
avoid any confusion when pod ID files are being added in the
future.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-11 11:01:13 +02:00
cf89bb6711 container-{create,run}: add --pod-id-file
Allow containers to join an existing pod via the `--pod-id-file` which
is already supported by a number of `podman-pod` subcommands.  Also add
tests to make sure it's working and to prevent future regressions.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-11 11:01:13 +02:00
7d71d24440 podman-pod{rm,start,stop}: support --pod-id-file
Support the `--pod-id-file` flag in the rm, start and stop pod commands.
This completes the already support flag in pod-create and is another
prerequisite for generating generic systemd unit files for pods.

Also add completions, docs and tests.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-11 11:01:13 +02:00
636881ece5 pod config: add a CreateCommand field
Add a `CreateCommand` field to the pod config which includes the entire
`os.Args` at pod-creation.  Similar to the already existing field in a
container config, we need this information to properly generate generic
systemd unit files for pods.  It's a prerequisite to support the `--new`
flag for pods.

Also add the `CreateCommand` to the pod-inspect data, which can come in
handy for debugging, general inspection and certainly for the tests that
are added along with the other changes.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-11 11:01:13 +02:00
4e2a0b5b9c Enable IPv6 port binding
Two areas needed tweaking to accomplish this: port parsing and
binding ports on the host.

Parsing is an obvious problem - we have to accomodate an IPv6
address enclosed by [] as well as a normal IPv4 address. It was
slightly complicated by the fact that we previously just counted
the number of colons in the whole port definition (a thousand
curses on whoever in the IPv6 standard body decided to reuse
colons for address separators), but did not end up being that
bad.

Libpod also (optionally) binds ports on the host to prevent their
reuse by host processes. This code was IPv4 only for TCP, and
bound to both for UDP (which I'm fairly certain is not correct,
and has been adjusted). This just needed protocols adjusted to
read "tcp4"/"tcp6" and "udp4"/"udp6" based on what we wanted to
bind to.

Fixes #5715

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-06-10 13:28:09 -04:00
15f273b931 WIP: Enable (and disable) remote testing
podman-remote has not been tested. A principal part of the
problem was #5387 - the YAML I wrote did not have the
intended effect, it did not set TEST_REMOTE_CLIENT=true
and because of my multiple iterations I did not catch this
during testing.

Part 1 of this PR is to fix .cirrus.yml to enable remote tests.

Part 2 -- what I had first noticed and tried to fix -- is that
rootless_test.sh was never running remote because, of course,
envariables are not sent via ssh. I reworked integration_test.sh
and rootless_test.sh to use a command-line decision instead.

Part 3, sigh, is to disable one failing integration test
and *all* system tests, because so many of the latter are
failing. Addressing those failures needs to be done in
subsequent PRs. Issues #6538, #6539, #6540 are filed for
some of the problems I isolated. There will be more.

Also, minor, fixed some stale references to varlink.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-06-09 12:43:58 -06:00
a2e0e170f9 Merge pull request #6532 from sujil02/python-test
Modify py test to start stop system service for each test
2020-06-09 16:27:24 +02:00
a5facca78f e2e: disable checkpoint test on Ubuntu
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-08 16:51:32 +02:00
efd1422143 Enable Ubuntu tests in CI
Add updates required for ubuntu and run integration tests

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-06-08 12:21:16 +02:00
37428df4c2 Modify py test to start stop system service for each test
Start stop system service for each test class to make it east to integrate to CI
Adds more tests
Add some common methods shared between images and containers test.

Signed-off-by: Sujil02 <sushah@redhat.com>
2020-06-07 22:27:01 -04:00
1fcb6788a5 Merge pull request #6417 from sujil02/py-test
Adds docker py regression test.
2020-06-06 05:40:03 -04:00
c8f57b71a4 Fix handling of systemd.
Systemd enablement has to happen on the server side, since we need
check if the image is running systemd.

Also need to make sure user setting the StopSignal is not overriden on the
server side. But if not set and using systemd, we set it correctly.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-06-05 13:01:57 -04:00
359d67a687 Adds docker py regression test.
Adds test to validate podman image endpoints.
Adds readme on how to run python tests
Adds contants file.

Signed-off-by: Sujil02 <sushah@redhat.com>
2020-06-04 16:04:34 -04:00
650ed437a8 Merge pull request #6489 from edsantiago/bats
BATS and APIv2: more tests and tweaks
2020-06-04 15:03:40 +02:00
c133e55afc Merge pull request #6485 from QiWang19/remote-ignore
fix remote test --ignore & turn on more tests
2020-06-04 14:52:25 +02:00
6682ea8f0d Merge pull request #6481 from QiWang19/rm-test-stop
turn on remote stop_test
2020-06-04 14:49:35 +02:00
8cf74a79e3 Merge pull request #6470 from mheon/fix_stats_nonet
Properly follow linked namespace container for stats
2020-06-04 14:46:49 +02:00
a3f2a8d73c Merge pull request #6482 from mheon/split_inspect
Ensure that image/container inspect are specialized
2020-06-04 13:36:10 +02:00
2d5a2a7640 BATS and APIv2: more tests and tweaks
- (minor): apiv2 tests: check for full ID

   Observation made while reviewing #6461: tests were checking
   only for a 12-character container/image ID in return value.
   It's actually 64, and we should test for that. This should
   also minimize confusion in a future maintainer.

 - podman pause/unpause: new test

   Runs a 'date/sleep' loop, pauses container, sleeps 3s,
   restarts, then confirms that there's a 3- to 6-second
   gap in the logs for the container.

 - podman healthcheck: new test

   run a container with healthcheck, test both healthy
   and unhealthy conditions

 - podman pod: check '{{.Pod}}' field in podman ps

   Hey, as long as we have a pod with two running
   containers, might as well confirm that 'podman ps'
   returns the expected pod ID.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-06-03 16:13:33 -06:00
377554d681 Merge pull request #6461 from chuanchang/add_contaner_cases_for_apiv2
test.apiv2: add test cases for committing an image from a container
2020-06-03 21:15:05 +02:00
f313a88441 fix remote test --ignore & turn on more tests
fix remote test --ignore & turn on more tests

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-06-03 15:04:58 -04:00
d505989b0e Ensure that image/container inspect are specialized
We are currently able to inspect images with
`podman container inspect` and containers with
`podman image inspect` and neither of those seem correct. This
ensures that the appropriate flags, and only the appropriate
flags, are available for each specialized exec, and they can only
inspect the specific type they were intended to.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-06-03 14:25:45 -04:00
bba0a8be1a Merge pull request #6465 from rhatdan/remote
Add more Remote tests
2020-06-03 20:12:05 +02:00
cbfb4980ce Merge pull request #6469 from jwhonce/wip/auth
V2 Add support for ssh authentication methods
2020-06-03 19:43:56 +02:00
df0141dc20 Merge pull request #6473 from mheon/fix_inspect_segfault
Fix a segfault in `podman inspect -l` w/ no containers
2020-06-03 19:27:54 +02:00