13592 Commits

Author SHA1 Message Date
db3a4c070f [NO NEW TESTS NEEDED] Refactor podman container command output
Leverage new report.Formatter allowing better compatibility from
podman command output.

See #10974
See #12455

Depends on containers/common#831

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-12-01 11:17:40 -07:00
295a6f7dd0 Merge pull request #12454 from edsantiago/remove_betrue
More BeTrue cleanup
2021-11-30 21:03:32 +01:00
85101f69d8 Merge pull request #12414 from flouthoc/api-allow-secrets
tunnel: allow `remote` and `API` to accept `--secrets`
2021-11-30 19:29:33 +01:00
8eb0be0a29 a few more manual BeTrue cleanups
Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-11-30 10:13:16 -07:00
f7cbb1d845 Convert strings.Contains() to Expect(ContainSubstring)
...done manually, not via sed, because some of the inner
expressions include nested commas.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-11-30 09:53:15 -07:00
12787963b0 e2e tests: more cleanup of BeTrue()s
Write a BeValidJSON() matcher, and replace IsJSONOutputValid():

  sed -i -e 's/Expect(\(.*\)\.IsJSONOutputValid()).To(BeTrue())/Expect(\1.OutputToString())\.To(BeValidJSON())/' test/e2e/*_test.go

(Plus a few manual tweaks)

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-11-30 09:51:06 -07:00
3fac03cf04 Merge pull request #12449 from vrothberg/fix-12438
systemd: replace multi-user with default.target
2021-11-30 17:09:33 +01:00
771f8c628b Merge pull request #12435 from vrothberg/fix-12320
compat API: allow enforcing short-names resolution to Docker Hub
2021-11-30 16:30:23 +01:00
9a10e2124b systemd: replace multi-user with default.target
Replace `multi-user.target` with `default.target` across the code base.
It seems like the multi-user one is not available for (rootless) users
on F35 anymore is causing issues in all kinds of ways, for instance,
enabling the podman.service or generated systemd units.

Fixes: #12438
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-11-30 14:37:25 +01:00
5bdd571b1e compat API: allow enforcing short-names resolution to Docker Hub
The Docker-compatible REST API has historically behaved just as the rest
of Podman and Buildah (and the atomic Docker in older RHEL/Fedora) where
`containers-registries.conf` is centrally controlling which registries
a short name may resolve to during pull or local image lookups.  Please
refer to a blog for more details [1].

Docker, however, is only resolving short names to docker.io which has
been reported (see #12320) to break certain clients who rely on this
behavior.  In order to support this scenario, `containers.conf(5)`
received a new option to control whether Podman's compat API resolves
to docker.io only or behaves as before.

Most endpoints allow for directly normalizing parameters that represent
an image.  If set in containers.conf, Podman will then normalize the
references directly to docker.io.  The build endpoint is an outlier
since images are also referenced in Dockerfiles.  The Buildah API,
however, supports specifying a custom `types.SystemContext` in which
we can set a field that enforces short-name resolution to docker.io
in `c/image/pkg/shortnames`.

Notice that this a "hybrid" approach of doing the normalization directly
in the compat endpoints *and* in `pkg/shortnames` by passing a system
context.  Doing such a hybrid approach is neccessary since the compat
and the libpod endpoints share the same `libimage.Runtime` which makes
a global enforcement via the `libimage.Runtime.systemContext`
impossible.  Having two separate runtimes for the compat and the libpod
endpoints seems risky and not generally applicable to all endpoints.

[1] https://www.redhat.com/sysadmin/container-image-short-names

Fixes: #12320
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-11-30 14:22:52 +01:00
c80a2e4495 podman-remote: prevent leaking secret into image
Prevents temp secrets leaking into image by moving it away from context
directory to parent builder directory. Builder directory automatically
gets cleaned up when we are done with the build.

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-11-30 15:44:10 +05:30
8de68b1707 Merge pull request #12408 from rhatdan/stdout
Only open save output file with WRONLY
2021-11-30 10:44:21 +01:00
e7204178e1 podman-remote: copy secret to contextdir is absolute path on host
Podman remote must treat build secrets as part of context directory. If
secret path is absolute path on host copy it to tar file and pass it to
remote server.

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-11-30 14:19:29 +05:30
bfcaf538bb api: allow build api to accept secrets
Following commit makes sure that `build` api can accept external
secret and allows currently `NOOP` `podman-remote build -t tag
--secret id=mysecret,src=/path/on/remote` to become functional.

Just like `docker` following api is a hidden field and only exposed to
`podman-remote` but could document it if it needs exposed on `swagger`.

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-11-30 14:19:17 +05:30
d51ebca0c1 Merge pull request #12412 from rhatdan/man
[CI:DOCS] List /etc/containers/certs.d as default for --cert-path
2021-11-29 23:12:19 +01:00
5f7e3c939c Merge pull request #12407 from edsantiago/bindings_test_add_gitcommit
Bindings test: emit GIT_COMMIT, for links in logs
2021-11-29 22:44:18 +01:00
931c08157e Only open save output file with WRONLY
The previous code fails on a MAC when opening /dev/stdout

Fixes: https://github.com/containers/podman/issues/12402

[NO NEW TESTS NEEDED] No easy way to test this.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-11-29 16:41:11 -05:00
97c21ff78f Merge pull request #12439 from rhatdan/Dockerfile
[CI:DOCS] Move the chown to after the ADDs
2021-11-29 22:40:17 +01:00
2b0b4327c4 Merge pull request #12405 from flouthoc/compat-build-error
compat: Add compatiblity with `Docker/Moby` API for scenarios where build fails.
2021-11-29 22:38:19 +01:00
6052914222 Merge pull request #12433 from matejvasek/fix-mount-parsing
fix: parsing of HostConfig.Mounts for container create
2021-11-29 22:10:18 +01:00
c234c20a70 Merge pull request #12401 from edsantiago/lint_tests
e2e tests: enable golint
2021-11-29 18:08:20 +01:00
f330c197bd List /etc/containers/certs.d as default for --cert-path
Helps Document https://github.com/containers/podman/issues/10116

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-11-29 10:42:27 -05:00
b63d696405 e2e tests: enable golint
...and fix problems found therewith.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-11-29 08:30:00 -07:00
697ff213dd fix: parsing of HostConfig.Mounts for container create
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-11-29 15:57:56 +01:00
2e50514ade Move the chown to after the ADDs
I have noticed that the containers.conf file in the /home/podman
directory is owned by root and not Podman. This change fixes the
ownership.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-11-29 09:35:32 -05:00
3d19f1a7fa Merge pull request #12431 from matejvasek/fix-ctr-archive-ep
fix: error reporting for archive endpoint
2021-11-29 12:14:17 +01:00
cbda62d1be fix: error reporting for archive endpoint
Returning 500 when copying to read-only destination.

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-11-28 19:02:15 +01:00
7324d94648 Merge pull request #12406 from Luap99/xdg-checkpoint
checkpoint do not modify XDG_RUNTIME_DIR
2021-11-25 12:02:10 +01:00
12f73d5f88 Merge pull request #12403 from giuseppe/improve-cgroup-detection
libpod: improve heuristic to detect cgroup
2021-11-25 11:59:09 +01:00
d5c3cc9496 Bindings test: emit GIT_COMMIT, for links in logs
Add a magic 'echo' to runner.sh, displaying $GIT_COMMIT in
a special syntax. The logformatter script, seeing this,
will hyperlink error messages to the failing source file.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-11-24 07:42:11 -07:00
bc3c5be2fb checkpoint do not modify XDG_RUNTIME_DIR
We should not modify the XDG_RUNTIME_DIR env value during runtime of
libpod, this can cause hard to find bugs. Only set it for the OCI
runtime, this matches the other commands such as start, stop, kill...

[NO NEW TESTS NEEDED]

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-11-24 15:02:11 +01:00
e648122b29 libpod: improve heuristic to detect cgroup
improve the heuristic to detect the scope that was created for the container.
This is necessary with systemd running as PID 1, since it moves itself
to a different sub-cgroup, thus stats would not account for other
processes in the same container.

Closes: https://github.com/containers/podman/issues/12400

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-11-24 14:50:12 +01:00
a66f40b4df libpod, inspect: export cgroup path
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-11-24 14:50:12 +01:00
b25b330306 stats: get the memory limit from the spec
OCI runtimes may set the memory limits in different ways, e.g., crun
creates a sub-cgroup where the limits are applied, while runc applies
them directly on the created cgroup.  Since there is standardization
on the cgroup path to use, just use the limit specified in the spec
file.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-11-24 14:50:12 +01:00
93138541f3 Merge pull request #12404 from giuseppe/unlock-thread-only-on-success
libpod: leave thread locked on errors
2021-11-24 13:37:01 +01:00
84e81252f2 compat: Add compatiblity with Docker/Moby API for scenarios where build fails
In order to maintain compatiblity with `moby API` we must the field
`errorDetail` which is primary error reporting field with stream.

Currently podman is using `error` which is already deprecated by moby.

Check: https://github.com/moby/moby/blob/master/pkg/jsonmessage/jsonmessage.go#L147

[NO NEW TESTS NEEDED]
We can't test this in podman CI since we dont have a docker client.

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-11-24 15:51:12 +05:30
c7ebaeee0e libpod: leave thread locked on errors
if the SELinux label could not be restored correctly, leave the OS
thread locked so that it is terminated once it returns to the threads
pool.

[NO NEW TESTS NEEDED] the failure is hard to reproduce

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-11-24 11:08:23 +01:00
4b014a3aec Merge pull request #12398 from edsantiago/remove_betrue
continue e2e test cleanup
2021-11-24 09:07:02 +01:00
04be1e6485 Merge pull request #12388 from rhatdan/test
Unset SocketLabel after system finishes checkpointing
2021-11-24 01:46:09 +01:00
eb3708a524 Find and fix empty Expect()s
That previous commit made me wonder if there are any other
instances of Expect() with no assertions.

   grep Expect test/e2e/*_test.go |egrep -v '\.(To|NotTo|Should)'

...finds a couple of handfuls, most of which are OK (continued
on the next line) but a few of which are bugs. Fix those.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-11-23 15:39:04 -07:00
df6aa67302 Unset SocketLabel after system finishes checkpointing
This should fix the SELinux issue we are seeing with talking to
/run/systemd/private.

Fixes: https://github.com/containers/podman/issues/12362

Also unset the XDG_RUNTIME_DIR if set, since we don't know when running
as a service if this will cause issue.s

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-11-23 16:31:54 -05:00
c034147fe7 Remove StringInSlice(), part 2
These were NOPs, and were testing the wrong thing (pod ID,
not container ID). Fixed manually.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-11-23 13:50:35 -07:00
2fcb39586c Remove StringInSlice(), part 1
via: sed -i -e 's/Expect(StringInSlice(\(.*\), \(.*\))).To(BeTrue())/Expect(\2)\.To(ContainElement(\1))/' test/e2e/*_test.go

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-11-23 13:50:35 -07:00
cd59721de1 e2e test cleanup, continued
Continue eliminating GrepString() and BeTrue(), in tiny
incremental steps. Here I take the liberty of refactoring
some hard-to-read code by adding a helper.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-11-23 13:50:35 -07:00
1be4c36e7e Merge pull request #12371 from jakub-dzon/env-config-maps
Support env variables based on ConfigMaps sent in payload
2021-11-23 19:30:15 +01:00
3482f3f32d Merge pull request #12397 from mheon/warn_on_failed_update
Warn on failing to update container status
2021-11-23 13:28:39 -05:00
b2d4d62c13 Merge pull request #12377 from markzhang1996/patch-1
[CI:DOCS] Update basic_networking.md
2021-11-23 17:11:15 +01:00
5336363957 Update basic_networking.md
Correct a missing link in basic networking tutorial.

Signed-off-by: Mark Zhang <markzhang1994@gmail.com>
2021-11-23 23:43:32 +08:00
400ccc6205 Merge pull request #12328 from serverwentdown/fix-compat-ipaddress
compat: Add subnet mask behind IP address to match Docker API
2021-11-23 10:39:32 -05:00
ee61280665 Merge pull request #12361 from rhatdan/remote
podman-remote does not support signature-policy
2021-11-23 09:50:26 -05:00