Commit Graph

3633 Commits

Author SHA1 Message Date
Daniel J Walsh 3508bd22fe
Add support for podman context as alias to podman system connection
Alias
podman --context -> podman --connection
podman context use -> podman system connection default
podman context rm -> podman system connection rm
podman context create -> podman system connection add
podman context ls ->podman system connection ls
podman context inspect ->podman system connection ls --json (For
specified connections)

Podman context is a hidden command, but can be used for existing scripts
that assume Docker under the covers.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-09-15 08:17:15 -04:00
Paul Holzinger 7f8e99ded4
podman version: use report.Formatter over Template
Currently the podman command --format output code uses a mix of
report.Formatter and report.Template.

I patched report.Formatter to correctly handle newlines[1]. Since we
cannot fix this with report.Template we have to migrate all users to
report.Formatter. This ensures consistent behavior for all commands.

This change does not change the output.

[1] https://github.com/containers/common/pull/1146

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-09-13 10:33:15 +02:00
Paul Holzinger 0c21dcf70c
podman machine info: use report.Formatter over Template
Currently the podman command --format output code uses a mix of
report.Formatter and report.Template.

I patched report.Formatter to correctly handle newlines[1]. Since we
cannot fix this with report.Template we have to migrate all users to
report.Formatter. This ensures consistent behavior for all commands.

This change does not change the output.

[1] https://github.com/containers/common/pull/1146

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-09-13 10:33:14 +02:00
Paul Holzinger e5389e98f7
podman info: use report.Formatter over Template
Currently the podman command --format output code uses a mix of
report.Formatter and report.Template.

I patched report.Formatter to correctly handle newlines[1]. Since we
cannot fix this with report.Template we have to migrate all users to
report.Formatter. This ensures consistent behavior for all commands.

This change does not change the output.

[1] https://github.com/containers/common/pull/1146

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-09-13 10:33:14 +02:00
Paul Holzinger 43f7bdf822
podman inspect return exit code > 0 on print error
Unlikely to happen but when there is an error printing the data to
stdout (either as json or go template) we should not just log it and
exit with 0. Instead return a proper error and exit with 125.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-09-13 10:33:14 +02:00
Paul Holzinger 00240a0e2e
podman inspect: use report.Formatter over Template
Currently the podman command --format output code uses a mix of
report.Formatter and report.Template.

I patched report.Formatter to correctly handle newlines[1]. Since we
cannot fix this with report.Template we have to migrate all users to
report.Formatter. This ensures consistent behavior for all commands.

This change does not change the output, we can add a new test for the
newline bug when the common PR is vendored in.

[1] https://github.com/containers/common/pull/1146

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-09-13 10:33:14 +02:00
Paul Holzinger 377599f1f4
podman secret inspect: use report.Formatter over Template
Currently the podman command --format output code uses a mix of
report.Formatter and report.Template.

I patched report.Formatter to correctly handle newlines[1]. Since we
cannot fix this with report.Template we have to migrate all users to
report.Formatter. This ensures consistent behavior for all commands.

This change does not change the output, we can add a new test for the
newline bug when the common PR is vendored in.

[1] https://github.com/containers/common/pull/1146

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-09-13 10:33:13 +02:00
Paul Holzinger f5e13ded93
podman secret ls: use report.Formatter over Template
Currently the podman command --format output code uses a mix of
report.Formatter and report.Template.

I patched report.Formatter to correctly handle newlines[1]. Since we
cannot fix this with report.Template we have to migrate all users to
report.Formatter. This ensures consistent behavior for all commands.

This change does not change the output, we can add a new test for the
newline bug when the common PR is vendored in.

[1] https://github.com/containers/common/pull/1146

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-09-13 10:33:13 +02:00
Paul Holzinger 1463898b07
podman network ls: use report.Formatter over Template
Currently the podman command --format output code uses a mix of
report.Formatter and report.Template.

I patched report.Formatter to correctly handle newlines[1]. Since we
cannot fix this with report.Template we have to migrate all users to
report.Formatter. This ensures consistent behavior for all commands.

This change does not change the output, we can add a new test for the
newline bug when the common PR is vendored in.

[1] https://github.com/containers/common/pull/1146

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-09-13 10:33:13 +02:00
Paul Holzinger 90634d5ee2
podman volume ls: use report.Formatter over Template
Currently the podman command --format output code uses a mix of
report.Formatter and report.Template.

I patched report.Formatter to correctly handle newlines[1]. Since we
cannot fix this with report.Template we have to migrate all users to
report.Formatter. This ensures consistent behavior for all commands.

This change does not change the output, we can add a new test for the
newline bug when the common PR is vendored in.

Also fixa bug since the table format is expected to print headers as
well.

[1] https://github.com/containers/common/pull/1146

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-09-13 10:33:13 +02:00
Paul Holzinger 20eccfc9d0
podman machine inspect: use report.Formatter over Template
Currently the podman command --format output code uses a mix of
report.Formatter and report.Template.

I patched report.Formatter to correctly handle newlines[1]. Since we
cannot fix this with report.Template we have to migrate all users to
report.Formatter. This ensures consistent behavior for all commands.

This change does not change the output, we can add a new test for the
newline bug when the common PR is vendored in.

Also fix a bug where a invlaid template would not cause a exit code > 0,
see the added test case.

[1] https://github.com/containers/common/pull/1146

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-09-13 10:33:13 +02:00
Paul Holzinger a687949dbc
podman machine ls: use report.Formatter over Template
Currently the podman command --format output code uses a mix of
report.Formatter and report.Template.

I patched report.Formatter to correctly handle newlines[1]. Since we
cannot fix this with report.Template we have to migrate all users to
report.Formatter. This ensures consistent behavior for all commands.

This change does not change the output, we can add a new test for the
newline bug when the common PR is vendored in.

[1] https://github.com/containers/common/pull/1146

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-09-13 10:33:12 +02:00
Paul Holzinger 65e78d92c9
podman auto-update: use report.Formatter over Template
Currently the podman command --format output code uses a mix of
report.Formatter and report.Template.

I patched report.Formatter to correctly handle newlines[1]. Since we
cannot fix this with report.Template we have to migrate all users to
report.Formatter. This ensures consistent behavior for all commands.

This change does not change the output, we can add a new test for the
newline bug when the common PR is vendored in.

[1] https://github.com/containers/common/pull/1146

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-09-13 10:33:12 +02:00
Paul Holzinger a63a40c3ee
podman events --format: fix duplicated newline
The --format changes caused a duplicated newline.
PR #15678 should have a test for this.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-09-12 18:05:18 +02:00
Paul Holzinger 2ae4ce7999
fix race where podman events exits to early
In order to display all events we have to read until the event channel
is closed.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-09-12 18:05:18 +02:00
Paul Holzinger 138b09c7e2
event backend none: return an error when reading events
podman --events-backend none events should return with an error since it
will never be able to actually list events.

Fixes part three of #15688

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-09-12 18:05:17 +02:00
Daniel J Walsh 2c63b8439b
Fix stutters
Podman adds an Error: to every error message.  So starting an error
message with "error" ends up being reported to the user as

Error: error ...

This patch removes the stutter.

Also ioutil.ReadFile errors report the Path, so wrapping the err message
with the path causes a stutter.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-09-10 07:52:00 -04:00
OpenShift Merge Robot 7e7db23dbf
Merge pull request #15687 from vrothberg/RUN-1639
health check: add on-failure actions
2022-09-09 15:17:19 +02:00
OpenShift Merge Robot e37dd95b7a
Merge pull request #15658 from rhatdan/config
Add --config for Docker compatibility
2022-09-09 13:17:14 +02:00
Valentin Rothberg aad29e759c health check: add on-failure actions
For systems that have extreme robustness requirements (edge devices,
particularly those in difficult to access environments), it is important
that applications continue running in all circumstances. When the
application fails, Podman must restart it automatically to provide this
robustness. Otherwise, these devices may require customer IT to
physically gain access to restart, which can be prohibitively difficult.

Add a new `--on-failure` flag that supports four actions:

- **none**: Take no action.

- **kill**: Kill the container.

- **restart**: Restart the container.  Do not combine the `restart`
               action with the `--restart` flag.  When running inside of
               a systemd unit, consider using the `kill` or `stop`
               action instead to make use of systemd's restart policy.

- **stop**: Stop the container.

To remain backwards compatible, **none** is the default action.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-09-09 13:02:05 +02:00
Daniel J Walsh 1994f38232
Add --config for Docker compatibility
Fixes: https://github.com/containers/podman/issues/14767

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-09-08 16:20:30 -04:00
OpenShift Merge Robot eb758c5f58
Merge pull request #15675 from Luap99/pod-inspect
fix podman pod inspect to support multiple pods
2022-09-08 16:36:08 +02:00
OpenShift Merge Robot d729dd8c2e
Merge pull request #15610 from n1hility/release-workflow
Introduce a new signed Windows installer with automated build process
2022-09-08 12:26:50 +02:00
Paul Holzinger d10e77e1bc
fix podman pod inspect to support multiple pods
Just like the other inspect commands `podman pod inspect p1 p2` should
return the json for both.

To correctly implement this we follow the container inspect logic, this
allows use to reuse the global inspect command.
Note: To not break the existing single pod output format for podman pod
inspect I added a pod-legacy inspect type. This is only used to make
sure we will print the pod as single json and not an array like for the
other commands. We cannot use the pod type since podman inspect --type
pod did return an array and we should not break that as well.

Fixes #15674

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-09-08 10:28:42 +02:00
Paul Holzinger 8d40bf3f14
proper --debug/-D flag support
--debug should not be a global flag, you can only use this as podman
--debug never podman ps --debug. This matches docker and allows us to
add the shorthand "D" since they now no longer conflict.

Fixes changes from commit 2d30b4dee5 which claims to add -D but never
did.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-09-07 14:50:23 +02:00
OpenShift Merge Robot 6254d38720
Merge pull request #15634 from bbalp/update-system-reset-warning-message
Update system reset warning message regarding deletion of volumes
2022-09-07 12:04:12 +02:00
Jason T. Greene ecb9f99b88 Add new windows installer and build
Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2022-09-06 16:12:09 -05:00
OpenShift Merge Robot cd09e3b6d0
Merge pull request #15644 from Luap99/event-format
fix podman events with custom format
2022-09-06 15:56:20 +02:00
Paul Holzinger d22aeeec28
fix podman events with custom format
podman events --format {{.ID}} was not working since the template was
converted to a range but we only render each event individually.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-09-06 13:56:26 +02:00
Toshiki Sonoda a9a411f8a8 Add generate systemd -e/--env option
-e/--env option sets environment variables to the systemd unit files.

Fixes: #15523

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2022-09-06 20:17:11 +09:00
Barnabé BALP 0df291d3b5
Update system reset warning message to warn against deletion of all volumes
Signed-off-by: Barnabé BALP <contact@barnabebalp.fr>
2022-09-05 19:34:04 +02:00
Charlie Doern 050f3291b9 implement podman update
podman update allows users to change the cgroup configuration of an existing container using the already defined resource limits flags
from podman create/run. The supported flags in crun are:

this command is also now supported in the libpod api via the /libpod/containers/<CID>/update endpoint where
the resource limits are passed inthe request body and follow the OCI resource spec format

–memory
–cpus
–cpuset-cpus
–cpuset-mems
–memory-swap
–memory-reservation
–cpu-shares
–cpu-quota
–cpu-period
–blkio-weight
–cpu-rt-period
–cpu-rt-runtime
-device-read-bps
-device-write-bps
-device-read-iops
-device-write-iops
-memory-swappiness
-blkio-weight-device

resolves #15067

Signed-off-by: Charlie Doern <cdoern@redhat.com>
2022-09-01 13:02:01 -04:00
Arthur Sengileyev 08a2851bae Allow to override default username via command line
Signed-off-by: Arthur Sengileyev <arthur.sengileyev@gmail.com>
2022-08-30 13:35:07 +03:00
Giuseppe Scrivano e448122fef
service: make move to sub-cgroup non fatal
if we are running in a container in the root cgroup, Podman tries to
move itself to a sub-cgroup.  This could be a problem in a setup where
the cgroups are not writeable, so just log a debug message and
continue, since anyway it is a best-effort operation.

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

[NO NEW TESTS NEEDED]

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-08-26 18:06:42 +02:00
Doug Rabson 61fc1870ad cmd/podman: Enable --syslog on FreeBSD
[NO NEW TESTS NEEDED]

Signed-off-by: Doug Rabson <dfr@rabson.org>
2022-08-26 08:01:02 +01:00
Daniel J Walsh bb7ae54ef7
Merge pull request #15466 from mtrmac/image-trust-sigstore
podman image trust overhaul, incl. sigstore
2022-08-25 16:11:50 -04:00
Miloslav Trmač ff3f574fc0 Add support for sigstoreSigned in (podman image trust set)
NOTE: This does not edit the use-sigstore-attachments value
in registries.d, similarly to how (podman image trust set) didn't
set the lookaside paths for simple signing.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-08-25 01:50:43 +02:00
Brent Baude 19a617eaab Allow colons in windows file paths
the `podman save` command was failing on windows due to the use of a
colon between the drive letter and first directory.  the check was
intended for Linux and not windows.

Fixes #15247

[NO NEW TESTS NEEDED]

Signed-off-by: Brent Baude <bbaude@redhat.com>
2022-08-24 10:31:42 -05:00
OpenShift Merge Robot 67c4068bb3
Merge pull request #15443 from flouthoc/env-merge-support
run,create: add support for `--env-merge` for preprocessing default environment variables
2022-08-24 09:14:42 -04:00
OpenShift Merge Robot d4e54fa999
Merge pull request #15351 from marshall-lee/images-pull-simple
Simplify ImagesPull for when Quiet flag is on
2022-08-24 06:00:03 -04:00
Aditya R b4584ea854
run,create: add support for --env-merge for preprocessing vars
Allow end users to preprocess default environment variables before
injecting them into container using `--env-merge`

Usage
```
podman run -it --rm --env-merge some=${some}-edit --env-merge
some2=${some2}-edit2 myimage sh
```

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

Signed-off-by: Aditya R <arajan@redhat.com>
2022-08-24 14:06:25 +05:30
OpenShift Merge Robot edde8570ce
Merge pull request #15372 from arixmkii/win_compat
Improved Windows compatibility
2022-08-23 16:20:33 -04:00
OpenShift Merge Robot ee2f8155cc
Merge pull request #15421 from sstosh/refactor-rawinput
Refactor: About the RawInput process
2022-08-23 11:18:02 -04:00
OpenShift Merge Robot 5dea1218a0
Merge pull request #15426 from nicrowe00/14955
podman kube play/down --read from URL
2022-08-23 11:12:50 -04:00
Niall Crowe 5f719b533e podman kube play/down --read from URL
`podman kube play` can create pods and containers from YAML
read from a URL poiniting to a YAML file.
For example: `podman kube play https://example.com/demo.yml`.
`podman kube down` can also teardown pods and containers created
from that YAML file by also reading YAML from a URL, provided the
YAML file the URL points to has not been changed or altered since
it was used to create pods and containers

Closes #14955
Signed-off-by: Niall Crowe <nicrowe@redhat.com>
2022-08-23 12:55:53 +01:00
Aditya R 70e103c04c
inspect, image: alias .Config.HealthCheck to .HealthCheck for compatibility
Support inspecting image healthcheck using docker supported
`.Config.HealthCheck` by aliasing field to `.HealthCheck`

Now supports

```Console
podman image inspect -f "{{.Config.Healthcheck}}" imagename
```

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

Signed-off-by: Aditya R <arajan@redhat.com>
2022-08-23 13:39:01 +05:30
Arthur Sengileyev f87f6d2fc1 Improved Windows compatibility
Signed-off-by: Arthur Sengileyev <arthur.sengileyev@gmail.com>
2022-08-23 11:06:51 +03:00
Toshiki Sonoda 716ac1c866 Refactor: About the RawInput process
Refactor the RawInput process of the `rm` and
`start` subcommands, like the other subcommands
such as `restart, stop, etc`.

[NO NEW TESTS NEEDED]

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2022-08-23 09:58:34 +09:00
OpenShift Merge Robot 51d4b88ce9
Merge pull request #15392 from ashley-cui/quiet
Add quiet/q flag to podman secret ls
2022-08-22 15:46:47 -04:00
OpenShift Merge Robot e9fe85d53a
Merge pull request #15363 from rhatdan/secret
podman secret create -d alias --driver, inspect -f alias --format: Docker compatibity
2022-08-22 13:36:05 -04:00
OpenShift Merge Robot bbbed3d822
Merge pull request #15369 from ht-vo/podman-save-validation
podman save: update --compress validation
2022-08-22 13:33:10 -04:00
Ashley Cui eee0ec97e8 Add quiet/q flag to podman secret ls
Add quiet/q flag to podman secret ls, which will print only the secret
ID.

Signed-off-by: Ashley Cui <acui@redhat.com>
2022-08-22 09:13:00 -04:00
Doug Rabson 8aa29fd54f cmd/podman: Enable ABI and Tunnel mode for freebsd
[NO NEW TESTS NEEDED]

Signed-off-by: Doug Rabson <dfr@rabson.org>
2022-08-22 10:14:12 +01:00
Vladimir Kochnev 3bf52aa338
Add ProgressWriter to PullOptions
Signed-off-by: Vladimir Kochnev <hashtable@yandex.ru>
2022-08-19 00:41:22 +03:00
Vladimir Kochnev ec9508ea17
Pass io.Writer when pushing images/manifests from command line
[NO NEW TESTS NEEDED]

Signed-off-by: Vladimir Kochnev <hashtable@yandex.ru>
2022-08-18 23:48:43 +03:00
Hoang Thanh VO 976ce76eba
podman save: update --compress validation
[NO NEW TESTS NEEDED]

Signed-off-by: Hoang Thanh VO <111461555+ht-vo@users.noreply.github.com>
2022-08-18 09:36:44 +02:00
OpenShift Merge Robot f63da351f2
Merge pull request #15364 from rhatdan/stats
Add podman stats --no-trunc option
2022-08-17 21:46:21 +00:00
Daniel J Walsh 0dd2fcf715
Add podman manifest create -a. Alias for --amend:Docker compatibility
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-08-17 15:02:53 -04:00
Daniel J Walsh 546bb3548c
Add podman stats --no-trunc option
This is for compatibility with Docker.

Partial fix for https://github.com/containers/podman/issues/14917

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-08-17 13:16:01 -04:00
Daniel J Walsh f6e7b0b59d
Add podman secret inspect -f alias for --format: Docker compatibility
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-08-17 12:49:30 -04:00
Daniel J Walsh d50ff4f512
Add podman secret create -d as alias for --driver for Docker compatibility
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-08-17 12:44:42 -04:00
OpenShift Merge Robot 5de215e144
Merge pull request #15341 from rhatdan/kube
Fix podman kube generate --help to show correct help message
2022-08-17 16:35:34 +00:00
OpenShift Merge Robot c90eec2700
Merge pull request #14999 from sstosh/restart-option
Add restart --cidfile, --filter
2022-08-17 09:41:54 +00:00
Nalin Dahyabhai 7e7a79b075 podman manifest create: accept --amend and --insecure flags
Accept a --amend flag in `podman manifest create`, and treat
`--insecure` as we would `--tls-verify=false` in `podman manifest`'s
"add", "create", and "push" subcommands.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2022-08-16 19:45:36 -04:00
Daniel J Walsh 5f09d9b60d
Fix podman kube generate --help to show correct help message
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-08-16 16:03:48 -04:00
OpenShift Merge Robot 3dace12777
Merge pull request #15317 from rhatdan/debug
Add compatibility support for --debug flag from docker
2022-08-16 15:09:12 +00:00
OpenShift Merge Robot d0567dd078
Merge pull request #15270 from nicrowe00/kubegenerate
Add "podman kube generate" command
2022-08-16 13:04:41 +00:00
Daniel J Walsh 2d30b4dee5
Add compatibility support for --debug -D flag from docker
This is another fix for https://github.com/containers/podman/issues/14917

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-08-15 08:21:15 -04:00
Daniel J Walsh b9c094a5d4
Add Docker compatibility for --dns-option to --dns-opt
Fixes one of the issues found in https://github.com/containers/podman/issues/14917
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-08-15 07:38:08 -04:00
Tom Sweeney bc56ee158f Update cmd/podman/containers/restart.go
Co-authored-by: Tom Sweeney <tsweeney@redhat.com>
Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2022-08-12 09:50:47 +09:00
Toshiki Sonoda 0dbbb1cb3f Add restart --cidfile, --filter
--cidfile : Read container ID from the specified file and restart the container.
--filter : restart the filtered container.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2022-08-12 09:22:53 +09:00
Niall Crowe d856fb43e1 Add "podman kube generate" command
"podman kube generate" creates Kubernetes YAML from Podman containers,
pods or volumes. Users will still be able to use "podman generate
kube" as an alias of "kube generate".

Signed-off-by: Niall Crowe <nicrowe@redhat.com>
2022-08-11 16:58:24 +01:00
Valentin Rothberg 79e21b5b16 kube play: sd-notify integration
Integrate sd-notify policies into `kube play`.  The policies can be
configured for all contianers via the `io.containers.sdnotify`
annotation or for indidivual containers via the
`io.containers.sdnotify/$name` annotation.

The `kube play` process will wait for all containers to be ready by
waiting for the individual `READY=1` messages which are received via
the `pkg/systemd/notifyproxy` proxy mechanism.

Also update the simple "container" sd-notify test as it did not fully
test the expected behavior which became obvious when adding the new
tests.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-08-10 21:12:39 +02:00
OpenShift Merge Robot aa13c73f71
Merge pull request #14926 from cdoern/generateSpec
podman generate spec
2022-08-10 10:23:18 +00:00
OpenShift Merge Robot 84502fc144
Merge pull request #15094 from cdoern/ssh
podman ssh work, using new c/common interface
2022-08-10 08:57:58 +00:00
OpenShift Merge Robot 72679400b0
Merge pull request #15199 from baude/addapplehv
Add interface for apple hypervisor
2022-08-09 19:31:17 +00:00
Charlie Doern 280f5d8cb0 podman ssh work, using new c/common interface
implement new ssh interface into podman

this completely redesigns the entire functionality of podman image scp,
podman system connection add, and podman --remote. All references to golang.org/x/crypto/ssh
have been moved to common as have native ssh/scp execs and the new usage of the sftp package.

this PR adds a global flag, --ssh to podman which has two valid inputs `golang` and `native` where golang is the default.
Users should not notice any difference in their everyday workflows if they continue using the golang option. UNLESS they have been using an improperly verified ssh key, this will now fail. This is because podman was incorrectly using the
ssh callback method to IGNORE the ssh known hosts file which is very insecure and golang tells you not yo use this in production.

The native paths allows for immense flexibility, with a new containers.conf field `SSH_CONFIG` that specifies a specific ssh config file to be used in all operations. Else the users ~/.ssh/config file will be used.
podman --remote currently only uses the golang path, given its deep interconnection with dialing multiple clients and urls.

My goal after this PR is to go back and abstract the idea of podman --remote from golang's dialed clients, as it should not be so intrinsically connected. Overall, this is a v1 of a long process of offering native ssh, and one that covers some good ground with podman system connection add and podman image scp.

Signed-off-by: Charlie Doern <cdoern@redhat.com>
2022-08-09 14:00:58 -04:00
OpenShift Merge Robot a7af6ef632
Merge pull request #15246 from TomSweeneyRedHat/dev/tsweeney/buildah1.27.0
Bump to Buildah v1.27.0
2022-08-09 13:32:07 +00:00
OpenShift Merge Robot 7992d86ab3
Merge pull request #15134 from sstosh/improve-output
Output messages display rawInput
2022-08-09 06:13:10 +00:00
Aditya R 59cb410fe2
build: implement --cache-to,--cache-from and --cache-ttl
[NO NEW TESTS NEEDED]
[NO TESTS NEEDED]

Signed-off-by: Aditya R <arajan@redhat.com>
2022-08-09 09:10:58 +05:30
Brent Baude 1045647a4a Add interface for apple hypervisor
The new apple silicon processesors (m1/m2) are capable of using a performent apple
hypervisor (included in macos).  Our "virtual providers" for podman
machine are part of an interface design.  This PR provides an
implementation of the interface to begin the work for supporting the
apple hypervisor.  It is basically only a skeletal PR.

The actual code for using the hypervisor and launching a machine will
come as several new PRs following the inclusion of this one.

There will likely be code reuse between the applehv and qemu code; but
none of that code is being moved at this time.  It will be moved "on
demand" during development.

[NO NEW TESTS NEEDED]

Signed-off-by: Brent Baude <bbaude@redhat.com>
2022-08-08 14:04:49 -05:00
Giuseppe Scrivano 2e3a192bb0
cmd: refuse --userns if a mapping is specified
if an explicit mapping is specified, do not accept `--userns` since it
overriden to "private".

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-08-08 14:57:23 +02:00
openshift-ci[bot] 66c246d2c1
Merge pull request #15093 from karthikelango137/rmiNoPrune1
remove image podman no prune
2022-08-05 14:48:18 +00:00
openshift-ci[bot] 49ee311950
Merge pull request #15092 from karthikelango137/startFilter
start --filter flag changes
2022-08-05 06:43:56 +00:00
Karthik Elango cc8e4d5fec remove image podman no prune
Signed-off-by: Karthik Elango <kelango@redhat.com>
2022-08-04 14:55:03 -04:00
Charlie Doern 842c6c7c67 podman generate spec
implement a new command `podman generate spec` which can formulate a json specgen to be consumed by both the pod
and container creation API.

supported flags are

--verbose (default true) print output to the terminal
--compact print the json output in a single line format to be piped to the API
--filename put the output in a file
--clone rename the pod/ctr in the spec so it won't conflict w/ an existing entity

Signed-off-by: Charlie Doern <cdoern@redhat.com>
2022-08-04 13:59:58 -04:00
Karthik Elango 9964366f69 start filter flag changes
Tying filtering logic for podman stop and start to same place in getContainersAndInputByContext() to reduce code redundancy

Signed-off-by: Karthik Elango <kelango@redhat.com>
2022-08-04 09:08:14 -04:00
Valentin Rothberg e67e602265 podman info: hide `--debug`
It's a NOP since Podman v2.0 (#5738).

[NO NEW TESTS NEEDED] - does not change behavior.

Fixes: #15185
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-08-04 13:39:15 +02:00
openshift-ci[bot] 5fc7339aa1
Merge pull request #15084 from sstosh/rm-filter
Add rm --filter option
2022-08-03 17:23:07 +00:00
Niall Crowe 1249cbb75f add "podman kube down" command
The "podman kube down" reads in a structured file of
Kubernetes YAML and removes pods based on the Kubernetes kind described in the YAML,
similiar to "podman play kube --down". Users will still be able to use
"podman play kube --down" and "podman kube play --down" to
perform the same function.

Signed-off-by: Niall Crowe <nicrowe@redhat.com>
2022-08-02 16:27:01 +01:00
Niall Crowe 69d7407afb switch from "kube/play" endpoint to "play/kube" endpoint.
When podman kube play was added the endpoint for the kube play/play kube
commands was switched from the "play kube" endpoint to the new "kube play"
endpoint. This caused issues with the remote client, requiring the need
to use the "play kube" endpoint again in order to avoid these issues.

Signed-off-by: Niall Crowe <nicrowe@redhat.com>
2022-08-02 12:09:59 +01:00
Toshiki Sonoda 2685c8dc43 Output messages display rawInput
`init`, `checkpint/restore` and `cleanup` command now display
output messages which is rawInput instead of a container ID.

Example:
```
$ podman init <container name>
<container name>

$ podman init <short container ID>
<short container ID>
```

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2022-08-02 18:28:37 +09:00
OpenShift Merge Robot 82137dc64e
Merge pull request #15108 from mtrmac/sigstore-sign
Sigstore sign
2022-08-01 13:35:43 +02:00
Miloslav Trmač d462da676c Add support for creating sigstore signatures, and providing passphrases
- Allow creating sigstore signatures via --sign-by-sigstore-private-key .
  Like existing --sign-by, it does not work remote (in this case
  because we would have to copy the private key to the server).
- Allow passing a passphrase (which is mandatory for sigstore private keys)
  via --sign-passphrase-file; if it is not provided, prompt interactively.
- Also, use that passphrase for --sign-by as well, allowing non-interactive
  GPG use. (But --sign-passphrase-file can only be used with _one of_
  --sign-by and --sign-by-sigstore-private-key.)

Note that unlike the existing code, (podman build) does not yet
implement sigstore (I'm not sure why it needs to, it seems not to
push images?) because Buildah does not expose the feature yet.

Also, (podman image sign) was not extended to support sigstore.

The test for this follows existing (podman image sign) tests
and doesn't work rootless; that could be improved by exposing
a registries.d override option.

The test for push is getting large; I didn't want to
start yet another registry container, but that would be an
alternative.  In the future, Ginkgo's Ordered/BeforeAll
would allow starting a registry once and using it for two
tests.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-07-30 17:26:08 +02:00
Miloslav Trmač 7075e2e1d5 Hide podman manifest push --sign-by on remote
... because it is documented to be ignored.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-07-30 17:26:08 +02:00
Miloslav Trmač 68cf116110 Use signByFlagName instead of copy&pasting the string
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-07-30 17:26:08 +02:00
Romain Geissler 24a599fe1d Add flag "--compression-format" to "podman manifest push" both in local/remote mode.
Also Fix usage of flag "--compression-format" for remote "podman image push". Fix usage of flags "--format", "--remove-signatures" in remote "podman manifest push".
Closes #15109.

Signed-off-by: Romain Geissler <romain.geissler@amadeus.com>
2022-07-30 15:10:41 +00:00
Toshiki Sonoda 53ec479685 Add rm --filter option
--filter : remove the filtered container.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2022-07-30 10:59:59 +09:00
OpenShift Merge Robot f7a0a24d20
Merge pull request #15066 from sstosh/checkpoint-samename
Fix: Restore a container which name is equal to a image name
2022-07-27 16:49:46 -04:00
Toshiki Sonoda e4992fb818 Fix: Restore a container which name is equal to a image name
If there is a match for both container and image, we restore the container.

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

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2022-07-27 09:44:48 +09:00
Daniel J Walsh 75419c5d88
When removing objects specifying --force,podman should exit with 0
This Patch will cause podman COMMAND rm --force bogus not fail

This is how Docker works, so Podman should follow this to allow existing
scripts to convert from Docker to Podman.

Fixes: #14612
Oprignal version of this patch came from wufan 1991849113@qq.com

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-07-26 16:00:42 -04:00
Charlie Doern 27679d80b8 pod create --share none should not create infra
for podman pod create, when we are not sharing any namespaces there is no point for the infra container.
This is especially true since resources have also been decoupled from the container recently.

handle this on the cmd level so that we can still create infra if set explicitly

resolves #15048

Signed-off-by: Charlie Doern <cdoern@redhat.com>
2022-07-25 13:11:06 -04:00
OpenShift Merge Robot 94e97df47b
Merge pull request #15039 from Luap99/cni-doc
[CI:DOCS] docs: remove CNI word where it is not applicable
2022-07-22 19:30:25 +02:00
OpenShift Merge Robot 9b4df69830
Merge pull request #14967 from sstosh/pause-option
Add pause/unpause --latest, --cidfile, --filter
2022-07-22 18:12:50 +02:00
Paul Holzinger cbdda4e56e
docs: remove CNI word where it is not applicable
Most network commands/features work with both netavark and CNI. When
we added added netavark most docs were not vetted and thus still use CNI
network, it should just say network.

Fixes #14990

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-07-22 13:46:28 +02:00
OpenShift Merge Robot 9bba3cffc0
Merge pull request #15010 from Luap99/machine-e2e
enable linter for pkg/machine/e2e
2022-07-22 12:51:49 +02:00
Charlie Doern c00ea686fe resource limits for pods
added the following flags and handling for podman pod create

--memory-swap
--cpuset-mems
--device-read-bps
--device-write-bps
--blkio-weight
--blkio-weight-device
--cpu-shares

given the new backend for systemd in c/common, all of these can now be exposed to pod create.
most of the heavy lifting (nearly all) is done within c/common. However, some rewiring needed to be done here
as well!

Signed-off-by: Charlie Doern <cdoern@redhat.com>
2022-07-21 14:50:01 -04:00
Paul Holzinger 19f4a463ed
pkg/machine/e2e: do not import from cmd/podman
The same problem again as 4374038cc6.

Also fix the incorrect --format autocompletion struct.

It should be avoided to import cmd/podman/... packages from outside of
cmd/podman. This can lead in weird hard to debug import paths but also
can have negative consequences when imported in unit tests. In this case
it will set XDG_CONFIG_HOME and thus the machine tests this dir over the
tmp HOME env variable which is set at a later point. This caused machine
files to be leaked into the actual users home dir.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-07-21 18:04:11 +02:00
Paul Holzinger 604920dd11
fix some pkg/machine/e2e test to read stderr
Also fix the machine ssh code order to provide a better error message.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-07-21 18:04:11 +02:00
Toshiki Sonoda 9b152ef20e Add pause/unpause --latest, --cidfile, --filter
--latest : pause/unpause the latest container.
--filter : pause/unpause the filtered container.
--cidfile : Read container ID from the specified file and pause/unpause the container.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2022-07-20 19:30:11 +09:00
Toshiki Sonoda 26ae055a24 Remove return error from "containers.pause"
When we pause `rootless cgroups v1 container`, podman returns error from `libpod.(*Container).pause`.
Podman does not need to return error from `containers.pause` because of duplicate.

[NO NEW TESTS NEEDED]

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2022-07-19 10:00:53 +09:00
Daniel J Walsh 18c0c19aa9
Add --host and -H as equivalent options to --url
Docker supports -H and --host for specify the listening socket. Podman
should support them also in order to match the CLI.

These will not be documented since Podman defaults to using the
--url option.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-07-18 10:41:00 -04:00
openshift-ci[bot] 98b22e29c9
Merge pull request #14932 from jakecorrenti/pull-all-tags-shorthand
Podman pull --all-tags shorthand option
2022-07-15 15:12:58 +00:00
Karthik Elango a2f6cc74e7 Podman stop --filter flag
Filter flag is added for podman stop and podman --remote stop. Filtering logic is implemented in
getContainersAndInputByContext(). Start filtering can be manipulated to use this logic as well to limit redundancy.

Signed-off-by: Karthik Elango <kelango@redhat.com>
2022-07-14 13:18:53 -04:00
Jake Correnti 90607a6d04 Podman pull --all-tags shorthand option
I added the shorthand option for `podman pull --all-tags`. Like Docker,
Podman can now do `podman pull -a`.

Signed-off-by: Jake Correnti <jcorrenti13@gmail.com>
2022-07-14 10:54:24 -04:00
openshift-ci[bot] d4dc067117
Merge pull request #14923 from rhatdan/events
Add podman events -f to be alias for --filter
2022-07-14 12:01:40 +00:00
Daniel J Walsh cc2cfe0602
Add podman events -f to be alias for --filter
Needed for Docker compatibility.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-07-13 10:55:27 -04:00
Niall Crowe e08a77ce64 Add "podman kube play" cmd
The "podman kube play" command is designed to be a replacement for the
"podman play kube" command.
It performs the same function as "play kube"  while also still working with the same flags and options.
The "podman play kube" command is still functional as an alias of "kube play".

Closes #12475
Signed-off-by: Niall Crowe <nicrowe@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-07-13 15:27:03 +01:00
openshift-ci[bot] 4df6122aaa
Merge pull request #14904 from giuseppe/move-to-subcgroup-in-a-container
abi: create new cgroup when running in a container
2022-07-13 09:10:57 +00:00
Giuseppe Scrivano 7b4afbf621
podman: always call into SetupRootless
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-07-13 09:13:06 +02:00
Giuseppe Scrivano 4b547a72ab
podman: move MaybeMoveToSubCgroup to utils/
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-07-13 09:13:06 +02:00
Daniel J Walsh c9a82d72a7
Docker uses "-c" to mean "--cpu-shares" in create and run
Add support for -c as an alias for --cpu-shares to be compatible with
Docker.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-07-12 14:53:17 -04:00
openshift-ci[bot] 0df8c6e157
Merge pull request #14826 from sstosh/net-prune
Refactored networkPrune function
2022-07-11 12:53:59 +00:00
openshift-ci[bot] 76422ecdbb
Merge pull request #14818 from rhatdan/wait
podman wait can take multiple conditions
2022-07-11 08:06:58 +00:00
Valentin Rothberg 6b9abe69db improve pull-policy documentation
Make sure that the docs for pull policies is consistent with Buildah and
reflects the implementation.

Further improve the help messages and auto completions.

[NO NEW TESTS NEEDED]

Fixes: #14846
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-07-08 17:11:08 +02:00
Daniel J Walsh 96dd57ca50
podman wait can take multiple conditions
Podman wait should not be defaulting to just stopped.  By default
wait API waits for stopped and exited.  We should not override this on
the client side.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-07-08 05:26:56 -04:00
Toshiki Sonoda d1754bdd4f Refactored networkPrune function
Refactored the networkPrune function to improve readability.

This commit changes the `networkPrune` function to
use the `PrintNetworkPruneResults` function.

[NO NEW TESTS NEEDED]

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2022-07-08 08:33:20 +09:00
Paul Holzinger 4374038cc6
pkg/machine/e2e: do not import from cmd/podman
It should be avoided to import cmd/podman/... packages from outside of
cmd/podman. This can lead in weird hard to debug import paths but also
can have negative consequences when imported in unit tests. In this case
it will set XDG_CONFIG_HOME and thus the machine tests this dir over the
tmp HOME env variable which is set at a later point. This caused machine
files to be leaked into the actual users home dir.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-07-07 20:48:28 +02:00
openshift-ci[bot] dd0418a5fe
Merge pull request #14762 from ashley-cui/machinfo
Podman machine info
2022-07-07 15:17:40 +00:00
openshift-ci[bot] ca5bebb082
Merge pull request #14501 from cdoern/podUTS
podman pod create --uts support
2022-07-06 14:51:22 +00:00
Ashley Cui 9d6efb3442 Podman machine info
Add podman machine info command, which displays infor about the machine
host as well as version info.

Signed-off-by: Ashley Cui <acui@redhat.com>
2022-07-05 15:18:41 -04:00
Urvashi Mohnani 65d511c6d8 Fix podman pod unpaue TODO
Update the podman pod unpause to only show the paused
containers with autocomplete.
Fix a typo in the help command.
Update the unpause function to only attempt an unpause
on pasued pods instead of all the pods.
Update the tests accordingly.

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2022-07-05 10:32:49 -04:00
openshift-ci[bot] 6315936f9a
Merge pull request #14805 from jakecorrenti/df-format-output
Podman system df JSON format outputs `Size` and `Reclaimable`
2022-07-05 13:34:45 +00:00
cdoern 8f2d9e7a7c podman pod create --uts support
add support for the --uts flag in pod create, allowing users to avoid
issues with default values in containers.conf.

uts follows the same format as other namespace flags:
--uts=private (default), --uts=host, --uts=ns:PATH

resolves #13714

Signed-off-by: Charlie Doern <cdoern@redhat.com>
2022-07-05 09:28:07 -04:00
Jake Correnti 4fe7b8baf2 Podman system df JSON format outputs `Size` and `Reclaimable`
Previously, `podman system df --format "{{json .}}"` would not output
`Size` and `Reclaimable` like `podman system df` would.

```
{"Type":"Images","Total":5,"Active":0,"Size":39972240,"Reclaimable":39972240}
{"Type":"Containers","Total":0,"Active":0,"Size":0,"Reclaimable":0}
{"Type":"Local Volumes","Total":0,"Active":0,"Size":0,"Reclaimable":0}
```

Closes: #14769

Signed-off-by: Jake Correnti <jcorrenti13@gmail.com>
2022-07-05 07:38:08 -04:00
Aditya R efe1176dd9
specgen,run: support running container from valid manifest list
Following PR adds support for running containers from a manifest list
present on localstorage. Before this PR podman only supports running
containers from valid images but not from manifest list.

So `podman run -it --platform <some> <manifest-list> command` should
become functional now and users should be able to resolve images on the
bases of provided `--platform` string.

Example
```
podman manifest create test
podman build --platform linux/amd64,linux/arm64 --manifest test .
podman run --rm --platform linux/arm64/v8 test uname -a
```

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

Signed-off-by: Aditya R <arajan@redhat.com>
2022-07-05 12:39:37 +05:30
openshift-ci[bot] a406b950e4
Merge pull request #14807 from eriksjolund/fix_read_only_spelling
[CI:DOCS] Fix spelling "read only" -> "read-only"
2022-07-04 07:35:42 +00:00
Erik Sjölund 24fcfb5d9e Fix spelling "read only" -> "read-only"
Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
2022-07-02 08:37:43 +02:00
Charlie Doern b92149e2a8 podman pod create --memory
using the new resource backend, implement podman pod create --memory which enables
users to modify memory.max inside of the parent cgroup (the pod), implicitly impacting all
children unless overriden

Signed-off-by: Charlie Doern <cdoern@redhat.com>
2022-07-01 13:44:32 -04:00
openshift-ci[bot] 7688c5ac63
Merge pull request #14794 from n1hility/fix-win
Fix podman machine on Windows
2022-07-01 11:21:42 +00:00
openshift-ci[bot] 96e72d90b8
Merge pull request #14449 from cdoern/podVolumes
podman volume create --opt=o=timeout...
2022-07-01 08:46:11 +00:00
Jason T. Greene 5262f7e01d Fix podman machine on Windows
Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2022-06-30 16:21:59 -05:00
openshift-ci[bot] 5a222a8e60
Merge pull request #14787 from giuseppe/move-systemd-service-to-subcgroup
service: do not run under the root cgroup
2022-06-30 16:09:07 +00:00
Giuseppe Scrivano bd51410b8d
service: do not run under the root cgroup
at startup, when running on a cgroup v2 system, check if the current
process is running in the root cgroup and move it to a sub-cgroup,
otherwise Podman is not able to create cgroups and move processes
there.

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

[NO NEW TESTS NEEDED] it needs nested podman

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-06-30 14:51:18 +02:00
Sascha Grunert e8adec5f41
cmd/podman: switch to golang native error wrapping
We now use the golang error wrapping format specifier `%w` instead of
the deprecated github.com/pkg/errors package.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2022-06-30 12:58:57 +02:00
openshift-ci[bot] d6cdb996bc
Merge pull request #14706 from ashley-cui/rootmach
Only allow Rootless runs of Podman Machine
2022-06-29 19:32:26 +00:00
Ashley Cui d9ff0fd15d Only allow Rootless runs of Podman Machine
Podman Machine crashes if run as root. When creating the machine, we write the ignition so that the UID of the core user matches the UID of the user on the host. We by default, create the root user on the machine with UID 0. If the user on the host is root, the core UID and the Root UID collide, causing a the VM not to boot.

[NO NEW TESTS NEEDED]

Signed-off-by: Ashley Cui <acui@redhat.com>
2022-06-29 09:19:09 -04:00
openshift-ci[bot] 60c9aeabab
Merge pull request #14717 from ZeyadYasser/fix-restore-runtime-check
Fix runtime check during restore
2022-06-28 19:07:52 +00:00
Zeyad Yasser 8e3a46a87b
Fix runtime check during restore
cfg.RuntimePath was set to default runtime, so the empty string
check fails. Instead we could check if the flag was changed.

Signed-off-by: Zeyad Yasser <zeyady98@gmail.com>
2022-06-28 16:14:38 +02:00
cdoern 6d3520e8b7 podman image scp remote support & podman image scp tagging
add support for podman-remote image scp as well as direct access via the API. This entailed
a full rework of the layering of image scp functions as well as the usual API plugging and type creation

also, implemented podman image scp tagging. which makes the syntax much more readable and allows users t tag the new image
they are loading to the local/remote machine:

allow users to pass a "new name" for the image they are transferring
`podman tag` as implemented creates a new image im `image list` when tagging, so this does the same
meaning that when transferring images with tags, podman on the remote machine/user will load two images
ex: `podman image scp computer1::alpine computer2::foobar` creates alpine:latest and localhost/foobar on the remote host

implementing tags means removal of the flexible syntax. In the currently released podman image scp, the user can either specify
`podman image scp source::img dest::` or `podman image scp dest:: source::img`. However, with tags this task becomes really hard to check
which is the image (src) and which is the new tag (dst). Removal of that streamlines the arg parsing process

Signed-off-by: Charlie Doern <cdoern@redhat.com>
2022-06-28 08:54:19 -04:00
openshift-ci[bot] 9c4b8a29b0
Merge pull request #14713 from Luap99/volume-plugin
add podman volume reload to sync volume plugins
2022-06-27 17:55:19 +00:00
openshift-ci[bot] cc86315455
Merge pull request #14695 from boaz0/closes_14682
Fix machine list: --format implies --noheading
2022-06-27 12:30:11 +00:00
openshift-ci[bot] 157a966ae8
Merge pull request #14665 from Luap99/machine-now
podman machine init --now: respect proxy envs
2022-06-27 12:27:28 +00:00
Boaz Shuster f0b9e56e98 Fix machine list: --format implies --noheading
It seems like previously if --format was changed then listFlag.noHeading is changed accordingly
however printHeader is used to determine whether to print header or not.

This patch fixes that problem.

Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com>
2022-06-23 21:36:52 +03:00
Paul Holzinger 2fab7d169b
add podman volume reload to sync volume plugins
Libpod requires that all volumes are stored in the libpod db. Because
volume plugins can be created outside of podman, it will not show all
available plugins. This podman volume reload command allows users to
sync the libpod db with their external volume plugins. All new volumes
from the plugin are also created in the libpod db and when a volume from
the db no longer exists it will be removed if possible.

There are some problems:
- naming conflicts, in this case we only use the first volume we found.
  This is not deterministic.
- race conditions, we have no control over the volume plugins. It is
  possible that the volumes changed while we run this command.

Fixes #14207

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-06-23 18:36:30 +02:00
Erik Sjölund aa4279ae15 Fix spelling "setup" -> "set up" and similar
* Replace "setup", "lookup", "cleanup", "backup" with
  "set up", "look up", "clean up", "back up"
  when used as verbs. Replace also variations of those.

* Improve language in a few places.

Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
2022-06-22 18:39:21 +02:00
openshift-ci[bot] 2629f445a0
Merge pull request #14690 from sstosh/prune-message
Fix system prune output message
2022-06-22 13:01:36 +00:00
openshift-ci[bot] 00ce793f0d
Merge pull request #14631 from n1hility/opendoc-after-install
Open Windows tutorial after MSI installation
2022-06-22 11:21:59 +00:00
Toshiki Sonoda 0320ce37de Fix system prune output message
'podman system prune' command always outputs "Deleted Images" message,
even though there is no dangling or unused image to remove.
This message should be output only if dangling or unused image exists.

[NO NEW TESTS NEEDED]

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2022-06-22 13:12:46 +09:00
openshift-ci[bot] c9dce6353d
Merge pull request #14659 from eriksjolund/setup_to_set_up_in_code
[CI:DOCS] "setup" -> "set up" in source code comments
2022-06-21 18:08:31 +00:00
openshift-ci[bot] fe974101eb
Merge pull request #14625 from cdoern/podShm
podman pod create --shm-size
2022-06-21 17:57:24 +00:00
Paul Holzinger 050693b2e7
bump github.com/spf13/cobra from 1.4.0 to 1.5.0
Update cobra to latest version. Remove workaround for podman -h.
Also regenerate the completion scripts.

[NO NEW TESTS NEEDED]

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-06-21 17:17:06 +02:00
cdoern f451b68dfa podman pod create --shm-size
expose the --shm-size flag to podman pod create and add proper handling and inheritance
for the option.

resolves #14609

Signed-off-by: Charlie Doern <cdoern@redhat.com>
2022-06-20 10:25:00 -04:00
openshift-ci[bot] fe8e536328
Merge pull request #14556 from sstosh/system-prune-network
podman system prune support prune unused networks
2022-06-20 13:57:42 +00:00
Paul Holzinger 46da7bc78f
podman machine init --now: respect proxy envs
podman machine start contains more logic than just the simple vm.Start()
call. Instead of duplicating this into inti we just call start().

[NO NEW TESTS NEEDED] I have no way to test this right now.

Fixes #14640

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-06-20 15:36:00 +02:00
Erik Sjölund 2827140907 [CI:DOCS] "setup" -> "set up" in source code comments
* Replace "setup", "lookup" with "set up", "look up"
  when used as verbs.

Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
2022-06-19 12:18:08 +02:00
Jason T. Greene ce3d0954a5 Open Windows tutorial after MSI installation
Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2022-06-16 23:46:24 -05:00
openshift-ci[bot] 2af8851787
Merge pull request #14299 from cdoern/podClone
implement podman pod clone
2022-06-16 20:05:27 +00:00
Paul Holzinger 09c462d735
fix "podman -h" help output
`podman -h` currently returns an error:
`Error: pflag: help requested`

This bug was introduced in 44d037898e, the problem is that we wrap the
error and cobra lib checks with `==` for this one and not errors.Is().
I have a PR upstream to fix this but for now this also works.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-06-16 16:59:47 +02:00
Paul Holzinger 20b3fbe6d6
systemd socker activation: check listener to prevent panic
Commit 5fa6f686db added a regression which was fixed in eb71712626.
Apply the same fix again to prevent a panic and return a proper error
instead.

To not regress again I added a e2e test which makes sure we do not panic.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-06-15 14:33:14 +02:00
openshift-ci[bot] e084f0ee1e
Merge pull request #14585 from Luap99/nolint
golangci-lint: enable nolintlint
2022-06-14 18:58:53 +00:00
openshift-ci[bot] cffed099b8
Merge pull request #14561 from rhatdan/VENDOR
Update vendor of containers/buildah
2022-06-14 14:55:21 +00:00
Paul Holzinger 41528739ce
golangci-lint: enable nolintlint
The nolintlint linter does not deny the use of `//nolint`
Instead it allows us to enforce a common nolint style:
- force that a linter name must be specified
- do not add a space between `//` and `nolint`
- make sure nolint is only used when there is actually a problem

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-06-14 16:29:42 +02:00
openshift-ci[bot] 78ecdad5f8
Merge pull request #14580 from jakecorrenti/stats-on-non-running-container
Non-running containers now report statistics via the `podman stats`
2022-06-14 13:12:17 +00:00
Toshiki Sonoda 4811cb110a podman system prune support prune unused networks
This is an enhancement for the podman system prune feature.

In this issue, it is mentioned that 'network prune' should be
wired into 'podman system prune'
https://github.com/containers/podman/issues/8673

Therefore, I add the function to remove unused networks.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2022-06-14 14:04:03 +09:00
Daniel J Walsh 5e9d20448c
Update vendor of containers/buildah
Changes since 2022-05-31:
  - add --omit-history option (buildah PR 4028)

Signed-off-by: Ed Santiago <santiago@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-06-13 17:54:17 -04:00
Jake Correnti 608ad7d113 Non-running containers now report statistics via the `podman stats`
command

Previously, if a container was not running, and the user ran the `podman
stats` command, an error would be reported: `Error: container state
improper`.

Podman now reports stats as the fields' default values for their
respective type if the container is not running:

```
$ podman stats --no-stream demo

ID            NAME        CPU %       MEM USAGE / LIMIT  MEM %       NET IO      BLOCK IO    PIDS        CPU TIME    AVG CPU %
4b4bf8ce84ed  demo        0.00%       0B / 0B            0.00%       0B / 0B     0B / 0B     0           0s          0.00%
```

Closes: #14498

Signed-off-by: Jake Correnti <jcorrenti13@gmail.com>
2022-06-13 15:03:22 -04:00
OpenShift Merge Robot 1c46b31a68
Merge pull request #14560 from rhatdan/remote
podman-remote push --remove-signatures support
2022-06-13 04:15:20 -04:00
cdoern 958759a719 podman pod clone
implement podman pod clone, a command to create an exact copy of a pod while changing
certain config elements

current supported flags are:
--name change the pod name
--destroy remove the original pod
--start run the new pod on creation
and all infra-container related flags from podman pod create (namespaces etc)

resolves #12843

Signed-off-by: cdoern <cdoern@redhat.com>
2022-06-10 14:23:19 -04:00
Daniel J Walsh 48cf1d2583
podman-remote push --remove-signatures support
I don't see a reason why we don't support --remove-signatures
from remote push, so adding support.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-06-10 07:14:12 -04:00
Valentin Rothberg d4272bed51 podman cp: do not overwrite non-dirs with dirs and vice versa
Add a new `--overwrite` flag to `podman cp` to allow for overwriting in
case existing users depend on the behavior; they will have a workaround.
By default, the flag is turned off to be compatible with Docker and to
have a more sane behavior.

Fixes: #14420
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-06-10 09:42:19 +02:00
Valentin Rothberg 46c8da7d9a vendor buildah@main
Note that the bud-logfile-with-split-logfile-by-platform test is skipped
on the remote client (see #14544).

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-06-10 09:42:19 +02:00
cdoern 7b3e43c1f6 podman volume create --opt=o=timeout...
add an option to configure the driver timeout when creating a volume.
The default is 5 seconds but this value is too small for some custom drivers.

Signed-off-by: cdoern <cdoern@redhat.com>
2022-06-09 16:44:21 -04:00
OpenShift Merge Robot f808907d85
Merge pull request #14469 from shanesmith/prevent-simultaneous-machine-starts
Prevent simultaneous machine starts
2022-06-09 16:23:25 -04:00
OpenShift Merge Robot 0405e7c161
Merge pull request #14539 from Luap99/completion5
shell completion: fix problems with container path completion
2022-06-09 14:35:07 -04:00
Shane Smith 81153ffa21
Introduce 'Starting' status for machines
- The State() function now returns machine.Starting status instead of an
  empty string if the VM is in the process of starting.

- The `CheckExclusiveActiveVM()` function returns `true` to prevent
  starting a VM while another is in the process of starting.

- `podman machine ls` displays "Currently starting" under "Last Up" for
  the starting VM

- `podman machine ls` supports `{{.Starting}}` boolean field in the format

- `podman machine inspect` displays "starting" in the "State" field for
  the starting VM

Signed-off-by: Shane Smith <shane.smith@shopify.com>
2022-06-09 12:42:43 -04:00
Paul Holzinger 5614c29ce1
compat api: fix regressions from "Swagger refactor/cleanup"
For some reason commit 5b79cf15a0 moved the container create options
parsing from cmd/podman/common to pkg/api/handlers. However it did not
remove the old code. Unfortunately  it moved the code from an outdated
version and did not update it before this commit was merged.
Therefore a couple of regressions were introduced. I manually compared
both versions and found three missing bugfixes.

I fixed the network test again that was changed in bce97a3b5d. We
want bridge as default even as rootless. Sine the test is not run as
rootless in CI the regression was not caught.
Also the no hosts test never worked since it was missing the import
check if the hosts file exists.

I don't think we can check for the volume parsing change since this only
works on windows/wsl.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-06-09 16:00:46 +02:00
Paul Holzinger 549bffe58d
shell completion: fix problems with container path completion
When you try to complete a path which exists and it is a file the
completion logic did not check the parent dir for other matching file
names. To fix that we have to check if the current completion is not a
dir and use the parent dir in this case.

See the updated test for an example why this is required.

Also make sure directories are correctly completed, the shell always
adds the "/" as suffix to signal the user that this path is a directory.
In this case we do not want to automatically add a space. When the path
is a regular file we want the space after the suggestion since there is
nothing more to complete.

This better matches the normal default shell completion.

The test were changed to not assume any particular ordering since this
is irrelevant for the shell completion script and there is no guarantee
about the ordering.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-06-09 13:46:55 +02:00
OpenShift Merge Robot 81f228b20a
Merge pull request #14466 from mheon/fix_9075
Improve robustness of `podman system reset`
2022-06-03 17:54:57 -04:00
Matthew Heon 259c79963f Improve robustness of `podman system reset`
Firstly, reset is now managed by the runtime itself as a part of
initialization. This ensures that it can be used even with
runtimes that would otherwise fail to be created - most notably,
when the user has changed a core path
(runroot/root/tmpdir/staticdir).

Secondly, we now attempt a best-effort removal even if the store
completely fails to be configured.

Third, we now hold the alive lock for the entire reset operation.
This ensures that no other Podman process can start while we are
running a system reset, and removes any possibility of a race
where a user tries to create containers or pull images while we
are trying to perform a reset.

[NO NEW TESTS NEEDED] we do not test reset last I checked.

Fixes #9075

Signed-off-by: Matthew Heon <mheon@redhat.com>
2022-06-03 12:54:08 -04:00
OpenShift Merge Robot 5e15a26e0e
Merge pull request #14460 from cipherboy/align-docker-podman-load-output
Align docker load and podman load output
2022-06-02 21:24:26 -04:00
Karthik Elango 9a34b88c9a changed megabyte to mebibyte
In podman run --help, the message said megabyte, gigabyte, etc. In reality podman takes mebibytes, gibibytes, etc.

[CI:DOCS]

Signed-off-by: Karthik Elango <kelango@redhat.com>
2022-06-02 14:58:39 -04:00
OpenShift Merge Robot be527a358a
Merge pull request #14457 from Luap99/completion4
shell completion for paths inside the image/container
2022-06-02 14:02:11 -04:00
Alexander Scheel 5023ce585c Align docker load and podman load output
The comma-separated podman load output isn't conducive for using the
subsequent images. For tarballs with multiple images, the comma
separator must be manually identified and a suitable range identified.

Docker CLI on the other hand, has one image identifier per line:

Loaded image: repo1/name1:latest
Loaded image: repo1/name1:tag1
Loaded image: repo2/name2:tag1

(as of Docker version 20.10.16, build aa7e414).

Switch `podman load` to this format for consistency and usability.

[NO NEW TESTS NEEDED]

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
2022-06-02 13:54:04 -04:00
Paul Holzinger f2bbbd20da
shell completion for paths inside the image/container
Add shell completion for paths inside the container or image. Currently
podman run IMAGE [TAB] only uses the default shell completion which
suggests paths on the host. This is fine for some cases but often the
user wants a path which only exists in the image/container.

This commits adds support for that. Both podman create/run can now
complete the paths from the image, podman cp ctr:... now completes paths
from the actual container.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-06-02 17:23:22 +02:00
OpenShift Merge Robot 13cdf862e6
Merge pull request #14301 from rhatdan/volume
Support setting image_volume_mode in containers.conf
2022-06-02 10:16:28 -04:00
OpenShift Merge Robot 2958aee083
Merge pull request #14417 from Luap99/machine-ssh
podman machine ssh: set correct exit code
2022-06-02 04:24:01 -04:00
Paul Holzinger ec576a5491
podman volume export/import: give better error
When the volume does not exist we should output an error stating so and
not some generic one.

Fixes #14411

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-05-30 18:10:28 +02:00
Paul Holzinger 0e58636c3a
podman machine ssh: set correct exit code
Forward the ssh exit code to the podman caller. This is useful for
scripts. Use the same logic as podman unshare.

Fixes #14401

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-05-30 15:55:20 +02:00
Paul Holzinger a6f8cad545
fix bad import path for cmd/podman/utils
Libpod or packages under /pkg should never import from /cmd/...
This will quickly result in import cycles and weird code paths.
Also there is no reason to use this special code we can just use
syscall.SIGHUB as SIGNAL.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-05-30 15:29:08 +02:00
OpenShift Merge Robot a72b2402c9
Merge pull request #14320 from flouthoc/build-honor-squash-and-layers
build: allow using `cache` explicitly with `--squash-all` using `--layers`
2022-05-27 06:37:19 -04:00
OpenShift Merge Robot 1736f2fe60
Merge pull request #14382 from jwhonce/wip/init_todo
Remove TODO comment
2022-05-26 15:35:19 -04:00
OpenShift Merge Robot 49ef9eb52a
Merge pull request #14374 from umohnani8/todo-3
Combine the CheckAllLatest CID and PodID functions
2022-05-26 14:27:24 -04:00
Daniel J Walsh fb163976f4
Support setting image_volume_mode in containers.conf
Fixes: https://github.com/containers/podman/issues/14230

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-05-26 14:16:26 -04:00
OpenShift Merge Robot bf403c8d3f
Merge pull request #14373 from umohnani8/todo-2
Fix TODO in pod/ps.go and parse/net.go
2022-05-26 13:59:09 -04:00
Jhon Honce 87ad460603 Remove TODO comment
Allowing custom flags to provider has the potential to break all the
hand-crafted commands currently in use. This could become a support
nightmare.

```release-note
NONE
```

[NO NEW TESTS NEEDED]

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-05-26 10:26:38 -07:00
Aditya R 66a56ce05a
vendor: bump buildah to v1.26.1-0.20220524184833-5500333c2e06
Bump buildah to v1.26.1-0.20220524184833-5500333c2e06

Signed-off-by: Aditya R <arajan@redhat.com>
2022-05-26 21:01:31 +05:30
Aditya R 6124b51993
build: allow using cache explicitly with --squash-all using --layers
Buildah already supports using `--layers` with `--squash` after https://github.com/containers/buildah/pull/3674
if user wants to do so hence podman must honor similar configuration
in `--squash-all` behaviour if user wants to using cache.

PS: We cannot alter behaviour of `podman build --squash` for
docker-compat reasons hence this feature can be easily supported by
`--squash-all`.

Closes: https://github.com/containers/buildah/issues/4011

Signed-off-by: Aditya R <arajan@redhat.com>
2022-05-26 21:01:18 +05:30
Urvashi Mohnani 426a07e700 Combine the CheckAllLatest CID and PodID functions
These two functions were doing the exact same thing just
with cidfile and pod-id-file separately. Combine the functionality
to one function to remove repetative code.
Fix the TODO in cmd/podman/validate/args.go

[NO NEW TESTS NEEDED]

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2022-05-26 11:12:40 -04:00
Urvashi Mohnani c9f6639ecc Fix TODO in parse/net.go
Fix up the parseEnv function to differentiate
between a label and env when parsing.
Don't do a system lookup when parsing labels.

[NO NEW TESTS NEEDED]

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2022-05-26 11:04:01 -04:00
Urvashi Mohnani 32aa12a285 Remove TODO from pods/ps.go
The TODO has already been fixed. Filters is now a []string

[NO NEW TESTS NEEDED]

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2022-05-26 11:03:45 -04:00
Aditya R b730e7328e
cmd, build: remove redundant squash processing logic
Same block contains similar lines above this is not needed as this looks
redundant.

[NO NEW TESTS NEEDED]
[NO TESTS NEEDED]

Signed-off-by: Aditya R <arajan@redhat.com>
2022-05-26 10:50:21 +05:30
OpenShift Merge Robot acdfb4d14f
Merge pull request #14366 from jwhonce/wip/rm_todo
Support remote deadlock errors in rm
2022-05-25 18:23:30 -04:00
Jhon Honce 66c846616c Support remote deadlock errors in rm
Refactor test for deadlock by comparing error text vs. actual
ErrWillDeadlock constant. When running with --remote the error
constant will always be not equal to the error returned by the API.

```release-note
NONE
```

[NO NEW TESTS NEEDED]

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-05-25 11:14:20 -07:00
Jhon Honce 338f012370 Remove unused archive flag from diff commands
* Option left in images/diff.go CLI as comment implies it is needed for
  backwards compatibility.

```release-note
NONE
```

[NO NEW TESTS NEEDED]

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-05-25 08:50:12 -07:00
OpenShift Merge Robot af01cd06dd
Merge pull request #14357 from rhatdan/codespell
Fix codespell errors
2022-05-25 10:32:48 -04:00
OpenShift Merge Robot 800a367d73
Merge pull request #14333 from rhatdan/pod
Allow podman pod create --share +pid
2022-05-25 08:57:15 -04:00
Daniel J Walsh 429b1f7685
Fix codespell errors
[NO NEW TESTS NEEDED]

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-05-25 05:56:29 -04:00
OpenShift Merge Robot b13184dfb4
Merge pull request #14334 from rhatdan/pod1
Allow podman pod create to accept name argument
2022-05-24 22:12:59 -04:00
OpenShift Merge Robot 6f2a40d42e
Merge pull request #14346 from edsantiago/helpmsg_tests
help-message system test: catch more cases
2022-05-24 19:56:54 -04:00
Daniel J Walsh 2ce4755767
Allow podman pod create --share +pid
Fixes: https://github.com/containers/podman/issues/13422

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-05-24 15:58:31 -04:00
OpenShift Merge Robot 0f5c06dac5
Merge pull request #14330 from Luap99/completion3
cmd/podman/common/completion.go: fix FIXMEs
2022-05-24 14:24:46 -04:00
OpenShift Merge Robot eea7491d6b
Merge pull request #14327 from rhatdan/common
Use containers/common/pkg/util.StringToSlice
2022-05-24 13:48:50 -04:00
Daniel J Walsh df394b5218
Allow podman pod create to accept name argument
I am constantly attempting to add the podname to the last
argument to podman pod create. Allowing this makes it match
podman volume create and podman network create.

It does not match podman container create, since podman container create
arguments specify the arguments to run with the container.

Still need to support the --name option for backwards compatibility.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-05-24 13:17:02 -04:00
OpenShift Merge Robot 6240783f85
Merge pull request #14348 from jwhonce/wip/root_fixme
[CI:DOCS] Remove TODO re: storage-driver
2022-05-24 13:12:31 -04:00
Paul Holzinger 70f147d019
cmd/podman/common/completion.go: fix FIXMEs
There is no good way to recommend labels for podman container runlabel.

Add the missing max-size log option. These are the only documented
options so the completion should not suggest something different.

Add proper --stop-signal completion. It will now complete all supported
signal names both upper and lowercase depending on the user input. Also
it work with and without the SIG prefix.

Fixing the TODOs in this file are more complicated since they describe
bigger features.

[NO NEW TESTS NEEDED]

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-05-24 17:56:37 +02:00
Jhon Honce 2be4589b5d Remove TODO re: storage-driver
Currently this list is not exported from c/storage and the group
decided this will not be changed.

```release-note
NONE
```

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-05-24 08:45:32 -07:00
Ed Santiago 8de3e91024 help-message system test: catch more cases
- Look for and prevent lower-case arg descriptions:
     podman cmd [arg]

 - Look for and prevent optional-mandatory misordering:
     podman cmd [ARG] ARG

 - Tighter whitespace checks (and fix podman pod ps)

 - simplify a no-longer-necessary mess! #8635 fixed the
   horrible "CONTAINER | IMAGE" strings (with spaces),
   so there's no longer a need to special-case those.
   The one-extra-arg check is now much cleaner.

Minor refactoring.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-05-24 09:21:11 -06:00
Valentin Rothberg 5268314e53 podman image mount: print pretty table
Make sure that `podman image mount` prints a pretty table unless there
is only argument passed and without a custom format.  Fixing a TODO item
brought me to the specific code location and revealed the fart in the
logic.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-24 16:07:39 +02:00
Valentin Rothberg d924c46dae autocomplete `podman search --filter`
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-24 16:07:38 +02:00
OpenShift Merge Robot 40c2ea3a27
Merge pull request #14263 from Luap99/completion
shell completion --format: various improvements
2022-05-23 15:50:44 -04:00
Daniel J Walsh 5d37d80ff9
Use containers/common/pkg/util.StringToSlice
[NO NEW TESTS NEEDED] Just code cleanup for better reuse

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-05-23 12:16:54 -04:00
OpenShift Merge Robot 1916fe22a9
Merge pull request #14272 from Luap99/completion2
shell completion: use more constants in the code
2022-05-19 18:45:03 -04:00
Paul Holzinger 9c9fc96d27
shell completion: use more constants instead of duplicating strings
It is better to just reuse the existing constants instead of duplicating
the strings.

[NO NEW TESTS NEEDED]

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-05-19 14:04:23 +02:00
Paul Holzinger 337f8b9d98
shell completion: podman save --format use all valid values
docker-archive was missing from the completions. To prevent duplication
use the same format list as podman save.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-05-19 14:04:22 +02:00
Paul Holzinger 74f70315b3
shell completion: update podman inspect --type options
Add all option that are supported by the podman inspect --type flag to
the completions. Also use the same constants instead of duplicating the
strings. In order to do this I had to move the definitions into the
common package to prevent an import cycle.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-05-19 14:04:22 +02:00
Paul Holzinger 318e95fd2a
shell completion: fix podman event --filter values
The completion suggested incorrect values for `podman events --filter
type=` . It should only list types not the event status. Also make sure
to use the constants instead of duplicating the strings.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-05-19 14:04:10 +02:00
Valentin Rothberg b22143267b linter: enable unconvert linter
Detects unneccessary type conversions and helps in keeping the code base
cleaner.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-19 13:59:15 +02:00
Paul Holzinger 3b0844f990
shell completion --format: add help to function with args
From a template users POV it is not importent when they use a struct field or
method. They only notice the difference when the function requires arguments.
So lets be nice and let the user know that this method requires arguments
via the help text.

This is how it now looks like when the completion descriptions are enabled
on bash:
```
$  bin/podman ps --format {{.Created.A
{{.Created.AddDate       (This is a function and requires 3 arguments)   {{.Created.After         (This is a function and requires 1 argument)
{{.Created.Add           (This is a function and requires 1 argument)    {{.Created.AppendFormat   (This is a function and requires 2 arguments)
```

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-05-18 18:28:22 +02:00
Paul Holzinger 3d8a1f9173
shell completion --format: support maps and functions
Currently we only support structs in a template string like this:
`{{.var1.test.` -> this meams that test must be a struct field on var1.

Now with this var1 and test could also be either a map or function which
returns a struct.

A actual example:
`podman container inspect  --format {{.NetworkSettings.Networks.netname.`
Now we can complete the struct fileds after netname. Note that this
cannot complete map keys since they are empty by default, so it is
impossible to get them in the completion logic.

Also this fixes a panic with embeeded nil structs
Fixes #14223

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-05-18 18:28:22 +02:00
Paul Holzinger ecd6edb191
shell completion --format: fix embedded struct handling
When a struct is embeeded it is possible that we end up with same names
but different types, this results in incorrect completions. The go
template logic always preferes the actual field/method name before the
one from the embedded one. Thefore the completion logic should do the
same. First get all method/fields names from the struct and then only
add the field names from the embedded struct when they are not already
present in the list.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-05-18 18:28:11 +02:00
Paul Holzinger 11ff5ffd3b
shell completion --format: only show usable methods
In a template you cann call function that are defined on a type, however
this is only useful if they return one value. If it returns more than
one the template cannot know what value it has to display.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-05-18 18:24:42 +02:00
Paul Holzinger eeeb88a667
shell completion --format: only show exported fields
go templates only support exported fields, so the completion logic must
filter the private fields out.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-05-18 18:24:41 +02:00
Jason T. Greene de4f76e7ea Fix strange buildtag edit
Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2022-05-13 12:11:51 -05:00
Jason T. Greene 7804f4d291 Add support for machine events on Windows
Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2022-05-12 14:41:26 -05:00
Daniel J Walsh 81fc9f1dea
Merge pull request #14159 from vrothberg/service-container
play kube: service container
2022-05-12 13:35:56 -04:00
OpenShift Merge Robot 45e9f1ff09
Merge pull request #14216 from Luap99/format-completion
shell completion --format: work with pointer functions
2022-05-12 15:32:58 +02:00
Paul Holzinger 9df3906553
shell completion --format: work with pointer functions
The completion logic currently suggest also the functions that are
defined for this type. However this did not work correctly when it was
defined as pointer to that type on not the actual type.

This commit fixes that problem. To test you can compare the difference
between `podman stats --format {{.[TAB]` with and without this commit.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-05-12 13:15:56 +02:00
Valentin Rothberg 840c120c21 play kube: service container
Add the notion of a "service container" to play kube.  A service
container is started before the pods in play kube and is (reverse)
linked to them.  The service container is stopped/removed *after*
all pods it is associated with are stopped/removed.

In other words, a service container tracks the entire life cycle
of a service started via `podman play kube`.  This is required to
enable `play kube` in a systemd unit file.

The service container is only used when the `--service-container`
flag is set on the CLI.  This flag has been marked as hidden as it
is not meant to be used outside the context of `play kube`.  It is
further not supported on the remote client.

The wiring with systemd will be done in a later commit.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-05-12 10:51:13 +02:00
OpenShift Merge Robot c379014ee4
Merge pull request #14170 from ashley-cui/machtests
Add more machine tests
2022-05-11 03:03:31 -04:00