Commit graph

635 commits

Author SHA1 Message Date
Ed Santiago 471a4356bf CI: rootless user: also create in some root tests
viz, rootful system tests. The rootless account will be
used by image-scp tests.

Unfortunately, having ssh available means the system-connection
tests will start running, which is very bad because they will
fail, because system connection doesn't actually work (long story).
Add a few more checks to prevent this test from running.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-01-17 14:40:30 -07:00
Ed Santiago c8124b88ae [WIP] Tests for podman image scp (the sudo form)
Start inching our way back to having tests for the sudo form
of podman image scp. Basically, copy an image to another user
and then back, using a pseudorandom name. Confirm that the
image makes it to the remote end, and that when we copy it
back, the original image digest is preserved.

When scp'ing as root, we identify the destination rootless
user account via the $PODMAN_ROOTLESS_USER envariable. Setting
this and creating the account is left as an exercise for the
CI framework (be it github, or Fedora/CentOS/RHEL gating, or
other).

Also: amend hack/bats to set and relay $PODMAN_ROOTLESS_USER,
so developers can test locally.

Also: remove what I'm 99% sure is a debugging printf.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-01-17 14:40:30 -07:00
Erik Sjölund 3c2a5947c2 fix default branch links
* Replace https://github.com/containers/podman/blob/master
  with https://github.com/containers/podman/blob/main
  to match the new default branch "main". Previously
  the default branch was "master". This is the only
  occurence found in the code.

* Replace https://raw.githubusercontent.com/containers/libpod/master
  with https://raw.githubusercontent.com/containers/podman/main

Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
2022-01-15 22:08:42 +01:00
Daniel J Walsh 13917dfab9
test/system: podman run update /etc/hosts
This test case is used for covering rhbz#1902979.

Signed-off-by: Alex Jia <ajia@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-14 07:51:23 -05:00
Valentin Rothberg a4cef54350 podman container rm: remove pod
Support removing the entire pod when --depend is used on an infra
container.  --all now implies --depend to properly support removing all
containers and not error out when hitting infra containers.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2022-01-13 17:08:31 +01:00
Daniel J Walsh fa6405c3c3
use events_logfile_path from containers.conf for events log.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-13 08:14:50 -05:00
Giuseppe Scrivano 194d14ca2f
libpod: fix check for systemd session
move the check after the cgroup manager is set, so to correctly detect
--cgroup-manager=cgroupfs and do not raise a warning about dbus not
being present.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-01-12 21:18:15 +01:00
Daniel J Walsh fde6ad6373
Add --noout option to prevent the output of ids
Fixes: https://github.com/containers/podman/issues/11515

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-12 08:32:42 -05:00
Daniel J Walsh 83b0fb4696
Fix permission on secrets directory
This directory needs to be world searchable so users can access it from
different user namespaces.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-11 16:19:50 -05:00
Daniel J Walsh 8f2358eeaa
Add podman rm --depend
This option causes Podman to not only remove the specified containers
but all of the containers that depend on the specified
containers.
Fixes: https://github.com/containers/podman/issues/10360

Also ran codespell on the code

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-11 14:33:54 -05:00
OpenShift Merge Robot ed9ef59e7e
Merge pull request #12780 from rhatdan/pod
Use the InfraImage defined in containers.conf
2022-01-11 00:25:09 +01:00
Daniel J Walsh 19a4759066
Use the InfraImage defined in containers.conf
Remove hard code use of the DefaultInfraImage and rely on
getting this from containers.conf.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-10 16:13:33 -05:00
Ed Santiago 508f9b76ea System tests: fix RHEL8 gating tests
Add a fix for RHEL8 gating tests. This resolves yet another
journald/file events/logger mismatch bug.

Also, while I'm at it, more log cleanup: a recently-added test was
missing final rm/rmi, resulting in big red scary output in test logs.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-01-10 12:14:53 -07:00
OpenShift Merge Robot 41934acc51
Merge pull request #12733 from rhatdan/copy
Set volume NeedsCopyUp to false iff data was copied up
2022-01-07 20:38:59 +01:00
Ed Santiago f688908151 Emergency system-test fixes
Emergency fix to image-scp tests. DO NOT CREATE A USER!
These tests are run in all sorts of environments. We
do not have the right to vandalize a production system.

Also remove some misleading unneeded tests; and refactor a
little; and add a bunch of FIXMEs which will need to be
addressed later.

Also, super-low priority, add 'crun: ' to expected error
message in a run test (minor followup to #12758).

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-01-06 15:54:01 -07:00
Daniel J Walsh 1941d45e32
add OCI Runtime name to errors
It would be easier to diagnose OCI runtime errors if the error actually
had the name of the OCI runtime that produced the error.

[NO NEW TESTS NEEDED]

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-06 16:21:02 -05:00
Daniel J Walsh 13f3fd2555
Set volume NeedsCopyUp to false iff data was copied up
Currently Docker copies up the first volume on a mountpoint with
data.

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

Also added NeedsCopyUP, NeedsChown and MountCount to the podman volume
inspect code.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-06 10:42:34 -05:00
OpenShift Merge Robot 755b7aa521
Merge pull request #12687 from rhatdan/volume
Support volume bind mounts for rootless containers
2022-01-06 15:16:13 +01:00
OpenShift Merge Robot d67f178563
Merge pull request #12750 from rhatdan/error
Change Tests to ignore missing containers when removing --all
2022-01-05 18:10:37 +01:00
OpenShift Merge Robot cbb2b68fc9
Merge pull request #12429 from cdoern/scp
podman image scp never enter podman user NS
2022-01-05 17:50:37 +01:00
Daniel J Walsh 64df41755a
Change Tests to ignore missing containers when removing --all
Fixes: https://github.com/containers/podman/issues/12740

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-05 10:46:53 -05:00
Daniel J Walsh 2e0d3e9ea4
Support all volume mounts for rootless containers
Fix handling of "bind" and "tmpfs" olumes to actually work.
Allow bind, tmpfs local volumes to work in rootless mode.

Also removed the string "error" from all error messages that begine with it.
All Podman commands are printed with Error:, so this causes an ugly
stutter.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-04 13:48:03 -05:00
Daniel J Walsh 2ff5644bf8
test/system: podman run image with filesystem permission
This test case is used for covering rhbz#1854566.

Replaces: #12220
Signed-off-by: Alex Jia <ajia@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-31 08:59:09 -05:00
Daniel J Walsh fc65b0f73c
test/system: podman run with log-opt option
This test case is used for covering rhbz#1763007.
Replaces: #12221

Signed-off-by: Alex Jia <ajia@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-31 08:49:21 -05:00
cdoern f6d00ea6ef podman image scp never enter podman user NS
Podman image scp should never enter the Podman UserNS unless it needs to. This allows for
a sudo exec.Command to transfer images to and from rootful storage. If this command is run using sudo,
the simple sudo podman save/load does not work, machinectl/su is necessary here.

This modification allows for both rootful and rootless transfers, and an overall change of scp to be
more of a wrapper function for different load and save calls as well as the ssh component

Signed-off-by: cdoern <cdoern@redhat.com>
2021-12-23 10:10:51 -05:00
Daniel J Walsh e8c06fac97
Allow users to add host user accounts to /etc/passwd
Some containers require certain user account(s) to exist within the
container when they are run. This option will allow callers to add a
bunch of passwd entries from the host to the container even if the
entries are not in the local /etc/passwd file on the host.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1935831

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-23 07:51:27 -05:00
OpenShift Merge Robot 1b9a5964db
Merge pull request #12599 from rhatdan/kernelmemory
Warn on use of --kernel-memory
2021-12-23 10:56:08 +01:00
OpenShift Merge Robot 2aea0a5e9b
Merge pull request #12375 from rhatdan/hosts
Use hosts public ip address in rootless containers
2021-12-22 16:40:10 +01:00
Daniel J Walsh a5e49d9668
Warn on use of --kernel-memory
It has been deprecated and is no longer supported.  Fully remove it and
only print a warning if a user uses it.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2011695

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-22 06:20:21 -05:00
Valentin Rothberg 04dbbd96b6 support hosts without /etc/hosts
Fixes: #12667
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-22 10:15:24 +01:00
Daniel J Walsh 64ce6949f2
Use hosts public ip address in rootless containers
Add first non localhost ipv4 of all host interfaces as destination
for host.contaners.internal for rootless containers.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-21 08:50:40 -05:00
Giuseppe Scrivano 89ee302a9f
specgen: honor userns=auto from containers.conf
when using the default userns value, make sure its value is parsed so
that userns=auto is parsed and the options for the storage are filled.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-12-20 17:03:40 +01:00
Giuseppe Scrivano 46a094a7a2
test: add --rm to podman run commands
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-12-20 09:00:52 +01:00
Daniel J Walsh f45070ee0e
Merge pull request #12626 from vrothberg/may-the-force-be-with-removal
image rm: allow for force-remove infra images
2021-12-19 06:18:21 -05:00
Valentin Rothberg 12d762f8ee image rm: allow for force-remove infra images
Force removal of images will also remove associated containers.
Historically, infra containers have been excluded resulting in
rather annoying errors, for instance, when running `rmi -af`.

Since there is not reasons to exclude infra containers, allow for
removing the entire pod when an infra image is force removed.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-17 13:23:11 +01:00
OpenShift Merge Robot 820cf0e066
Merge pull request #12622 from flouthoc/return_exit_code_for_build
build: relay `exitcode` from imagebuildah to registry
2021-12-17 13:16:23 +01:00
Aditya Rajan 6423174c67
tests: adjust old build test to expect exit code
Old build tests were expecting genric error code `125` however another
commit in this PR ensures that we relay exact exit code from build to
registry.

Hence adjusting tests

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-12-17 16:20:03 +05:30
Valentin Rothberg 3b6510da68 kill: fix output
Make sure that `kill -a` is printing the IDs of killed containers.
Previously, it was only printing empty lines.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-16 13:04:58 +01:00
OpenShift Merge Robot 9212c74ff1
Merge pull request #12600 from rhatdan/external
Show --external containers even without --all option
2021-12-15 15:43:11 +01:00
OpenShift Merge Robot 7dabcbd7bc
Merge pull request #12534 from Luap99/network-db
network db rewrite
2021-12-15 15:25:14 +01:00
Daniel J Walsh 51a4bef2e6
Show --external containers even without --all option
We currently do not show --external containers when the user specifies
it, unless they also specify the --all flag. This has led to confusion.
I see no reason not to list them without the --all flag if the user
specifies the option.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-14 16:03:21 -05:00
Paul Holzinger 3e9af2029f
play kube add support for multiple networks
Allow the same --network options for play kube as for podman run/create.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-14 15:23:40 +01:00
Paul Holzinger 535818414c
support advanced network configuration via cli
Rework the --network parse logic to support multiple networks with
specific network configuration settings.
--network can now be set multiple times. For bridge network mode the
following options have been added:
  - **alias=name**: Add network-scoped alias for the container.
  - **ip=IPv4**: Specify a static ipv4 address for this container.
  - **ip=IPv6**: Specify a static ipv6 address for this container.
  - **mac=MAC**: Specify a static mac address address for this container.
  - **interface_name**: Specify a name for the created network interface inside the container.

So now you can set --network bridge:ip=10.88.0.10,mac=44:33:22:11:00:99
for the default bridge network as well as for network names.
This is better than using --ip because we can set the ip per network
without any confusion which network the ip address should be assigned
to.
The --ip, --mac-address and --network-alias options are still supported
but --ip or --mac-address can only be set when only one network is set.
This limitation already existed previously.

The ability to specify a custom network interface name is new
Fixes #11534

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-14 15:23:39 +01:00
Paul Holzinger 5f1f62f0bb
network ls: show networks in deterministic order
The new network backend stores the networks in a map so the returned
order is not deterministic. Lets sort the network names alphabetically
to ensure a deterministic order.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-14 13:52:38 +01:00
Daniel J Walsh 593d0907c5
--hostname should be set when using --pod new:foobar
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2030599

When you create pod, it shares the UTS namespace with Containers.
Currently the --hostname is not passed to the pod created when
you create a container and pod in the same command.

Also fix error message on supported --share flags

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-09 13:09:02 -05:00
Ed Santiago 18854f5666 System tests: remove rm_pause_image()
...it's not needed: teardown() already does it. Or, it would,
if it had been updated to deal with the new pause image naming
convention, which I've just done.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-12-09 08:23:43 -07:00
Valentin Rothberg 2d517b687b generate systemd: support entrypoint JSON strings
Make sure to preserve the quoting of entrypoint JSON strings.

Fixes: #12477
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-08 15:51:23 +01:00
OpenShift Merge Robot 9af07fd3ed
Merge pull request #12522 from edsantiago/minor_test_cleanup
tests: clean up FIXMEs and noise
2021-12-06 17:55:24 +00:00
Ed Santiago eee3a42b7e tests: clean up FIXMEs and noise
e2e tests:
 * remove two FIXMEs:
   * one of them is expected behavior, not a FIXME
   * the other is easily fixed

 * File issue #12521 for a real podman-remote bug, and
   update the Skip() message

system tests:
 * in command-completion test, clean up stray podman-pause image
   (followup to #12322, in which I missed this instance). This
   removes distracting warnings from test logs.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-12-06 08:30:59 -07:00
Valentin Rothberg 207065ce9f fix remote run/start flake
Fix the flake reported in #9597 with a workaround to at least stop
wasting energy until the root cause has been found and fixed.

It seems that a remote run returns before the container has transitioned
into the `exited` state which ultimately breaks a subsequent remote
start with attach.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-06 15:30:31 +01:00