summaryrefslogtreecommitdiff
path: root/cmd/podman/images/build.go
Commit message (Collapse)AuthorAge
* linter: enable wastedassignValentin Rothberg2022-03-22
| | | | Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
* Bump Buildah to v1.24.0tomsweeneyredhat2022-01-27
| | | | | | | | | Bumps Buildah to v1.24.0 and adopts the new values for pull: true, false, never, and always. The pull-never and pull-always options for the build command are still usable, but they have been removed from the man page documentation with this change. Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
* remote build: set rootless oci isolation correctlyPaul Holzinger2022-01-24
| | | | | | | | | | | | | | When we run rootless buildah needs to have IsolationOCIRootless set otherwise it will run code which cannot be used as rootless user. Podman should use the buildah default if possible and change it to rootless mode if needed. [NO NEW TESTS NEEDED] Should be covered by existing tests once we have podman-remote rootless tests. Fixes #12989 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* bump go module to version 4Valentin Rothberg2022-01-18
| | | | | | | | | | | | | Automated for .go files via gomove [1]: `gomove github.com/containers/podman/v3 github.com/containers/podman/v4` Remaining files via vgrep [2]: `vgrep github.com/containers/podman/v3` [1] https://github.com/KSubedi/gomove [2] https://github.com/vrothberg/vgrep Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* Podman Build use absolute filepathcdoern2022-01-13
| | | | | | | | | podman build always finds the abs path but was never using it for the containerfile path. This was causing the remote client to be given a relative path that does not exist. Switch to evaluating and using absolute paths only. resolves #12841 Signed-off-by: cdoern <cdoern@redhat.com>
* podman build enable --all-platforms and --unsetenvPaul Holzinger2022-01-13
| | | | | | | Make sure we add support for allplatforms and unsetenv to both local and remote podman. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
* build: relay exitcode from imagebuildah to registryAditya Rajan2021-12-17
| | | | | | | | Podman does not relay exit code from buildah instead returns a generic error code `125`. Following PR allows `podman` to relay exit code from `imagebuildah` to `registry` as it is. Signed-off-by: Aditya Rajan <arajan@redhat.com>
* standardize logrus messages to upper caseDaniel J Walsh2021-09-22
| | | | | | | | Remove ERROR: Error stutter from logrus messages also. [ NO TESTS NEEDED] This is just code cleanup. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Merge pull request #11585 from flouthoc/bump-buildah-1-23-0OpenShift Merge Robot2021-09-15
|\ | | | | vendor: Bump github.com/containers/buildah from 1.22.3 to 1.23.0
| * build: mirror --authfile to filesystem if pointing to FD instead of fileAditya Rajan2021-09-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Following commit makes sure that podman mirrors --authfile to a temporary file in filesystem if arg is pointing to an FD instead of actual file as FD can be only consumed once. Reference: * https://github.com/containers/buildah/pull/3498 * https://github.com/containers/buildah/issues/3070 [NO TESTS NEEDED] Signed-off-by: Aditya Rajan <arajan@redhat.com>
* | build: take advantage of --platform listsNalin Dahyabhai2021-09-14
|/ | | | | | | | | | | The builder can take a list of platforms in the Platforms field of its BuildOptions argument, and we should definitely take advantage of that. The `bud-multiple-platform-values` test from buildah exercises support for this, so [NO TESTS NEEDED] Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
* Alias build to buildx, so it won't failDaniel J Walsh2021-08-09
| | | | | | Add hidden --load and --progress flag as well. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Bump github.com/containers/storage from 1.32.3 to 1.32.5Daniel J Walsh2021-06-29
| | | | | | | | | | | | | | | | | Bumps [github.com/containers/storage](https://github.com/containers/storage) from 1.32.3 to 1.32.5. - [Release notes](https://github.com/containers/storage/releases) - [Changelog](https://github.com/containers/storage/blob/main/docs/containers-storage-changes.md) - [Commits](https://github.com/containers/storage/compare/v1.32.3...v1.32.5) --- updated-dependencies: - dependency-name: github.com/containers/storage dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* [Techinal Debt] Cleanup ABI vs. Tunnel CLI commandsJhon Honce2021-05-27
| | | | | | | | | | | | | | | | | | [NO TESTS NEEDED] This commit cleans up two issues: * Most commands support all EngineModes so default to that. Let outlayers declare their intent. * Use cobra.Annotations to set supported EngineMode. This simplies instantiating commands as there is now one method to communicate a commands requirements rather than two. * Combined aliased commands into one file * Fixed aliased commands where Args field did not match * Updated examples in README.md for writing commands * Remove redundant flag DisableFlagsInUseLine in cobra.Command initialization. Signed-off-by: Jhon Honce <jhonce@redhat.com>
* Verify existence of auth file if specifiedDaniel J Walsh2021-04-05
| | | | | | Fixes: https://github.com/containers/podman/issues/9572 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* [NO TESTS NEEDED] Shrink the size of podman-remoteDaniel J Walsh2021-03-29
| | | | Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Merge pull request #9631 from rhatdan/pullOpenShift Merge Robot2021-03-29
|\ | | | | Fix podman build --pull-never
| * Fix podman build --pull-neverDaniel J Walsh2021-03-27
| | | | | | | | | | | | | | | | | | | | | | Currently pull policy is set incorrectly when users set --pull-never. Also pull-policy is not being translated correctly when using podman-remote. Fixes: #9573 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* | [NO TESTS NEEDED] Turn on podman-remote build --isolationDaniel J Walsh2021-03-26
|/ | | | | | | | | | Currently podman only works with --isolation chroot. This PR fixes this by allowing the isolation mode to default to OCI and to also allow users to pass the isolation mode into the containers. The current tests for --isolation should cause this code to be tested. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* [NO TESTS NEEDED] Vendor in containers/buildah v1.20.0Daniel J Walsh2021-03-26
| | | | Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* podman-remote build does not support volumesDaniel J Walsh2021-03-08
| | | | | | | | Remove --volume option from podman-remote since it is not supported, also add information to podman-build man page indicating options not supported over remote connections. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Handle podman build --dns-searchDaniel J Walsh2021-03-07
| | | | | | Fixes: https://github.com/containers/podman/issues/9574 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* podman build --build-arg should fall back to environmentDaniel J Walsh2021-03-07
| | | | | | Fixes: https://github.com/containers/podman/issues/9571 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Add support for podman build --ignorefileDaniel J Walsh2021-03-07
| | | | | | Fixes: https://github.com/containers/podman/issues/9570 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Fix possible panic with podman build --iidfilePaul Holzinger2021-03-03
| | | | | | | | | | Make sure we check for errors before trying to write the iidfile. [NO TESTS NEEDED] Ref #9594 Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
* Fix support for podman build --timestampDaniel J Walsh2021-03-02
| | | | | | | | | Currently podman is ignoreing the build --timestamp flag. This PR fixes this for local and remote clients. Fixes: https://github.com/containers/podman/issues/9569 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* bump go module to v3Valentin Rothberg2021-02-22
| | | | | | | | | We missed bumping the go module, so let's do it now :) * Automated go code with github.com/sirkon/go-imports-rename * Manually via `vgrep podman/v2` the rest Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* Bump containers/buildah to v1.19.4Daniel J Walsh2021-02-08
| | | | | | Fix handling of --iidfile to happen on the client side. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Implement missing arguments for podman buildDaniel J Walsh2021-02-08
| | | | | | | | Buildah bud passes a bunch more flags then podman build. We need to implement hook up all of these flags to get full functionality. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* podman build --pull: refine help message and docsValentin Rothberg2021-01-28
| | | | | | | Refine and correct the wording of the `--pull` flag in the help message and the docs. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* Revert "podman build --pull: use correct policy"Valentin Rothberg2021-01-28
| | | | | | | | | | | This reverts commit 15caebfe561952eaadd4896b7efb56f26724cce5. The previous behaviour of `--pull` to *always* attempt to pull the image and error out if the pull failed aligns with Docker. Since Podman aims at feature parity with Docker, the `--pull` behaviour must match. Fixes: #9134 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* podman build --pull: use correct policyValentin Rothberg2021-01-27
| | | | | | | | | | | The `--pull` flag should be using the "pull if newer" pull policy rather than "pull always". This aligns with what the help message states, what Buildah does and, according to #9111, what was done before, Also add a test to prevent future regressions. Fixes: #9111 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* Pass DefaultMountsFile to podman buildDaniel J Walsh2021-01-25
| | | | | | | The --default-mounts-file path was not being handled in podman build. This will enable it to use for testing. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Bump to containers/buildah 1.9.2Daniel J Walsh2021-01-15
| | | | Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Use HTTPProxy settings from containers.confDaniel J Walsh2021-01-11
| | | | | | | | | | | This PR takes the settings from containers.conf and uses them. This works on the podman local but does not fix the issue for podman remote or for APIv2. We need a way to specify optionalbooleans when creating containers. Fixes: https://github.com/containers/podman/issues/8843 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Fix podman build --logfileHironori Shiina2020-12-22
| | | | | | | | A opened file object of a logfile gets lost because the variable `logfile` is redefined in a `if` block. This fix stops redefining the variable. Signed-off-by: Hironori Shiina <Hironori.Shiina@fujitsu.com>
* Merge pull request #8653 from rhatdan/buildahOpenShift Merge Robot2020-12-09
|\ | | | | Honor the --layers flag
| * Honor the --layers flagDaniel J Walsh2020-12-09
| | | | | | | | | | | | | | | | | | Currently the --layers flag set by the user is ignored, and only the BUILDAH_LAYERS environment variable being set is observed. Fixes: https://github.com/containers/podman/issues/8643 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* | Add system test for shell completionPaul Holzinger2020-12-09
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There exists a unit test to ensure that shell completion functions are defined. However there was no check about the quality of the provided shell completions. Lets change that. The idea is to create a general test that makes sure we are suggesting containers,pods,images... for the correct commands. This works by reading the command use line and checking for each arg if we provide the correct suggestions for this arg. It includes the following tests: - flag suggestions if [options] is set - container, pod, image, network, volume, registry completion - path completion for the appropriate arg KEYWORDS (`PATH`,`CONTEXT`,etc.) - no completion if there are no args - completion for more than one arg if it ends with `...]` The test does not cover completion values for flags and not every arg KEYWORD is supported. This is still a huge improvement and covers most use cases. This test spotted several inconsistencies between the completion and the command use line. All of them have been adjusted to make the test pass. The biggest advantage is that the completions always match the latest command changes. So if someone changes the arguments for a command this ensures that the completions must be adjusted. 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>
* Merge pull request #6442 from Luap99/podman-autocompleteOpenShift Merge Robot2020-11-13
|\ | | | | Shell completion
| * 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>
* | Merge pull request #8326 from Luap99/fix-build-namespaceOpenShift Merge Robot2020-11-13
|\ \ | | | | | | Fix namespace flag parsing for podman build
| * | Fix namespace flag parsing for podman buildPaul Holzinger2020-11-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The namespace options for pid,ipc,uts were completely ignored. The network namespace did not accept `none`. This commit fixes these issues simply by calling `parse.NamespaceOptions` from buildah instead of implementing our own logic. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
| * | Add podman build --net alias for --networkPaul Holzinger2020-11-12
| |/ | | | | | | | | | | Fixes #8332 Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
* / Change podman build --pull=true to PullIfMissingTomSweeneyRedHat2020-11-12
|/ | | | | | | | | | | | | | | | | | | | One last tweak to the man page for 'build --pull' and after further testing against Docker, one slight change to the pull policy. First I changed `--pull=false` from PullNever to PullIfMissing. This matches Docker and will pull the image if it's not present rather than erroring. We've the `--pull-never` option if someone wants the pull to not do an actual pull and to error if the image isn't local. Then for the man page, I'd a much bigger change, in the initial PR, I've backed most of that out and just added a tweak. Hopefully this puts this portion of the pull work behind us for a while. Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
* Match build pull functionality with Docker'sTomSweeneyRedHat2020-10-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a continuation of #8189 and #8085. When doing a `docker build` command, if the `--pull` command is not specified or set to `false` the pullOption used is `PullifMissing`. This causes the build to pull the image only if it is not present in local storage. It also will raise an error if the image is not found in the registry (or the registry is down), even if the image is present in local storage. If the `--pull` command IS specified or specified with an argument of `true`, the build will always pull the image from the registries. This uses the pullOption `PullAlways`. It also will raise an error if the image is not found in the registry, even if the image is present in local storage. These changes now brings the pull functionality for `podman build` into line with `docker build`. However, I consider this to be a breaking change. Previously if you did `podman build --pull`, `podman build` or `podman build --pull = true`, then the image would be pulled from the registry if there was not an image in local storage or if the image in the registry was newer than the one in local storage. An error would *NOT* be raised if there was not an image in the registry or the registry was down as long as there was a copy in the local storage. An error would be raised if the image could not be retrieved from both the registry and local storage. This is the PullOption `PullIfNewer`. I believe this also differs from what Buildah does at this time but I'm too beat to chase that down at the moment. Personally I'd like to use the `PullIfNewer` for at least `--pull` and `--pull=true` so that you don't get an error if the registry has a network hiccup and the image is already stored locally. But this differs from Docker. I'd like to post scrum about this at our next stand up to make sure we're all on the same page about the ramifications of this change. Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
* Fix the `--pull` flag to `podman build` to match DockerMatthew Heon2020-10-29
| | | | | | | | The behavior should be as follows: Unset, pull if missing by default, obey the `--pull-never` and `--pull-always` flags. Set to false, pull never. Set to true, pull always. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
* Fix pull method selectionTomSweeneyRedHat2020-10-21
| | | | | | | | | | | | | | | | | | | | | | | When using 'podman build --pull=true', the image was not pulled if the image being pulled was present locally, but a newer version was in the repository. It was only pulled if there was no image in local storage. In addition, the pull-never option was ignored. The line `if flags.Pull{` at line 244 was always returning true negating the default pullPolicy of PullNever. Reworked the algorthim for the selection process. Now PullIfNewer is set to the default, and then we set the pullPolicy appropriately based on the other flags passed in to this routine. As an FYI, logic run in the calling functions ensures that we have only one pull flag in the command. Addresses: #8024 Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
* Merge pull request #8034 from rhatdan/optionsOpenShift Merge Robot2020-10-21
|\ | | | | Switch help messages from using [flags] to [options]