9508 Commits

Author SHA1 Message Date
04dddbbf7f remote: fix name and ID collisions of containers and pods
Fix the look up of containers and pods in the remote client.  User input
can refer to both, names or IDs of containers and pods, so there is a
fair chance of collisions (e.g., "c1" name with a "c1...." ID).

Those collisions are well handled (and battle tested) in the local
client which is directly using the libpod backend.  Hence, the remote
client should not attempt to introduce its own logic to prevent bugs and
divergence between the local and the remote clients.  To prevent
collisions such as in #7837, do a container/pod inspect on the
user-provided input to find the corresponding ID and eventually do full
ID comparisons to avoid potential collisions with names.

Note that this has a cost that I am not entirely happy with.  Looking at
issue #7837, the collisions are happening when removing the two
containers.  Remote container removal is now very chatty with the server
as it first queries for all containers, then iterates over the provided
names or IDs and does a remote inspect to figure out the IDs and find a
matching container object.  However, remote removal could just pass the
names and IDs directly to the batch removal endpoint.  Querying for all
containers could be prevented if the batch removal endpoint would remove
all if the slice is empty.

In other words, the bug is fixed but there's room for performance
improvements.

Fixes: #7837
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-10-01 18:30:20 +02:00
a29ef605f9 Merge pull request #7846 from rhatdan/rootless
Attempt to test all Broken SkipIfRootless FIXME
2020-10-01 12:08:14 -04:00
746bb2d678 Merge pull request #7864 from rhatdan/volume
Volume prune should not pass down the force flag
2020-10-01 12:04:52 -04:00
baede7cd27 Add additionalGIDs from users in rootless mode
There is a risk here, that if the GID does not exists
within the User Namespace the container will fail to start.

This is only likely to happen in HPC Envioronments, and I think
we should add a field to disable it for this environment,
Added a FIXME for this issue.

We currently have this problem with running a rootfull container within
a user namespace, it will fail if the GID is not available.

I looked at potentially checking the usernamespace that you are assigned
to, but I believe this will be very difficult to code up and to figure out.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-10-01 10:54:28 -04:00
3948cb76e2 Merge pull request #7851 from zhangguanzhang/fix-apiv2-ctr-workdir-and-env
[apiv2] don't ignore the ENV and WorkDir from the image
2020-10-01 10:00:15 -04:00
45b73c1ed7 Fix some flakes in the e2e network tests.
The network test created config files with random filenames
but the network name was static. Since the tests can run in
parallel podman was not able to distinguish the networks.
We need to make sure that each test has its own config file
and network name. This helps to prevent unnecessary flakes.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-10-01 15:56:59 +02:00
996fe49aa7 Update rootless_tutorial.md
add clarifications in persistently setting unprivileged ping permissions
Signed-off-by: fuzxi <opuspam@posteo.de>

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-10-01 09:13:39 -04:00
686ea56480 Volume prune should not pass down the force flag
podman volume prune -f

Should just tell the prune command to not prompt for confirmation.
It should not be passing the prune flag into the API.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-10-01 06:32:57 -04:00
556117c2e9 Merge pull request #7848 from cevich/fix_tests
Fix two e2e tests
2020-10-01 06:05:00 -04:00
c0dac6c5f3 Merge pull request #7858 from jwhonce/wip/http_proxy
Support --http-proxy for remote builds
2020-10-01 05:48:17 -04:00
c70f5fb19b Merge pull request #7823 from vrothberg/fix-6381
image look up: consult registries.conf
2020-10-01 03:31:06 -04:00
fad55e4730 Support --http-proxy for remote builds
* Fix misspelled parameter
 * add http-proxy support for builds

http_proxy must be set in the podman.service unit file, for example
Environment=http_proxy=<value>

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-09-30 15:56:58 -07:00
cde367c1c0 fix: The container created by APIV2 has an incorrect Env and WorkDir
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2020-10-01 05:13:01 +08:00
5954d37071 Merge pull request #7834 from xordspar0/patch-1
Don't disable Go modules when generating varlink
2020-09-30 16:44:34 -04:00
df532ee8c1 misc fixes for f33 integration tests
some small fixes for testing on fedora 33 (non-btrfs)

Signed-off-by: baude <bbaude@redhat.com>
2020-09-30 14:15:59 -05:00
1d7cb7f477 Merge pull request #7798 from QiWang19/run-manifest
Use local image if input image is a manifest list
2020-09-30 18:38:07 +00:00
7ac8000cc1 fix allowing inspect manifest of non-local image
Add support of `podman manifest inspect` returning manifest list of non-local manifest.
Close #https://github.com/containers/podman/issues/7726

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-09-30 14:12:32 -04:00
d4ca13f7c0 Distinguish userns vs containerized tests
The systemd test was inaccurately being skipped when a userns env. var.
flag was set.  At best this is confusing to new developers, and at worse
it actively blocks an otherwise legitimate class of tests.  Improve the
accuracy of skip-logic by adding/using a purpose built set of
functions.

Signed-off-by: Chris Evich <cevich@redhat.com>
2020-09-30 13:33:57 -04:00
6dccaa4f26 Don't disable Go modules when generating varlink
From a fresh install of Fedora 33 Beta and a fresh clone of the repo, `make` fails with the following error when Go modules are disabled:

    # Only generate the varlink code on Linux (see issue #4814).
    GO111MODULE=off go generate ./pkg/varlink/...
    ../../vendor/github.com/varlink/go/cmd/varlink-go-interface-generator/main.go:12:2: cannot find package "github.com/varlink/go/varlink/idl" in any of:
    	/usr/lib/golang/src/github.com/varlink/go/varlink/idl (from $GOROOT)
    	/home/test/src/podman/_output/src/github.com/varlink/go/varlink/idl (from $GOPATH)
    pkg/varlink/generate.go:3: running "go": exit status 1
    make: *** [Makefile:646: pkg/varlink/iopodman.go] Error 1

Signed-off-by: Jordan Christiansen <xordspar0@gmail.com>
2020-09-30 12:24:45 -05:00
f86e01ab10 Merge pull request #7820 from giuseppe/fix-capabilities-not-root
capabilities: always set ambient and inheritable
2020-09-30 17:22:54 +00:00
e2050d7c35 Merge pull request #7847 from rhatdan/network
Make the e2e test network cleanup more robust.
2020-09-30 16:07:26 +00:00
d24ec64887 Use local image if input image is a manifest list
If run&create image returns error: image contains manifest list, not a runnable image, find the local image that has digest matching the digest from the list and use the image from local storage for the command.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-09-30 10:38:02 -04:00
fb43e8c6a4 Merge pull request #7833 from jwhonce/issues/7826
Refactor IdleTracker to handle StateIdle transitions
2020-09-30 14:37:31 +00:00
8ff35a098c image look up: consult registries.conf
When looking up local images, take the unqualified-serach registries of
the registries.conf into account (on top of "localhost/").

Also extend the integration tests to prevent future regressions.

Fixes: #6381
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-09-30 16:30:41 +02:00
e930340e73 pkg/registries: add a retiring note
The registries package should be retired.  It was introduced as an
easier to use wrapper around c/image `sysregistries` which has been
replaced by `sysregistriesv2` a long while ago.

Users should either use the `sysregistriesv2` package directly or, even
better, we cache the config in libpod's image runtime to prevent
redundant (and ~expensive) parsing of the registries.conf files.

For now, just add a note in hope we'll not forgert about it when we find
time in the future.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-09-30 16:30:41 +02:00
bad761e7c7 Attempt to test all Broken SkipIfRootless FIXME
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-09-30 10:01:57 -04:00
5766f5b587 Make the e2e test network cleanup more robust.
We need to handle removal of non existing network.

This allows the `removeCNINetwork` function
always to be called. This is needed by tests which are trying
to remove the network manually in order to prevent flakes.

Fixes #7809

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-09-30 09:50:59 -04:00
f32fa3dd59 Fix ubuntu exec_test
Test passes on Fedora because the registry server is one of the
defaults.  However it is not typically configured on Ubuntu hosts, and
therefor this test can fail.  While specifying the FQIN in the
dockerfile text is not an ideal solution, it cannot negatively
affect other tests which utilize `podmanTest.BuildImage`.

Signed-off-by: Chris Evich <cevich@redhat.com>
2020-09-30 09:24:01 -04:00
703381b4a2 capabilities: always set ambient and inheritable
change capabilities handling to reflect what docker does.

Bounding: set to caplist
Inheritable: set to caplist
Effective: if uid != 0 then clear; else set to caplist
Permitted: if uid != 0 then clear; else set to caplist
Ambient: clear

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-09-30 15:14:07 +02:00
4d57313449 Merge pull request #7840 from vrothberg/remote-untag
fix remote untag
2020-09-30 12:58:08 +00:00
451f003ce9 Merge pull request #7841 from AkihiroSuda/fix-7789
rootless-cni-infra v3: fix cleaning up DNS entries
2020-09-30 12:41:57 +00:00
6fd0e9bb73 Merge pull request #7831 from rhatdan/env
We already set container=podman environment variable
2020-09-30 12:24:32 +00:00
08d036cbd4 Merge pull request #7825 from rhatdan/exitcode
Fix handling of remove of bogus volumes, networks and Pods
2020-09-30 11:33:19 +00:00
19f080f1af Merge pull request #7827 from vrothberg/systemd-run-error
healthchecks: return systemd-run error
2020-09-30 10:50:56 +00:00
515b919438 libpod: bump up rootless-cni-infra to v3
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-09-30 19:01:52 +09:00
eb56673b3b rootless-cni-infra v3: fix cleaning up DNS entries
Fix "Old DNS entries are not cleaned up" by passing CNI_ARGS to `cnitool del`.

Fix #7789

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-09-30 18:59:39 +09:00
1a3e409412 fix remote untag
Fix the remote client to untag all tags of the specified image.
Instead of querying the image on the client side, support the
case where both, repo and tag, are empty and remove all tags.

Reuse the ABI implementation where possible.  In retrospective,
the libpod untag endpoint should support a slice of strings to
batch remove tags rather than reaching out for each tag individually.

Enable the skipped test.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-09-30 11:57:31 +02:00
e9edddaaf2 Merge pull request #7799 from rhatdan/rootless
Make all Skips specify a reason
2020-09-30 09:18:41 +00:00
b68b6f334d Merge pull request #7832 from edsantiago/bats_run_tz
System tests: add podman run --tz
2020-09-30 00:24:55 +00:00
b496802413 Make all Skips specify a reason
Always use CGROUPV2 rather then reading from system all the time.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-09-29 16:01:26 -04:00
22474095ab Fix handling of remove of bogus volumes, networks and Pods
In podman containers rm and podman images rm, the commands
exit with error code 1 if the object does not exists.

This PR implements similar functionality to volumes, networks, and Pods.

Similarly if volumes or Networks are in use by other containers, and return
exit code 2.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-09-29 15:52:43 -04:00
453333a35c Merge pull request #7828 from edsantiago/bats
System tests: corner case for run --pull
2020-09-29 19:29:51 +00:00
ac23ff55b8 We already set container=podman environment variable
Only need to set container, no need for containers

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-09-29 15:26:45 -04:00
f03d470349 Refactor IdleTracker to handle StateIdle transitions
* Remove stutter naming for package and types
* Stop treating StateIdle the same as StateClosed, rather transitions to
  StateIdle will keep API timeout window open
* Remove redundate code

Fixes #7826

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-09-29 11:32:47 -07:00
258ccfc3c9 System tests: add podman run --tz
New tests for podman run --tz=EXPLICIT and =local. Requires
updating our testimage by adding a fixed reference timestamp
to a known file path.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-09-29 12:23:58 -06:00
12f173f473 Merge pull request #7797 from rsommer/master
[CI:DOCS] Add section about current differences
2020-09-29 17:51:05 +00:00
81d9ba59db System tests: corner case for run --pull
Obscure corner case in which 'podman run --pull=never alpine'
will actually pass *with no alpine image* if there's an
image named "myalpine". (i.e. a substring match, not full
string match). Fixed in #7770 but the tests that were added
there do not actually test that.

This adds a double-duty test for that as well as making
sure that 'run --pull=never SHORTNAME' (implicit :latest)
does not match our existing :YYYYMMDD image; then one
more quick test to make sure that if we tag as :latest,
the same --pull=never succeeds.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-09-29 10:56:40 -06:00
b07eb0bc91 healthchecks: return systemd-run error
In case `systemd-run` errors when creating transient unit files (and
timers), create an error based on the combined output from stdout and
stderr.  Using the error from `exec.Command` contains the exit code
only which is not useful to debug (see #7484).

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-09-29 18:26:15 +02:00
5aead1509c Add X-Registry-Config support
* Refactor auth pkg to support X-Registry-Config
* Refactor build endpoint to support X-Registry-Config. Supports:
  * --creds
  * --authfile
* Added X-Reference-Id Header to http.Request to support log event
  correlation
* Log headers from http.Request

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-09-29 08:46:44 -07:00
2ee415be90 Merge pull request #7788 from IceCodeNew/patch-1
Updating on supported restart policy
2020-09-29 15:38:24 +00:00