Commit graph

1016 commits

Author SHA1 Message Date
OpenShift Merge Robot 846405256b
Merge pull request #5241 from mheon/pod_network_opts_add
Add network opts to pods
2020-02-20 10:39:15 +01:00
Ed Santiago 67c1b7e3b4 New login and push tests
Test podman login/logout, login with wrong credentials,
auth file contents, auth file path override, push/pull,
and, if skopeo is installed, credentials sharing

Fixes: #4283

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-02-19 09:51:06 -07:00
Matthew Heon 97323808ed Add network options to podman pod create
Enables most of the network-related functionality from
`podman run` in `podman pod create`. Custom CNI networks can be
specified, host networking is supported, DNS options can be
configured.

Also enables host networking in `podman play kube`.

Fixes #2808
Fixes #3837
Fixes #4432
Fixes #4718
Fixes #4770

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-02-19 11:29:30 -05:00
Qi Wang 4c135017b2 fix mandatory parameter in login/logout
fix #5146
Insted of using a registry as mandatory parameter, this path allows podman to use the first registry from registries.conf.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-02-18 15:30:49 -05:00
Valentin Rothberg 3c2cc67867 podman-ps: support image IDs
Support printing image IDs via `--format "{{.ImageID}}"`.

Fixes: #5160
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-02-17 15:22:21 +01:00
Matthew Heon 36a0ed9702 Rework label parsing
We attempted to share all logic for parsing labels and
environment variables, which on the surface makes lots of sense
(both are formatted key=value so parsing logic should be
identical) but has begun to fall apart now that we have added
additional logic to environment variable handling. Environment
variables that are unset, for example, are looked up against
environment variables set for the process. We don't want this for
labels, so we have to split parsing logic.

Fixes #3854

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-02-14 16:06:20 -05:00
Valentin Rothberg 85b7374491 add pkg/signal
Add pkg/signal to deal with parts of signal processing and translating
signals from string to numeric representations.  The code has been
copied from docker/docker (and attributed with the copyright) but been
reduced to only what libpod needs (on Linux).

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-02-14 15:04:14 +01:00
OpenShift Merge Robot 3e0475eb88
Merge pull request #5189 from mheon/only_set_all_on_status
Only set --all when a status filter is given to ps
2020-02-13 20:51:22 +01:00
Daniel J Walsh 5418c9c06b
Fix up play kube to use image data
podman play kube was ignoring the
imageData.Config
   Volumes
   WorkingDir
   Labels
   StopSignal

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-02-13 05:46:27 -05:00
OpenShift Merge Robot 2814995a92
Merge pull request #5115 from QiWang19/images-format
images --format compatible with docker
2020-02-13 11:42:47 +01:00
OpenShift Merge Robot a9969c23a3
Merge pull request #5191 from baude/fedoraminimaliskillingme
use quay.io/libpod/fedora-minimal for reliability
2020-02-13 04:56:28 +01:00
OpenShift Merge Robot a65f6b888a
Merge pull request #5152 from QiWang19/device-cgroup-rule
support device-cgroup-rule
2020-02-13 02:34:42 +01:00
Matthew Heon d2100cd473 Only set --all when a status filter is given to ps
The changes in #5075 turn out to be too aggressive; we should
only be setting --all if a status= filter is given. Otherwise
only running containers are filtered.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-02-12 20:14:20 -05:00
Brent Baude 2aacfade75 use quay.io/libpod/fedora-minimal for reliability
Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-02-12 16:45:03 -06:00
Qi Wang d3260738d3 support device-cgroup-rule
fix #4876
Add `--device-cgroup-rule` to podman create and run. This enables to add device rules after the container has been created.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-02-12 14:30:23 -05:00
OpenShift Merge Robot dd5df42be9
Merge pull request #5168 from mheon/do_not_overwrite_volumes
Do not copy up when volume is not empty
2020-02-12 18:46:35 +01:00
Matthew Heon c140ecdc9b Do not copy up when volume is not empty
When Docker performs a copy up, it first verifies that the volume
being copied into is empty; thus, for volumes that have been
modified elsewhere (e.g. manually copying into then), the copy up
will not be performed at all. Duplicate this behavior in Podman
by checking if the volume is empty before copying.

Furthermore, move setting copyup to false further up. This will
prevent a potential race where copy up could happen more than
once if Podman was killed after some files had been copied but
before the DB was updated.

This resolves CVE-2020-1726.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-02-12 10:58:42 -05:00
Ed Santiago 0af16eb15b API v2 tests: catch up to moving target
Lots has changed since I first checked this in:

 * Switch to new podman system service invocation
 * /containers API has changed drastically
 * /pods API has some fixes; check for them (e.g.
   container-exists is now 409 Conflict, not 500)
 * One test ('?invalidparam=x') still doesn't work;
   comment it out so we can get everything passing.

Also, some work on the test framework itself:

 * Cleaner port-open testing (the bash /dev/tcp check).
 * Add a 'podman' function to invoke local podman and
   log its output.

The above two allow us to:

 * Get rid of stderr special-casing

Furthermore:

 * t() no longer needs leading '.'; this allows jq
   features such as 'length' and perhaps other filters
 * special-case handling of 204 and 304: rfc2616 demands
   that they return no message body; assert that it is so.
 * new root & rootless helper functions (check server)
 * remove the "unlikely to work" message for rootless;
   it seems to be working fine
 * fix pod tests for rootless
   * BUT: add a bolder FIXME because the ID field seems wrong

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-02-11 14:31:12 -07:00
Matthew Heon d99f2ee784 Remove incorrect validation of --change for commit
The validation logic was failing on properly-formatted changes.
There's already validation in Commit itself, so no need to
duplicate.

Fixes #5148

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-02-10 16:32:02 -05:00
Qi Wang 3afd1b5a7c images --format compatible with docker
This patch lets valid values of --format be compatible with docker. Replace CreatedTime with CreatedAt, Created with CreatedSince.
Keep CreatedTime and Created are valid as hidden options.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-02-10 10:34:40 -05:00
Sascha Grunert 56a9c6ae57
Add Containerfile location e2e test
As a follow up of the location fix in #5080 we now add an e2e test for
that use case.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2020-02-05 09:03:53 +01:00
Matthew Heon ee5b749e65 Force --all when --filter is passed to podman ps
When we filter, it should be out of all containers, not just
running ones, by default - this is necessary to ensure Docker
compatability.

Fixes #5050

Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-02-04 09:52:25 -05:00
OpenShift Merge Robot 50eaf6de92
Merge pull request #4973 from rhatdan/sort
Throw error on invalid sort value
2020-01-28 15:05:30 -08:00
Daniel J Walsh 38d2ef0cbd
Throw error on invalid sort value
We define the valid sort values, so we should throw an error
on invalid sort values.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-01-28 16:34:18 -05:00
Brent Baude 1c10cb30ea rootless login/logout tests fail
On F31 CI tests, we have uncovered several failing tests as rootless that need to be fixed.  For the interim, we are going to disable those tests.  Issue #5006 has been created to track and complete this.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-01-28 15:20:05 -06:00
Brent Baude 31a1f44fe6 honor pull policy in play kube
When a container specification has a pull policy, we should honor it when recreating the pods/containers from yaml.  furthermore, ini kube, if a tag is :latest, then the always pull policy is automatically instituted.

Fixes: #4880

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-01-28 13:36:10 -06:00
OpenShift Merge Robot 326cdf944d
Merge pull request #4986 from baude/showhconimage
inspect image healthchecks
2020-01-27 14:21:59 -08:00
OpenShift Merge Robot 094baa5366
Merge pull request #4894 from edsantiago/test_apiv2
Tests for API v2
2020-01-27 07:14:16 -08:00
Brent Baude 6181faa90d inspect image healthchecks
when a docker image has a defined healthcheck, it should be displayed with inspect.  this is only valid for docker images as oci images are not aware of healthchecks.

Fixes: #4799
Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-01-27 08:36:25 -06:00
Valentin Rothberg 1531509542 seccomp policy: expect profile in config label
Move the seccomp profile from a manifest annotation to a config label.
This way, we can support it for Docker images as well and provide an
easy way to add that data via Dockerfiles.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-23 10:06:43 +01:00
Ed Santiago c2f50499c9 Tests for API v2
Initial framework for testing the version 2 (HTTP) API.
Includes a collection of tests for some of the existing
endpoints. Not all tests are currently passing.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-01-17 09:59:22 -07:00
OpenShift Merge Robot 427e87449d
Merge pull request #4887 from vrothberg/fix-4886
e2e/run_signal_test.go: make it more robust
2020-01-16 20:23:37 +01:00
Valentin Rothberg 9d3667c2f0 systemdgen: add --ignore flag to generic services
The --ignore flag lets Podman ignore errors when a specified container
does not exist (anymore).  That's a nice addition to generic services
generated via the --new flag.  Those services create new containers and
can hence allows user to manually remove a container; may it only be by
accident.

The important part of using the --ignore flag is that Podman will exit 0
which plays nicer with most restart policies; a non-zero exit may yield
systemd to restart the entire service which is arguably wrong if the
user manually deletes the container.

If desired, users can still alter the generated files.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-16 16:36:21 +01:00
Valentin Rothberg 49703299b1 e2e/run_signal_test.go: make it more robust
Make the signal test more robust by just checking that the container's
exit code is non-zero.  There are two possible exit codes (i.e., 130 and
137) depending on how the container is being killed, which is likely
responsible for CI flakes.

Fixes: #4886
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-16 16:19:06 +01:00
OpenShift Merge Robot e1e405b70d
Merge pull request #4807 from ssbarnea/fix/pre-commit
Enable pre-commit linting
2020-01-15 23:51:22 +01:00
OpenShift Merge Robot 0870e88ff4
Merge pull request #4824 from edsantiago/bats
more BATS tests
2020-01-15 23:33:02 +01:00
OpenShift Merge Robot 0aa9dba3e1
Merge pull request #4806 from vrothberg/seccomp
policy for seccomp-profile selection
2020-01-15 01:16:07 +01:00
Sorin Sbarnea e9cd3319cf Enable pre-commit tool linting
This should help use keep the codebase more consistent, and avoid sevel
whitespace related issues, or bad file permissions.

pre-commit allows us to easily introduce other linters in follow-ups,
like bashate.

Note: pre-commit tool does *not* install any git-hooks. Making commits
will will call the tool unless you deliverately tell it to install the
hooks.

Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>
2020-01-14 13:42:59 +00:00
OpenShift Merge Robot e83a1b87da
Merge pull request #4817 from rhatdan/codespell
Add codespell to validate spelling mistakes in code.
2020-01-13 17:59:58 +01:00
Ed Santiago 1298f19773 more BATS tests
- run: --name (includes 'podman container exists' tests)
- run: --pull (always, never, missing)
- build: new test for ADD URL (#4420)
- exec: new test for issue #4785 (pipe getting lost)
- diff: new test
- selinux (mostly copied from docker-autotest)

Plus a bug fix: the wait_for_output() helper would continue
checking, eventually timing out, even if the container had
already exited (probably because of an error). Fix: as
part of the loop, run 'podman inspect' and bail out if
container is not running. Include exit code and logs.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-01-13 06:29:52 -07:00
OpenShift Merge Robot 55dd73cf58
Merge pull request #4823 from vrothberg/gen-systemd
podman-generate-systemd --new
2020-01-12 23:13:45 +01:00
Daniel J Walsh 4093b2c011
Add codespell to validate spelling mistakes in code.
Fix all errors found by codespell

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-01-11 06:32:19 -05:00
Giuseppe Scrivano 4726eb2861
test: fix error message
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-01-10 10:38:47 +01:00
Giuseppe Scrivano 71341a1948
log: support --log-opt tag=
support a custom tag to add to each log for the container.

It is currently supported only by the journald backend.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-01-10 10:35:19 +01:00
Valentin Rothberg f3f4c54f2a policy for seccomp-profile selection
Implement a policy for selecting a seccomp profile.  In addition to the
default behaviour (default profile unless --security-opt seccomp is set)
add a second policy doing a lookup in the image annotation.

If the image has the "io.containers.seccomp.profile" set its value will be
interpreted as a seccomp profile.  The policy can be selected via the
new --seccomp-policy CLI flag.

Once the containers.conf support is merged into libpod, we can add an
option there as well.

Note that this feature is marked as experimental and may change in the
future.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-09 17:57:58 +01:00
Valentin Rothberg 816e50ba02 podman-generate-systemd --new
Add a --new flag to podman-generate-systemd to create a new container
via podman-run instead of starting an existing container.

Creating a new container presents the challenge to find a reverse
mapping from a container to the CLI flags it can be created with.  We
are doing this via `(Container).Config.CreateCommand` field, which
includes a copy of the process' command from procFS at creating time.
This field may not be useful when the container was not created via the
Podman CLI (e.g., via a Python script).  Hence, we do not guarantee the
correctness of the generated files.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-09 16:12:12 +01:00
OpenShift Merge Robot f3fc10feb4
Merge pull request #4802 from rhatdan/varlink
Fix podman-remote info to show registry data
2020-01-09 10:40:20 +01:00
Sascha Grunert 40b74e02b7
Add untag sub-command
Podman now supports untagging images via the `untag` sub-command for the
root and `image` commands. Testing and documentation has been added as
well.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2020-01-08 10:06:10 +01:00
Daniel J Walsh d52a4dc2d4
Fix podman-remote info to show registry data
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-01-07 19:38:46 -05:00
OpenShift Merge Robot c41fd09a8d
Merge pull request #4781 from haircommander/seccomp-profile-root
play kube: make seccomp handling better conform to k8s
2020-01-07 22:13:03 +01:00