summaryrefslogtreecommitdiff
path: root/cmd/podman/root.go
Commit message (Collapse)AuthorAge
* Drop default log-level from error to warnDaniel J Walsh2020-12-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our users are missing certain warning messages that would make debugging issues with Podman easier. For example if you do a podman build with a Containerfile that contains the SHELL directive, the Derective is silently ignored. If you run with the log-level warn you get a warning message explainging what happened. $ podman build --no-cache -f /tmp/Containerfile1 /tmp/ STEP 1: FROM ubi8 STEP 2: SHELL ["/bin/bash", "-c"] STEP 3: COMMIT --> 7a207be102a 7a207be102aa8993eceb32802e6ceb9d2603ceed9dee0fee341df63e6300882e $ podman --log-level=warn build --no-cache -f /tmp/Containerfile1 /tmp/ STEP 1: FROM ubi8 STEP 2: SHELL ["/bin/bash", "-c"] STEP 3: COMMIT WARN[0000] SHELL is not supported for OCI image format, [/bin/bash -c] will be ignored. Must use `docker` format --> 7bd96fd25b9 7bd96fd25b9f755d8a045e31187e406cf889dcf3799357ec906e90767613e95f These messages will no longer be lost, when we default to WARNing level. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Enable remote shell completion without a running endpointPaul Holzinger2020-11-20
| | | | | | | | | | The problem is that we always unconditionally setup up the `ContainerEngine/ImageEngine`. This requires an running endpoint. Most completions (e.g. flag names) do not need them and should not fail. This commit makes sure we only setup the engines as needed in the completions. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
* Remove some more excessive wrapping and stutteringDaniel J Walsh2020-11-17
| | | | | | | | | | Stop over wrapping API Calls The API calls will return an appropriate error, and this wrapping just makes the error message look like it is stuttering and a big mess. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Add shell completion with cobraPaul Holzinger2020-11-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow automatic generation for shell completion scripts with the internal cobra functions (requires v1.0.0+). This should replace the handwritten completion scripts and even adds support for fish. With this approach it is less likley that completions and code are out of sync. We can now create the scripts with - podman completion bash - podman completion zsh - podman completion fish To test the completion run: source <(podman completion bash) The same works for podman-remote and podman --remote and it will complete your remote containers/images with the correct endpoints values from --url/--connection. The completion logic is written in go and provided by the cobra library. The completion functions lives in `cmd/podman/completion/completion.go`. The unit test at cmd/podman/shell_completion_test.go checks if each command and flag has an autocompletion function set. This prevents that commands and flags have no shell completion set. This commit does not replace the current autocompletion scripts. Closes #6440 Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
* Switch use of Flags to OptionsDaniel J Walsh2020-10-21
| | | | | | | | Want to have man pages match commands, since we have lots of printed man pages with using Options, we will change the command line to use Options in --help. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Fix the "err: cause" order of OCI runtime errorsJordan Christiansen2020-10-09
| | | | | | | | | | | | | | | | Previously, the order of OCI error messages was reversed, so that the type of error was listed as the cause. For example: Error: writing file `cpu.cfs_quota_us`: Invalid argument: OCI runtime error This error message makes it seem like "OCI runtime error" is the argument that was invalid. In fact, "OCI runtime error" is the error and "writing file ..." is the cause. With this change, the above message reads: Error: OCI runtime error: writing file `cpu.cfs_quota_us`: Invalid argument Signed-off-by: Jordan Christiansen <xordspar0@gmail.com>
* podman-remote does not support most of the global flagsDaniel J Walsh2020-10-02
| | | | | | | podman-remote --help is showing a bunch of global flags that it does not support Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Refactor version handling in cmd treeJhon Honce2020-09-18
| | | | | | | * Move from simple string to semver objects * Change client API Version from '1' to 2.0.0 Signed-off-by: Jhon Honce <jhonce@redhat.com>
* podman version and --version: fix format, exitEd Santiago2020-09-15
| | | | | | | | | | | | | | | | | | | | | | | | | Three unrelated fixes to version output: * podman version --format json: was missing a newline * podman version --format TEMPLATE: had too many newlines * podman --version: would neither display version nor exit if followed by a subcommand ('podman --version ps') The first two were easy: I used my best tweezers to delicately pluck and transfer the misplaced \n and place it where needed. The third was a doozy of a rabbit hole. As best I can tell, a workaround was added in root.go to override cobra's built-in Version handling, apparently to avoid having cobra add "-v" as an alias for "--version". As best I can tell, cobra only does this if the "-v" shortcut is not already taken (at least as of Nov 2019: https://github.com/spf13/cobra/pull/996 ). Also as best I can tell that workaround is purely vestigial, and removing it is safe. I've manually tested "-v" in podman run, system df, and rm. I've run system tests. Signed-off-by: Ed Santiago <santiago@redhat.com>
* Refactor API build endpoint to be more compliantJhon Honce2020-09-14
| | | | | | | | | | | | | | | | | * Refactor/Rename channel.WriteCloser() to encapsulate the channel * Refactor build endpoint to "live" stream buildah output channels over API rather then buffering output * Refactor bindings/tunnel build because endpoint changes * building tar file now in bindings rather then depending on caller * Cleanup initiating extra image engine * Remove setting fields to zero values (less noise in code) * Update tests to support remote builds Fixes #7136 Fixes #7137 Signed-off-by: Jhon Honce <jhonce@redhat.com>
* Merge pull request #7403 from QiWang19/runtime-flagOpenShift Merge Robot2020-09-11
|\ | | | | Add global options --runtime-flags
| * Add global options --runtime-flagsQi Wang2020-09-04
| | | | | | | | | | | | Add global options --runtime-flags for setting options to container runtime. Signed-off-by: Qi Wang <qiwan@redhat.com>
* | Don't setup the Image/ContainerEngine when calling a cmd with subcmdsPaul Holzinger2020-09-08
|/ | | | | | | | | | | There is no need to setup the image and container engine when calling a command with subcommands since we only print a usage message. e.g `podman`,`podman container` This also allows the remote client to show the usage message on these commands without a running endpoint. I added a test for this. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
* Fix log level case regressionSascha Grunert2020-08-28
| | | | | | | | | | With previous versions of Podman (like v1.9.2) it was always possible to specify the log level in any case, for example `INFO`. This behavior has silently changed, where the `--log-level` flag only accepts lower case levels. This commit re-enables the old behavior and adds an e2e test for it. Signed-off-by: Sascha Grunert <sgrunert@suse.com>
* Add support for --connectionDaniel J Walsh2020-08-19
| | | | | | | | | | | | | | | | | * override --url and/or --identity fields from containers.conf * --connection flag has higher precedence than ActiveService from containers.conf. Which is set via podman system connection default * Add newline to error message printed on stderr * Added --connection to bash completion and documentation * Updated bindings to query server in case of no path or / Closes #jira-991 Fixes #7276 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Signed-off-by: Jhon Honce <jhonce@redhat.com> Squashed commits to work around CI issue
* podman-remote fixes for msi and clientBrent Baude2020-08-12
| | | | | | | | correct small typo that sets the path on windows via the msi xml. in the remote client, prompt for SSH password when no identity or alternate means of authentication are provided. Signed-off-by: Brent Baude <bbaude@redhat.com>
* remove --latest for all remote commandsBrent Baude2020-08-10
| | | | | | | | instead of hiding the latest options for podman-remote or catching an error if podman --remote <cmd> -l is used, we no longer add the latest option to any remote command. podman will error with a "unknown flag" option. Fixes: #7127 Signed-off-by: Brent Baude <bbaude@redhat.com>
* Switch all references to github.com/containers/libpod -> podmanDaniel J Walsh2020-07-28
| | | | Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* [WIP] Refactor podman system connectionJhon Honce2020-07-22
| | | | | | | | | | | | * Add support to manage multiple connections * Add connection * Remove connection * Rename connection * Set connection as default * Add markdown/man pages * Fix recursion in hack/xref-helpmsgs-manpages Signed-off-by: Jhon Honce <jhonce@redhat.com>
* abi: set default umask and rlimitsGiuseppe Scrivano2020-07-17
| | | | | | | | the code got lost in the migration to podman 2.0, reintroduce it. Closes: https://github.com/containers/podman/issues/6989 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
* Merge pull request #6864 from vrothberg/v2-moduleOpenShift Merge Robot2020-07-06
|\ | | | | move go module to v2
| * move go module to v2Valentin Rothberg2020-07-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the advent of Podman 2.0.0 we crossed the magical barrier of go modules. While we were able to continue importing all packages inside of the project, the project could not be vendored anymore from the outside. Move the go module to new major version and change all imports to `github.com/containers/libpod/v2`. The renaming of the imports was done via `gomove` [1]. [1] https://github.com/KSubedi/gomove Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* | Set engine env from common configQi Wang2020-07-03
|/ | | | | | | Set the env that is used by Podman. related issue containers/common#31 Signed-off-by: Qi Wang <qiwan@redhat.com>
* Fixes --remote flag issuesJhon Honce2020-06-26
| | | | | | | | | | | | | | | * --remote, --url and --identity are now anchored to podman command. Subcommands should no longer have issues * TraverseChildren now set to V1 expectations * Latest flag now has helper function. Now has consistent usage. * IsRemote() uses cobra parser to determin if --remote is given * Moved validation functions from parser pkg to validate pkg * Fixes #6598 Fixes #6704 Signed-off-by: Jhon Honce <jhonce@redhat.com>
* V2 podman system connectionJhon Honce2020-06-23
| | | | | | | | | * Implement command * Refactor podman-remote to pull from containers.conf by default * podman-remote defaults to --remote being true * Write podman-system-connection.1.md Signed-off-by: Jhon Honce <jhonce@redhat.com>
* Fixup issues found by golintDaniel J Walsh2020-06-10
| | | | Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Add parallel execution code for container operationsMatthew Heon2020-06-05
| | | | | | | | This code will run container operations in parallel, up to a given maximum number of threads. Currently, it has only been enabled for local `podman rm` as a proof of concept. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
* V2 Add support for ssh authentication methodsJhon Honce2020-06-03
| | | | | | | | | | | | | | | | | * podman --remote ssh://<user>:<password>@<host>:<port><path> * podman --remote ssh://<user>:<password>@<host>:<port><path> \ --identity <path> --passphrase <phrase> * ssh-add <key> podman --remote ssh://<user>@<host><path> * Fix `podman help` to run even if podman missing components * Prompt for passphrase on stdin IFF key is protected and passphrase not given via any other configuration * cobra flags do not support optional value flags therefore refactored --remote to be a boolean and --url will now contain the URI to Podman service Signed-off-by: Jhon Honce <jhonce@redhat.com>
* compat handlers: add X-Registry-Auth header supportValentin Rothberg2020-05-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Support the `X-Registry-Auth` http-request header. * The content of the header is a base64 encoded JSON payload which can either be a single auth config or a map of auth configs (user+pw or token) with the corresponding registries being the keys. Vanilla Docker, projectatomic Docker and the bindings are transparantly supported. * Add a hidden `--registries-conf` flag. Buildah exposes the same flag, mostly for testing purposes. * Do all credential parsing in the client (i.e., `cmd/podman`) pass the username and password in the backend instead of unparsed credentials. * Add a `pkg/auth` which handles most of the heavy lifting. * Go through the authentication-handling code of most commands, bindings and endpoints. Migrate them to the new code and fix issues as seen. A final evaluation and more tests is still required *after* this change. * The manifest-push endpoint is missing certain parameters and should use the ABI function instead. Adding auth-support isn't really possible without these parts working. * The container commands and endpoints (i.e., create and run) have not been changed yet. The APIs don't yet account for the authfile. * Add authentication tests to `pkg/bindings`. Fixes: #6384 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* Fix build on OS XMatthew Heon2020-05-20
| | | | | | | | | | | | | | | | We disabled the OS X and Windows cross-building tests. This, predictably, led us to regress a bit in our ability to build for both of these. This fixes the build on OS X and fixes one obvious Windows bug. Unfortunately, we're dragging in all of `pkg/spec` somewhere on Windows, and things are blowing up spectacularly because of it (plus a few uses of the `syscall` package in the bindings). I've giving up for the day. This fixes OS X, but does not fully enable the cross-build CI (need Windows fixes for that). Signed-off-by: Matthew Heon <matthew.heon@pm.me>
* default to tunnel without ABISupport tagDaniel J Walsh2020-05-08
| | | | | | | | | | When compiling a Linux binary without ABISupport, default to use the tunnel. The behaviour is expected in `podman-remote`. Also set a default for the remote flag so `podman-remote` works OOB. Signed-off-by: Valentin Rothberg <rothberg@redhat.com> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Fix errors found when comparing podman v1 --help versus V2Daniel J Walsh2020-05-04
| | | | | | | | Mainly add missing commands to podman image, podman containers, podman system Also fix some informations messages and descriptions. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* V2 enable ps testsJhon Honce2020-04-29
| | | | | | | | * Combine cobra.Command helper functions into validate package from registry and common packages * Introduce ChoiceValue for flags Signed-off-by: Jhon Honce <jhonce@redhat.com>
* Merge pull request #5956 from jwhonce/wip/versionOpenShift Merge Robot2020-04-29
|\ | | | | V2 restore podman -v command
| * V2 restore podman -v commandJhon Honce2020-04-29
| | | | | | | | | | | | | | * Removed extra spaces and improved error message * Updated tests to use gomega matchers Signed-off-by: Jhon Honce <jhonce@redhat.com>
* | V2 Restore images list testsJhon Honce2020-04-29
|/ | | | | | | | * Fix history --quiet formatting * Fix image inspect --format=json * Fix image list --sort Signed-off-by: Jhon Honce <jhonce@redhat.com>
* system tests must passBrent Baude2020-04-28
| | | | Signed-off-by: Brent Baude <bbaude@redhat.com>
* V2 restore libpod.Shutdown() when exiting podman commandsJhon Honce2020-04-22
| | | | Signed-off-by: Jhon Honce <jhonce@redhat.com>
* Enable some testingBrent Baude2020-04-17
| | | | Signed-off-by: Brent Baude <bbaude@redhat.com>
* Fix bug where two configurations had been createdJhon Honce2020-04-16
| | | | | | * registry.PodmanConfig() new returns a pointer to the source of truth Signed-off-by: Jhon Honce <jhonce@redhat.com>
* Podman V2 birthBrent Baude2020-04-16
remote podman v1 and replace with podman v2. Signed-off-by: Brent Baude <bbaude@redhat.com>