Commit Graph

128 Commits

Author SHA1 Message Date
Matej Vašek 0c4d023822
Fix: inheritlabels=true if query param absent
The inheritlabels param must default to true if query param is absent.

Signed-off-by: Matej Vašek <matejvasek@gmail.com>
2025-04-25 19:17:00 +02:00
tomsweeneyredhat 10d768baaf Add inherit-labels option to Build API
Add the inherit-labels option to the build API and tweak the go.mod
after some unhappiness in my sandbox.

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2025-04-22 23:06:57 -04:00
Kir Kolyshkin 0f975f8526 ci: rm allow-unused from nolintlint settings
This was added by commit 84e42877a ("make lint: re-enable revive"),
making nolintlint became almost useless.

Remove the ungodly amount of unused nolint annotations.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
Kir Kolyshkin f4f2580b0d ci: remove stylecheck linter
It is to be merged into staticcheck linter in golangci-lint v2.0.0.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
Kir Kolyshkin 0dddc5e3c0 Apply De Morgan's law
This fixes a bunch of "QF1001: could apply De Morgan's law" warnings
from staticcheck linter.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
Gavin Lam dc564257a2
Add nohosts option to /build and /libpod/build
Signed-off-by: Gavin Lam <gavin.oss@tutamail.com>
2024-11-24 22:00:31 -05:00
Ed Santiago 043b82ef59
Fixes for vendoring Buildah
This commit was automatically cherry-picked
by buildah-vendor-treadmill v0.3
from the buildah vendor treadmill PR, #13808

  * Fix conflict caused by Ed's local-registry PR in buildah
  * Wire in "new" --retry and --retry-delay, these existed for longer
    but where non functional.

Signed-off-by: Ed Santiago <santiago@redhat.com>
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-10-02 18:38:38 +02:00
Daniel J Walsh eb396705c6
Remove containers/common/pkg/config from pkg/util
Probably has to wait for V6

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-09-06 07:45:04 -04:00
Paul Holzinger 942f789a88
set !remote build tags where needed
The new golangci-lint version 1.60.1 has problems with typecheck when
linting remote files. We have certain pakcages that should never be
inlcuded in remote but the typecheck tries to compile all of them but
this never works and it seems to ignore the exclude files we gave it.

To fix this the proper way is to mark all packages we only use locally
with !remote tags. This is a bit ugly but more correct. I also moved the
DecodeChanges() code around as it is called from the client so the
handles package which should only be remote doesn't really fit anyway.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-08-19 11:41:28 +02:00
tomsweeneyredhat b8a9b184af Add --compat-volumes option to build and farm build
Add the `--compat-volumes option from Buildah v1.37 into
Podman in preparation of Podman v5.2

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2024-07-30 18:26:13 -04:00
openshift-merge-bot[bot] 34d93d6502
Merge pull request #23321 from rhatdan/build
More information for podman --remote build and running out of space.
2024-07-24 20:48:52 +00:00
Daniel J Walsh 7768cf235e
Run codespell on source
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-07-23 07:28:23 -04:00
Daniel J Walsh 174190132c
More information for podman --remote build and running out of space.
Users do not realize that the entire context directory is being copied
into the podman machine when doing a podman --remote build.

Adding information about the context directory might help them
understand this.

Improves: https://github.com/containers/podman/issues/23287

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-07-22 08:13:09 -04:00
Paul Holzinger a3d5842746
build API: accept platform comma separated
The docker API uses only a single arg for platform and multiple
platforms are given as comma separated list.

Fixes #22071

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-06-25 18:48:59 +02:00
Giuseppe Scrivano bd00c6fef9
pkg/api: use fileutils.(Le|E)xists
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-04-19 09:52:14 +02:00
openshift-merge-bot[bot] 4f76c7a0c7
Merge pull request #22120 from garthy/dont_stage_tarfile
Dont save remote build context in temp file but stream and extract
2024-03-22 13:34:11 +00:00
Garth Bushell b2d0b92db2 Dont save remote context in temp file but stream and extract
Signed-off-by: Garth Bushell <garth@garthy.com>
2024-03-21 15:39:01 +00:00
Paul Holzinger 493179be45
fix remote build isolation when server runs as root
I am really not sure why the caller even should have the option to set
this. We should always use the correct isolation type based on the
privileges the server runs under never the client. podman-remote build
seems to send the default based on its local privs which was wrong as
well. To fix this I also changed the client to send the default if the
isolation flag is not set.

Fixes #22109

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-03-21 14:17:55 +01:00
Garth Bushell 3a9eef4bee Cleanup build scratch dir if remote end disconnects while passing the context
Signed-off-by: Garth Bushell <garth@garthy.com>
2024-03-15 10:39:23 +00:00
Matt Heon 72f1617fac Bump Go module to v5
Moving from Go module v4 to v5 prepares us for public releases.

Move done using gomove [1] as with the v3 and v4 moves.

[1] https://github.com/KSubedi/gomove

Signed-off-by: Matt Heon <mheon@redhat.com>
2024-02-08 09:35:39 -05:00
Philip Dubé 522934d5cf Replace strings.SplitN with strings.Cut
Cut is a cleaner & more performant api relative to SplitN(_, _, 2) added in go 1.18

Previously applied this refactoring to buildah:
https://github.com/containers/buildah/pull/5239

Signed-off-by: Philip Dubé <philip@peerdb.io>
2024-01-11 13:50:15 +00:00
Daniel J Walsh af0ef47f0c
Add status messages to podman --remote commit
Fixes: https://github.com/containers/podman/issues/19947

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-11-01 14:31:09 -04:00
Daniel J Walsh a1577ec7b0
podman build --remote URI Dockerfile shoud not be treated as file
Podman build --remote is translating https://path as if it was a file
path. This change will leave it as a URL so it can be parsed on the
server side.

Fixed: https://github.com/containers/podman/issues/20475

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-10-27 15:10:18 -04:00
Aditya R 5db3b753af
remote,build: wire unsetlabels
Signed-off-by: Aditya R <arajan@redhat.com>
2023-10-16 15:34:02 +05:30
Paul Holzinger 6b7f718b4b
wire in new buildah build options
Add support for --layerLabel.
Support for --cw is only added for the local client. I am not sure how
I would wire this over remote. The current code parse the options in
the frontend which hard codes the Tmpdir field to an incorrect value if
we would json marshal this vie remote API so it would not work in real
remote cases.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-09-14 11:21:00 +02:00
Matej Vasek f33b01b731 fix: Docker API compatible bool deserialization
In Docker anything but "", "0", "no", "false", "none" (ignoring case) is considered to be true.

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2023-08-14 15:09:14 +02:00
Matej Vasek 4cb2d48ca4 Revert "compat,build: pull must accept string"
This reverts commit 5b148a0a68.

Reverting to treating the `pull` query parameter as a boolean.
Because of deceiving Docker API documentation it was assumed that the
parameter is pull-policy, however that is not true. Docker does treat
`pull` as a boolean. What is interesting is that Docker indeed accepts
strings like `always` or `never` however Docekr both of these strings
treat as `true`, not as pull-policy. As matter of the fact it seems
there is no such a thing as pull-policy in Docker.

More context https://github.com/containers/podman/issues/17778#issuecomment-1673931925

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2023-08-14 15:01:53 +02:00
Daniel J Walsh 4108b37118
Support podman --remote when Containerfile is not in context directory
Fixes: https://github.com/containers/podman/issues/18239

[NO NEW TESTS NEEDED]

@test "podman build -f test" in test/system/070-build.bats

Will test this.  This was passing when run on a local system since
the remote end was using the clients path to read the Containerfile
The issue is it would not work in a podman machine since the
Containerfile would/should be a different path.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-05-22 11:58:36 -04:00
Aditya R 5b148a0a68
compat,build: pull must accept string
`pull` parameter in `build` must accept string just like docker.

Ref: https://docs.docker.com/engine/api/v1.42/#tag/Image/operation/ImageBuild

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

Signed-off-by: Aditya R <arajan@redhat.com>
2023-05-16 23:04:09 +05:30
Valentin Rothberg 1f3ae8a4fb system service: do not close Body
The standard lib states that server handlers don't need to close the
body, so let's not do that to avoid any unforeseen side effect.

[NO TESTS NEEDED] - existing tests should suffice.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-04-04 15:47:10 +02:00
OpenShift Merge Robot c8eeab21cf
Merge pull request #16315 from flouthoc/remote-ignore-symlink
remote,build: ignore if `.containerignore` or `.dockerignore` is a symlink outside of buildContext
2023-03-28 23:23:07 +02:00
Erik Sjölund 83a0e97ab8 Add missing return after errors
Add missing return after utils.Error(),
utils.InternalServerError(), utils.BadRequest().

[NO NEW TESTS NEEDED]

Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
2023-02-06 20:32:06 +01:00
Aditya R 70e8f6243a
remote,build: error if containerignore is symlink
Drop support for remote use-cases when `.containerignore` or
`.dockerignore` is a symlink pointing to arbitrary location on host.

Signed-off-by: Aditya R <arajan@redhat.com>
2023-01-26 16:11:51 +05:30
Daniel J Walsh 8f78865151
Add support for podman build --group-add
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-01-19 10:42:10 -05:00
Aditya R 987c8e3a78
vendor: bump to buildah ca578b290144 and use new cache API
Bump to buildah ca578b290144 and use new `cacheTo` and `cacheFrom` API.

[NO NEW TESTS NEEDED]
[NO TESTS NEEDED]

Signed-off-by: Aditya R <arajan@redhat.com>
2022-12-20 17:13:59 +05:30
Paul Holzinger 9f6cf50d52
podman-remote build add --volume support
Just like podman-remote run users should still be able to set volumes,
of course the source must be on the server machine but this is already
the case for podman machine for example.

Fixes #16694

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-12-08 17:10:46 +01:00
Daniel J Walsh f17479c711
Run codespell on code
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-11-28 15:13:43 -05:00
Aditya R c7073b5fc5
compat,build: handle docker's preconfigured cacheTo,cacheFrom
Docker's newer clients popuates `cacheFrom` and `cacheTo` parameter
by default as empty array for all commands but buildah's design of
distributed cache expects this to be a repo not image hence parse
only the first populated repo and igore if empty array.

Signed-off-by: Aditya R <arajan@redhat.com>
2022-11-14 22:08:09 +05:30
Jake Torrance cdb00332da Docker compat build api - make sure only one line appears per flush
Closes #16360

Signed-off-by: Jake Torrance <jake.torrance@oracle.com>
Signed-off-by: Jake Torrance <jaket1234@hotmail.com>
2022-11-06 09:43:34 +00:00
Ed Santiago f5e83f6849
Fixup Buildah merge
Changes since 2022-09-09:
 - man page: add --skip-unused-stages (buildah 4249)
 - man page: bring in new Note for --cache-ttl (4248)
 - system tests: de-stutter (4205)

 - (internal): in skip() applier: escape asterisk, otherwise
   the "bud with --dns* flags" sed expression never applies.

Signed-off-by: Ed Santiago <santiago@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-09-23 14:13:12 -04:00
Chris Evich d968f3fe09
Replace deprecated ioutil
Package `io/ioutil` was deprecated in golang 1.16, preventing podman from
building under Fedora 37.  Fortunately, functionality identical
replacements are provided by the packages `io` and `os`.  Replace all
usage of all `io/ioutil` symbols with appropriate substitutions
according to the golang docs.

Signed-off-by: Chris Evich <cevich@redhat.com>
2022-09-20 15:34:27 -04: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
Aditya R e00272cd99
remote: fix implementation of build with --userns=auto for API
`podman-remote` and Libpod API does not supports build with
`--userns=auto` since `IDMappingOptions` were not implemented for API
and bindings, following PR implements passing `IDMappingOptions` via
bindings to API.

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

Signed-off-by: Aditya R <arajan@redhat.com>
2022-08-26 16:53:40 +05:30
Vladimir Kochnev e48681e600
Use request Context() in API handlers
Request object has its own context which must be used during a request
lifetime instead of just context.Background()

[NO NEW TESTS NEEDED]

Signed-off-by: Vladimir Kochnev <hashtable@yandex.ru>
2022-08-18 23:48:43 +03: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
Vladimir Kochnev 52a4642edd
Set TLSVerify=true by default for API endpoints
Option defaults in API must be the same as in CLI.

```
% podman image push --help
% podman image pull --help
% podman manifest push --help
% podman image search --help
```

All of these CLI commands them have --tls-verify=true by default:
```
--tls-verify  require HTTPS and verify certificates when accessing the registry (default true)
```

As for `podman image build`, it doesn't have any means to control
`tlsVerify` parameter but it must be true by default.

Signed-off-by: Vladimir Kochnev <hashtable@yandex.ru>
2022-07-26 02:07:56 +03:00
Sascha Grunert a46f798831
pkg: 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.

[NO NEW TESTS NEEDED]

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2022-07-08 08:54:47 +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
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
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