Commit graph

11260 commits

Author SHA1 Message Date
Jhon Honce
7ccccd22cd Add missing return
libpod df handler missing a return after writing error to client. This
caused a null to be appended to JSON and crashed python decoder.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-04-16 11:46:49 -04:00
Jonathan Wakely
0406fbb2bb [CI:DOCS] Fix formatting of podman-build man page
An apostrophe as the first character of the line is a formatting request
in troff, so the words "'Containerfile' or 'Dockerfile'" are not
visible when viewing 'man podman-build'.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
2021-04-16 11:45:45 -04:00
Giuseppe Scrivano
a23aecf1a6 cgroups: force 64 bits to ParseUint
[NO TESTS NEEDED]

force bitsSize==64 so that the string is always parsed to a uint64
instead of using the native int size, that could be not big enough on
32 bits arches.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-04-16 11:43:35 -04:00
Anatoli Babenia
b54fe55344 Fix slashes in socket URLs
Signed-off-by: Anatoli Babenia <anatoli@rainforce.org>
2021-04-16 11:43:05 -04:00
Jhon Honce
f218d8849d [CI:DOCS] Correct status code for /pods/create
Swagger documentation reported that the API endpoint /pods/create
returned 200 while the as-built code returned 201. 201 is more
correct so documentation updated.

Tests already checked for 201 so no updated needed.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-04-16 11:40:27 -04:00
Giuseppe Scrivano
386300443b cgroup: do not set cgroup parent when rootless and cgroupfs
do not set the cgroup parent when running as rootless with cgroupfs,
even if cgroup v2 is used.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1947999

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-04-16 11:39:20 -04:00
Jakub Guzik
0e28e3da3f Reflect current state of prune implementation in docs
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-04-16 11:26:32 -04:00
Daniel J Walsh
ac753308e8 Do not delete container twice
10 lines above we had

	// Set ContainerStateRemoving
	c.state.State = define.ContainerStateRemoving

Which causes the state to not be the two checked states.  Since the
c.cleanup call already deleted the OCI state, this meant that we were
calling cleanup, and hence the postHook hook twice.

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

[NO TESTS NEEDED] Since it would be difficult to tests this.  Main tests
should handle that the container is being deleted successfully.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-04-16 11:25:18 -04:00
Nalin Dahyabhai
443efc6134 Test that we don't error out on advertised --log-level values
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-04-16 11:22:34 -04:00
Nalin Dahyabhai
25a1e3f9d6 At trace log level, print error text using %+v instead of %v
If we're logging at trace level, use %+v instead of %v when printing an
error at exit.  If the error included stack information, this will cause
the backtrace to be printed, which is very handy for debugging.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-04-16 11:22:25 -04:00
Nalin Dahyabhai
044c0a5437 pkg/errorhandling.JoinErrors: don't throw away context for lone errors
When our multierror contains just one error, don't extract its text only
to rewrap it, because doing so discards any stack trace information that
might have been added closer to where the error actually originated.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-04-16 11:22:18 -04:00
Nalin Dahyabhai
e5fff58eb5 Recognize --log-level=trace
"trace" is a valid logrus debugging level, so we should be able to tell
the library to display messages logged at that level.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-04-16 11:22:11 -04:00
Daniel J Walsh
d98c530f9b Fix message about runtime to show only the actual runtime
Currently the debug line shows every runtime up until it finds
the correct one, confusing users on which runtime it is using.

Also move missing OCI runtime from containers/conf down to Debug level
and improved the debug message, to not report error.

[NO TESTS NEEDED] Since this is just debug.

Triggered by https://github.com/containers/podman/issues/4854

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-04-16 11:19:05 -04:00
Daniel J Walsh
4d4babac76 Fix handling of $NAME and $IMAGE in runlabel
Fixes: https://github.com/containers/podman/issues/9405

Add system runlabel tests.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-04-16 11:17:43 -04:00
Daniel J Walsh
fc99c7d0a3 Fix flake on failed podman-remote build : try 2
This time we are checking if the function actually succeeded,
otherwise we will report an error.

Also if we did not get the id, report unexpected failure.

[NO TESTS NEEDED] Still no good way to test this, but manually.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-04-16 11:16:36 -04:00
Daniel J Walsh
5c21861b5d Fix flake on failed podman-remote build
We have a race condition where podman build can fail
but still return an exit code of 0.  This PR ensures
that as soon as the build fails, the failed flag is set
eliminating the race.

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

[NO TESTS NEEDED] Tests of failed builds are already in place, and
the elimination of the race should be enough.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-04-16 11:16:15 -04:00
Pablo Correa Gómez
6be08f4b1d Update documentation of podman-run to reflect volume "U" option
The "U" option is accepted by `--volume` in `podman-build`,
but documentation is missing

Signed-off-by: Pablo Correa Gómez <ablocorrea@hotmail.com>
2021-04-16 11:15:05 -04:00
zhangguanzhang
6a47afa79c Fixes invalid expression in save command
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2021-04-16 11:13:21 -04:00
Paul Holzinger
c28695b925 Fix possible panic in libpod/image/prune.go
podman image prune paniced locally for me. The error handling was not
done correctly and we could end up with a nil pointer dereference.

[NO TESTS NEEDED] I have no idea how I could force an error in img.Size().

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-04-16 11:11:26 -04:00
Matthew Heon
2816c55f3a Update all containers/ project vendors
Bumps:
- c/storage to v1.29.0
- c/image to v5.11.0
- c/common to v0.36.0
- Buildah to v1.20.1

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-04-16 11:07:33 -04:00
OpenShift Merge Robot
bd94d84fad
Merge pull request #9875 from mheon/bump_310
[CI:DOCS] Bump to v3.1.0
2021-03-30 00:34:38 +00:00
Matthew Heon
bce3e6c5fa Fix tests
Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-03-29 17:29:19 -04:00
Matthew Heon
ec1a512ac0 Bump to v3.1.1-dev
Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-03-29 16:44:43 -04:00
Matthew Heon
9f09fb62cb
Bump to v3.1.0
Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-03-29 16:43:13 -04:00
OpenShift Merge Robot
f24fabba13
Merge pull request #9868 from mheon/310_backports
Final backports for v3.1.0
2021-03-29 20:36:07 +00:00
Matthew Heon
1386f90467 Fix test failure
Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-03-29 15:00:43 -04:00
Matthew Heon
38bb77c5be Update release notes for v3.1.0 final release
Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-03-29 13:55:43 -04:00
Daniel J Walsh
670e1ac67c [NO TESTS NEEDED] Turn on podman-remote build --isolation
Currently podman only works with --isolation chroot.  This PR
fixes this by allowing the isolation mode to default to OCI and to
also allow users to pass the isolation mode into the containers.

The current tests for --isolation should cause this code to be tested.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-03-29 13:54:14 -04:00
Paul Holzinger
ac4bdd2653 Fix long option format on docs.podman.io
Escape the two dashes, otherwise they are combined into one long dash.
I tested that this change is safe and still renders correctly on github
and with the man pages.

This commit also contains a small change to make it build locally.
Assuming you have the dependencies installed you can do:
```
cd docs
make html
```
Preview the html files in docs/build/html with
`python -m http.server 8000 --directory build/html`.

Fixes containers/podman.io#373

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-03-29 13:53:50 -04:00
Jakub Guzik
96ffce2198 Fix containers list/prune http api filter behaviour
The problem described in #9711 and followed by #9758 affects
containers as well. When user provides wrong filter input, error
message should occur, not fallback to full list/prune command.
This change fixes the issue. Additionally, there are error message
fixes for docker http api compat.

Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-03-29 13:48:59 -04:00
TomSweeneyRedHat
e772719bfd [CI:DOCS] Add note to mappings for user/group userns in build
Add a note to the `--userns-uid-map` and `--userns-gid-map` options in
the `podman build` man page.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1930509

Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2021-03-29 13:48:15 -04:00
TomSweeneyRedHat
52cd3ce2d9 Validate passed in timezone from tz option
Erik Sjolund reported an issue where a badly formated file
could be passed into the `--tz` option and then the date in the container
would be badly messed up:

```
erik@laptop:~$ echo Hello > file.txt
erik@laptop:~$ podman run --tz=../../../home/erik/file.txt --rm -ti
docker.io/library/alpine cat /etc/localtime
Hello
erik@laptop:~$ podman --version
podman version 3.0.0-rc1
erik@laptop:~$
```
This fix checks to make sure the TZ passed in is a valid
value and then proceeds with the rest of the processing.

This was first reported as a potential security issue, but it
was thought not to be.   However, I thought closing the hole
sooner rather than later would be good.

Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2021-03-29 13:42:36 -04:00
Jordan Williams
633ae014e6 Generate Kubernetes PersistentVolumeClaims from named volumes
Fixes #5788

This commit adds support for named volumes in podman-generate-kube.
Named volumes are output in the YAML as PersistentVolumeClaims.
To avoid naming conflicts, the volume name is suffixed with "-pvc".
This commit adds a corresponding suffix for host path mounts.
Host path volumes are suffixed with "-host".

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
2021-03-29 13:41:19 -04:00
Valentin Rothberg
c9640bab79 libpod/image: unit tests: use a registries.conf for aliases
Since some unit tests use "busybox", we need to point it to some alias
if we want it to pass CI on F34 where we're running in enforced mode.

Furthermore, make sure that the registries.conf can actually be
overridden in the code.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-03-29 13:27:39 -04:00
Valentin Rothberg
43c772aa29 libpod/image: unit tests: defer cleanup
Defer cleaning up the test artifacts as early as possible.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-03-29 13:27:33 -04:00
Valentin Rothberg
396a59b022 libpod/image: unit tests: use require.NoError
In contrast to `assert.NoError`, `require.NoError` treats mismatches
fatally which in many cases is necessary to prevent subsequent checks
from segfaulting.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-03-29 13:27:26 -04:00
Jakub Guzik
a01b387e82 Unification of until filter across list/prune endpoints
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-03-29 13:26:24 -04:00
Jakub Guzik
183a68a817 Unification of label filter across list/prune endpoints
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-03-29 13:26:18 -04:00
Matej Vasek
d1589f2804 fixup
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-03-29 13:25:40 -04:00
Matej Vasek
31351ad94b fix: build endpoint for compat API
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-03-29 13:25:32 -04:00
Daniel J Walsh
7148544df0 [NO TESTS NEEDED] Remove /tmp/containers-users-* files on reboot
Helps Fix https://github.com/containers/podman/issues/9765

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-03-29 13:24:36 -04:00
Daniel J Walsh
88672b58cf Check if stdin is a term in --interactive --tty mode
If you are attempting to run a container in interactive mode, and want
a --tty, then there must be a terminal in use.

Docker exits right away when a user specifies to use a --interactive and
--TTY but the stdin is not a tty.

Currently podman will pull the image and then fail much later.

Podman will continue to run but will print an warning message.

Discussion in : https://github.com/containers/podman/issues/8916

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-03-29 13:23:14 -04:00
Phoenix The Fallen
23f3805df2 [NO TESTS NEEDED] Fix rootless volume plugins
In a case of volume plugins with custom options.

Signed-off-by: Phoenix The Fallen <thephoenixofthevoid@gmail.com>
2021-03-29 13:21:52 -04:00
Matthew Heon
5e3445e6e0 Ensure manually-created volumes have correct ownership
As part of a fix for an earlier bug (#5698) we added the ability
for Podman to chown volumes to correctly match the user running
in the container, even in adverse circumstances (where we don't
know the right UID/GID until very late in the process). However,
we only did this for volumes created automatically by a
`podman run` or `podman create`. Volumes made by
`podman volume create` do not get this chown, so their
permissions may not be correct. I've looked, and I don't think
there's a good reason not to do this chwon for all volumes the
first time the container is started.

I would prefer to do this as part of volume copy-up, but I don't
think that's really possible (copy-up happens earlier in the
process and we don't have a spec). There is a small chance, as
things stand, that a copy-up happens for one container and then
a chown for a second, unrelated container, but the odds of this
are astronomically small (we'd need a very close race between two
starting containers).

Fixes #9608

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-03-29 13:19:53 -04:00
Eduardo Vega
6b69892064 Support multi doc yaml for generate/play kube
Signed-off-by: Eduardo Vega <edvegavalerio@gmail.com>

<MH: Fixed cherry-pick conflicts>

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-03-29 13:16:49 -04:00
Jhon Honce
d560f168f6 Correct json field name
[NO TESTS NEEDED]

* When using the Namespace type, the field Value was json encoded
  with the name "string" vs "value".

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-03-29 11:58:52 -04:00
Jakub Guzik
573ed9220b Fix filters in image http compat/libpod api endpoints
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-03-29 11:58:26 -04:00
Paul Holzinger
1b349d79ad podman generate systemd --new do not duplicate params
podman generate systemd --new inserts extra idfile arguments. The
generated unit can break when the user did provide their own idfile
arguments as they overwrite the arguments added by generate systemd.
This also happens when a user tries to generate the systemd unit on
a container already create with a --new unit. This should now
create a identical unit. The solution is to remove all user provided
idfile arguments.

This commit also ensures that we do not remove arguments that are part
off the containers entrypoint.

Fixes #9776

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-03-29 11:46:36 -04:00
Daniel J Walsh
1089f83a40 Fix podman build --pull-never
Currently pull policy is set incorrectly when users set --pull-never.

Also pull-policy is not being translated correctly when using
podman-remote.

Fixes: #9573

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

<MH: Fixed cherry-pick conflict>

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-03-29 11:43:32 -04:00
Valentin Rothberg
be02c8581c man pages: correct seccomp-policy label
The implementation uses `io.containers.seccomp.profile` while the docs
mentioned `io.podman`.  Correct the two references in the docs to
reflect the implementation.

Fixes: #9853
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-03-29 11:41:58 -04:00