1057 Commits

Author SHA1 Message Date
651ddd3560 Reduce CPU usage when --timeout=0
* Add second go routine for when a Timer is not needed.
* goimports updated some project files

Fixes #5531

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-03-18 10:27:25 -07:00
412a114d33 Merge pull request #5439 from ttys3/fixup-systemdgen-with-new-param
systemd generator: force run container detached if CreateCommand has no detach param
2020-03-16 14:40:02 +01:00
4e13ef58c8 Merge pull request #5476 from edsantiago/run_rmi_test_fix
run --rmi test: make it work
2020-03-16 12:51:50 +01:00
9ca4b6c6f5 add os|arch attributes when building
when building images, we can now add the os and arch of the image using overrides from the commandline.  the commandline options set sane defaults so we use those as well.

Fixes: #5503

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-03-15 12:49:42 -05:00
194723f314 force run container detached if container CreateCommand missing the detach param
the podman generated systemd service file has `Type=forking` service,
so the command after `ExecStart=` should not run in front.
if someone created a container and has the detach(`-d`) param missing
like this
```
podman create --name ngxdemo -P nginxdemos/hello
```
and generate the file with `--new` param:
```
podman generate systemd --name --new ngxdemo
```
because `podman run xxx` has no `-d` param,
so the container is not run in background and nerver exit.
and systemd will fail to start the service:
```
sudo systemctl start container-ngxdemo.service
Job for container-ngxdemo.service failed because a timeout was exceeded.
See "systemctl status container-ngxdemo.service" and "journalctl -xe" for details.
```

Signed-off-by: 荒野無燈 <ttys3@outlook.com>
2020-03-14 21:54:12 +08:00
3585780876 run --rmi test: make it work
The recently-added 'run --rmi' test was not actually doing
what it thinks it was doing: for one, 'run_podman | grep'
is never going to work; also, the test was leaving behind
stray images.

Rework to do what I believe the intention was; and, combine
into one test (down from two) for readability.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-03-12 07:57:11 -06:00
3d48940927 Merge pull request #5307 from QiWang19/security-opt-genkube
fix security-opt generate kube
2020-03-09 22:22:29 +01:00
a5c04c793e generate systemd: remove leading slashes
Remove leading slashes from the run-dir paths. It was meant to make it
explicit that we're dealing with an absolute path but user feedback has
shown that most are aware.  It also cleans up the path in the systemctl
status output.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-03-05 14:05:48 +01:00
90eef95cb1 Merge pull request #4772 from boaz0/closes_4628
Add the rmi flag to podman-run to delete container image
2020-03-04 10:58:10 -05:00
a8bc423e29 Merge pull request #5344 from edsantiago/log_format
CI: format cirrus logs
2020-03-04 10:55:36 -05:00
d5f5b2e8be Merge pull request #5379 from edsantiago/test_apiv2
APIv2 tests: add tests for stop
2020-03-03 20:31:44 +01:00
17bab33bd2 fix security-opt generate kube
fix #4950
add selinux options from --security-opt of the container to generate kube result

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-03-03 11:21:14 -05:00
3bc5f431d4 Merge pull request #5206 from rhatdan/capabilities
Allow devs to set labels in container images for default capabilities.
2020-03-03 14:48:10 +01:00
88cd648816 APIv2 tests: add tests for stop
...and allow status 'stopped' in addition to 'exited'.

Fixes: #5336

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-03-03 06:40:27 -07:00
11e5c53d11 Add the rmi flag to podman-run to delete container image
The --rmi flag will delete the container image after its execution
unless that image is already been used by another container(s).

This is useful when one wants to execute a container once and remove
any resources attached to it.

Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com>
2020-03-03 14:27:11 +02:00
1814638000 CI: format cirrus logs
This introduces a new cirrus helper script, logformatter.
Usage is:

    [commands...] | logformatter TEST-NAME

It reformats its input into a readable, highlighed, linkable
form. Some features:

   - boring stuff (timestamps, standard podman options) is
     deemphasized
   - important stuff (warnings, errors) is emphasized
   - in-page links to the actual failures
   - active links to source files
   - jumps to bottom of page on load, because that's where
     the errors are. (All errors are linked)

Add it to select test commands (integration, system) and
add a new artifacts_html, run in the 'always' block, which
uploads generated *.log.html into Cirrus; from there we
generate a live URL that can be viewed in browser.

Unfortunately, due to security concerns in Cirrus, it is
not currently possible to make the link a live one.

Kludge: add a line of dashes after Restoring images; without this,
the first test ("systemd PID 1") has no dashes before it, so
logformatter doesn't see it.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-03-02 15:55:05 -07:00
b163640c61 Allow devs to set labels in container images for default capabilities.
This patch allows users to specify the list of capabilities required
to run their container image.

Setting a image/container label "io.containers.capabilities=setuid,setgid"
tells podman that the contained image should work fine with just these two
capabilties, instead of running with the default capabilities, podman will
launch the container with just these capabilties.

If the user or image specified capabilities that are not in the default set,
the container will print an error message and will continue to run with the
default capabilities.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-03-02 16:37:32 -05:00
5612089412 CI: add API v2 tests
API v2 has been quiet for a few days, and the test script is
actually passing. Let's take advantage of this opportunity
to get them running in CI.

Requires adding a check for cgroupsv2

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-03-02 13:19:42 -07:00
b41c864d56 Ensure that exec sessions inherit supplemental groups
This corrects a regression from Podman 1.4.x where container exec
sessions inherited supplemental groups from the container, iff
the exec session did not specify a user.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-02-28 11:32:56 -05:00
c132a4b7ff Merge pull request #5295 from mheon/advanced_network_inspect
Add support for multiple CNI networks in podman inspect
2020-02-27 12:33:26 +01:00
40470b45d3 kill test: clean up warnings; document better
9f69c4eca (part of the f31 pr, #3091) semi-broke the kill test,
there's now an ugly warning:

    setup(): removing stray images quay.io/libpod/fedora-minimal:latest 7bb5a60e8a78

The comments also didn't actually explain the problem
being addressed, and included a misleading reference
to busybox.

Here we switch to using fedora-minimal only with podman-remote,
clean it up (rmi) when finished, and include an explanation in
the comments about why this is needed; making it clear that
this workaround can be removed once we get rid of podman-remote.
We also reformat back to 80 columns.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-02-26 11:01:38 -07:00
19016f3cd8 Merge pull request #5332 from giuseppe/uts-lookup-container
spec: allow container alias name in lookup
2020-02-26 16:58:27 +01:00
75d0d48d20 Merge pull request #5330 from baude/flakefixesfored
curb flakes in integration tests
2020-02-26 16:17:34 +01:00
04f1306c87 curb flakes in integration tests
instead of searching the fedora registry which is error prone, we instead search a local registry for the empty set search.

when running two containers with the same IP, i suspect the first container has not fully gotten its ip information back from cni when the second container fires.  rework this test such that we use nginx to make sure the container is up and running before continues which should pace the subsequent test.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-02-26 08:30:28 -06:00
418dee100b spec: allow container alias name in lookup
Previously --uts=container: expected the full container ID.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-02-26 15:04:31 +01:00
6c5591ed9d Merge pull request #3901 from cevich/support_f31
Cirrus: Support testing with F31
2020-02-25 21:32:20 +01:00
f9fc9a7b7b Add support for multiple CNI networks in podman inspect
When inspecting containers, info on CNI networks added to the
container by name (e.g. --net=name1) should be displayed
separately from the configuration of the default network, in a
separate map called Networks.

This patch adds this separation, improving our Docker
compatibility and also adding the ability to see if a container
has more than one IPv4 and IPv6 address and more than one MAC
address.

Fixes #4907

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-02-25 13:20:25 -05:00
4511e15f8c Fix kill test obtaining CID
It's possible/likely the container image for the test will need to be
pulled as part of the `run` command.  Due to the way BATS handles
output, messages regarding image-pull could be misinterpreted as the
container's CID.  Force the CID to be obtained by only the last line of
output.

Signed-off-by: Chris Evich <cevich@redhat.com>
2020-02-25 12:34:26 -05:00
9f69c4ecaf System Tests: Force default signal handlers
Recommended as part of:
https://github.com/containers/libpod/issues/5004

and

https://github.com/containers/crun/issues/230

Signed-off-by: Chris Evich <cevich@redhat.com>
2020-02-25 12:34:26 -05:00
9b9789c207 Fix cgroupsv2 run test, unexpected output
Sometime between 10th and 23rd of Feb. 2020, the behavior of crun
changed.  Upon consulting with Giuseppe, the podman run tests for
`device-read-*` and `device-write-*` do not depend on the container
output for success, only the exit code.  Add a comment and conditional
regarding this in case of cgroupsv2.  Also noted that these tests
will likely require future refactoring/simplification.

Signed-off-by: Chris Evich <cevich@redhat.com>
2020-02-25 12:34:26 -05:00
f25c595cb8 apiv2 tests: add more pod tests, timing check
Looks like /libpod/pods/create has been fixed to return an
actual pod ID. Extend those tests.

Also, update timeout in the server command: it's now seconds,
not milliseconds.

Also, update FIXME comments in /pods/prune . Still doesn't
work, but clarify what we're seeing.

Also, add a new test that runs ten /info requests and
barfs if it takes more than 5 seconds.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-02-25 06:42:27 -07:00
18dcb84d64 Merge pull request #4889 from baude/portsearch
fix port list by container with port
2020-02-23 13:00:10 -05:00
fab5b35b2a Friendly amendment: tests, and a help message
1) Help message for podman port was missing [PORT]

2) Add test for 'podman port'. And, actually, an entire
   networking test that I'd written some weeks ago but
   apparently didn't 'git add'.

Signed-off-by: Ed Santiago <santiago@redhat.com>
Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-02-23 11:04:39 -06:00
0184714a82 Add --no-healthcheck command to create/run
Now support --no-healthcheck option to disable defined healthchecks in a container image.  --health-cmd=none remains supported as well.

Fixes: #5299

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-02-22 12:45:15 -06:00
1c476d7696 Merge pull request #5286 from edsantiago/flake_fix_same_ip
Flake fix: race condition in same-IP test
2020-02-21 07:58:46 -05:00
bfeaabb350 Merge pull request #5222 from mheon/fix_5219
Use cleaned destination path for indexing image volumes
2020-02-20 18:16:52 -05:00
a1dcfd47a1 Flake fix: race condition in same-IP test
The "create two containers with the same IP" test failed:

   https://api.cirrus-ci.com/v1/task/5992323062431744/logs/integration_test.log#t--Podman-create-two-containers-with-the-same-IP
   ...
   (basically, expected error exit code, got 0)

Analysis: the sequence is 'start test1, start test2'. Perhaps it's
possible that 'podman start' exits before the test1 container has
an IP address assigned? There are no checks in the test, so it's
impossible to know what happened.

Solution: add a wait-loop invoking 'podman inspect', waiting
for a nonempty IP address on test 1; then assert that it's
what we expect it to be.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-02-20 14:56:02 -07:00
bb31d35d99 search test on fedora registry: retry 5 times
...to try to compensate for flaky host.

registry.fedoraproject.org is just not reliable. It's flaking
with 503 errors, causing massive amounts of wasted CI time
and developer effort.

There is exactly one instance of that registry in these tests.
We can't replace it with quay.io, because "search quay.io/"
(trailing slash) fails with some sort of authentication error.
So let's just try a sleep/retry cycle instead.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-02-20 13:13:29 -07:00
9ecf8e13dc Login test: use --password-stdin
Great timing: this new test collided against #5268, which added
a warning about using command-line --password. CI is now going
to fail all over.

Fix: rework test to use --password-stdin. Am doing so only
in the places where output string is checked; other instances
can keep using '--password xxx' because it's simpler.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-02-20 11:18:36 -07:00
29930fae70 podman images: add --filter=since=XX
Looks like a bit of a misunderstanding from early on.

Docker implements --filter=since=IMAGE. Podman implements 'after'
instead of 'since'. Add an equivalent case statement to handle
both, keeping 'after' because we have no way of knowing if it
is used in the field.

Update documentation ... and fix what looks like a complete
misinterpretation of what the code actually does: the man page
claimed that these were time fields, but I don't see any
possible incantation in which a time value works or could
work. Updated docs to reflect IMAGE usage. Also changed
nonworking '==' to single '='.

Added tests. [UPDATE: skip with broken podman-remote]

Fixes: #5040

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-02-20 07:55:29 -07:00
846405256b Merge pull request #5241 from mheon/pod_network_opts_add
Add network opts to pods
2020-02-20 10:39:15 +01:00
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
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
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
40fa7e9931 Use cleaned destination path for indexing image volumes
We use filepath.Clean() to remove trailing slashes to ensure that
when we supercede image mounts with mounts from --volume and
--mount, paths are consistent when we compare. Unfortunately,
while we used the cleaned path for the destination in the mount,
it was accidentally not used to index the maps that we use to
identify what to supercede, so our comparisons might be thrown
off by trailing slashes and similar.

Fixes #5219

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-02-17 16:28:36 -05:00
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
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
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
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
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