Commit Graph

55 Commits

Author SHA1 Message Date
Marat Radchenko
0a5a80cfec Remove pre-Go 1.17 build tags
Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
2024-11-21 10:58:27 +03:00
Tonis Tiigi
630357111a vendor: update fsutil to 397af530
Brings in fix for incorrect timestamps for parent destination directories.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-10-28 10:39:39 -07:00
Tonis Tiigi
25632fb074 client: allow non-octal chmod config for fileop.copy
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-10-01 12:52:38 -07:00
Jonathan A. Sternberg
1a3fc0aa15 protobuf: remove gogoproto
Remove gogoproto in favor of the standard protobuf compiler. This
removes any nonstandard extensions that were part of gogoproto such as
the custom types.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2024-09-26 12:57:45 -05:00
Tonis Tiigi
304b6ecedc ops: improve error messages from fileop
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-07-22 15:14:05 -07:00
Tonis Tiigi
4103099d94 ensure context.WithoutCancel in defer funcs
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-06-12 19:18:32 -07:00
Akihiro Suda
5a19fb4759 Merge pull request #4829 from tonistiigi/gopls-linters
add extra linters from gopls
2024-04-12 06:25:34 +09:00
Anthony Nandaa
018155fa68 fix: use unix path separator since path already normalized
In the case for Windows, this line at
frontend/dockerfile/dockerfile2llb/convert.go#L1142
```go
dest += string(filepath.Separator)
```
was adding the `\\` to a path that is already normalized
to unix-format, hence ending up with dest paths like
`/\\` for `C:\\` and `/test\\` for `C:\\test\\`.

the src paths are well normalized too at ~L1290.

This change removes the block of code and instead
does the "/" appending using the keepSlash logic
that is in system.NormalizePath called in
pathRelativeToWorkingDir() function before.

fixes #4696

Signed-off-by: Anthony Nandaa <profnandaa@gmail.com>
2024-04-11 18:25:10 +03:00
Tonis Tiigi
1f9988911f lint: unusedparams fixes
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-04-09 07:23:16 -07:00
Erik Sipsma
7bc06cb0b7 add support for AlwaysReplaceExistingDestPaths in llb copy
Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2024-04-02 12:11:06 -07:00
Tonis Tiigi
a7d1ccab27 file: fix idmap passed to unpack when userns enabled
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-02-28 17:01:17 -08:00
Tonis Tiigi
e91834d3c8 file: use best-effort xattr behavior on unpacking
Default changed in Moby25 archive package. Setting this
bool restores the previous behavior.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-02-28 16:34:28 -08:00
Gabriel Adrian Samfira
2585dd955d Fix linting issue
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-10-17 15:06:41 +03:00
Gabriel Adrian Samfira
2f3bda8ecb Use snapshot.Mountable as an argument type to readUser
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-10-17 15:06:41 +03:00
Gabriel Adrian Samfira
fe3ca93c09 Move readUser code outside of the file package
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-10-17 15:06:41 +03:00
Gabriel Adrian Samfira
8a369a9eba Remove the need for an exported Executor field
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-10-17 15:06:41 +03:00
Gabriel Adrian Samfira
b8c7bd5f5a Implement readUser on Windows
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-10-17 15:06:40 +03:00
Tõnis Tiigi
4376f3861b Merge pull request #4051 from jake-ciolek/with-allow-not-found-bug
file: Fix incorrect handling of non-existent files in llbsolver's rmPath
2023-08-23 17:49:34 -07:00
Justin Chadwell
3ac85c9daf chore: clean up file copy logic backend logic
This avoids duplication of the AttemptUnpackDockerCompatability
handling.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2023-07-26 11:27:34 +01:00
Jakub Ciolek
ce439567a4 file: Fix incorrect handling of non-existent files in llbsolver's rmPath
The os.RemoveAll() call returns nil if the path doesn't exist. When the
rmPath function is called with allowNotFound set to false, it doesn't change the
behaviour of the function.

Change the code so if allowNotFound is set to false, we first check
whether the file exists. If it doesn't exist, return an error.

Add tests for three relevant cases.

Signed-off-by: Jakub Ciolek <jakub@ciolek.dev>
2023-07-23 15:28:09 +02:00
Gabriel Adrian Samfira
f1657ecc14 Fix various nits
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-07-10 22:58:36 +03:00
Gabriel Adrian Samfira
b29ec0b04e Remove nil pointer check and extra NormalizePath
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-07-03 08:11:52 -07:00
Gabriel Adrian Samfira
686a84b428 Handle file paths base on target platform
This change properly handles paths on different platforms. In short, this
change checks the target platform we're building an image for and applies
normalization steps to make sure the file paths are valid. This makes buildkit
properly handle paths on both *nix systems and on Windows.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-07-03 08:11:49 -07:00
Morlay
7e00fe7d9c feat: fileop description could be set from vertex name
Signed-off-by: Morlay <morlay.null@gmail.com>
2022-07-20 15:47:29 +08:00
Sebastiaan van Stijn
21e9e9641e Remove uses of deprecated io/ioutil
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-10 00:57:07 +01:00
genglu.gl
13665367df Close readclosers returned by DecompressStream
Signed-off-by: genglu.gl <luzigeng32@163.com>
2022-02-11 14:53:14 +08:00
Erik Sipsma
43a74261b3 Remove symlink, not target, in FileOp.Rm.
Before this change, if the path provided to FileOp.Rm was a symlink then
the target of the symlink would be removed instead of the symlink
itself. Now, the symlink will be removed instead. However, any symlinks
present in the parent dirs of the specified path will still be resolved
before calling os.Remove; this change only results in the base of the
specified path not being followed.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2021-11-18 12:44:12 -08:00
CrazyMax
54b8ff2fc8 go fmt: add //go:build
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-10-28 13:26:43 +02:00
Erik Sipsma
a9f1980ebb Refactor cache metadata interface.
There are a few goals with this refactor:
1. Remove external access to fields that no longer make sense and/or
   won't make sense soon due to other potential changes. For example,
   there can now be multiple blobs associated with a ref (for different
   compression types), so the fact that you could access the "Blob"
   field from the Info method on Ref incorrectly implied there was just
   a single blob for the ref. This is on top of the fact that there is
   no need for external access to blob digests.
2. Centralize use of cache metadata inside the cache package.
   Previously, many parts of the code outside the cache package could
   obtain the bolt storage item for any ref and read/write it directly.
   This made it hard to understand what fields are used and when. Now,
   the Metadata method has been removed from the Ref interface and
   replaced with getters+setters for metadata fields we want to expose
   outside the package, which makes it much easier to track and
   understand. Similar changes have been made to the metadata search
   interface.
3. Use a consistent getter+setter interface for metadata, replacing
   the mix of interfaces like Metadata(), Size(), Info() and other
   inconsistencies.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2021-08-25 19:15:09 +00:00
Tõnis Tiigi
d3cd28f59f Merge pull request #2249 from claudiubelu/fixes-missing-passwd-file
Skips getting UID/GUID if passwd/group file is not found
2021-07-13 13:57:11 -07:00
Claudiu Belu
449d010a72 Skips getting UID/GUID if passwd/group file is not found
When running a WORKDIR instruction, buildkit will create that folder
and chown it to the currently set user. For this, it will try to read
the /etc/passwd file to get the proper UID, and if that user is not
found in the file, the root user will be considered as the owner.

However, Windows image do not have that file, which will result in
an error while building the image. We can consider not finding
the /etc/passwd file as the same as not finding the user in the file,
which would solve this issue.

Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
2021-07-13 19:06:33 +00:00
Morlay
18b49fd7dc refactor to use util/bklog instead of using logurs directly
Signed-off-by: Morlay <morlay.null@gmail.com>
2021-07-13 11:42:31 +08:00
Erik Sipsma
f3604724d4 Fix ref leak if fileop ref fails to mount.
Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2021-07-01 23:38:13 +00:00
Aaron Lehmann
7660af2f1d Add IncludePatterns and ExcludePatterns options for Copy
Allow include and exclude patterns to be specified for the "copy" op,
similarly to "local".

Depends on https://github.com/tonistiigi/fsutil/pull/101

Signed-off-by: Aaron Lehmann <alehmann@netflix.com>
2021-05-26 13:48:03 -07:00
Sebastiaan van Stijn
292685db37 solve: remove duplicate filepath.Join
I saw these, and there was no comment in the code explaining if there was a reason
for this; these were added in 2be999ba52, but couldn't
find a mention about these particular lines in the review comments, and I couldn't
think of a special reason for it ':-)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-03-29 13:24:55 +02:00
Edgar Lee
7e1dc9bec1 Refactor to file action indexed outputs
Signed-off-by: Edgar Lee <edgarl@netflix.com>
2020-11-13 22:05:13 -08:00
Tonis Tiigi
e3b05289d8 add session injection to remote loading
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-11-02 22:20:44 -08:00
Tonis Tiigi
dc95525191 vendor: update fsutil to c3ed55f3b4
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-07-26 23:25:00 -07:00
Paul "TBBle" Hampson
3c96d0b863 Support not chowning files on all platforms
Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
2020-07-23 03:18:30 +10:00
Chenbin
b7fd382230 add chmod in COPY and ADD command
Signed-off-by: Chenbin <chen.bin11@zte.com.cn>
2020-06-10 21:37:46 +08:00
Tonis Tiigi
625f6ecc82 file: fix double-remap of old uid value
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-05-08 11:33:01 -07:00
Tonis Tiigi
37b8832d00 upgrade errors checks to Is()
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-04-18 22:53:38 -07:00
Tonis Tiigi
e0e29722e2 file: fix compilation on windows
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-01-30 20:21:40 -08:00
Tonis Tiigi
469e7552d0 fileop: keep correct user for parent dir on userns
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-01-28 11:36:42 -08:00
Edgar Lee
c122adacb5 Implement file action remove for wildcards
Signed-off-by: Edgar Lee <edgarl@netflix.com>
2019-10-30 14:25:00 -07:00
Tonis Tiigi
a0dead0809 fix possible double release on mountable
Refactor the interface to avoid such issues in the future.

BuildKit own mounts are stateless and not affected but
a different mountable implementation could get confused.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-08-16 08:03:16 -07:00
Tonis Tiigi
17300c1046 file: avoid setting implicit root on idmap
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-06-10 16:34:43 -07:00
Tonis Tiigi
9b9ff6e4b5 revert userns mapping functions
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-04-02 18:26:06 -07:00
Tonis Tiigi
4a12fe526a fileop: userns support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-04-02 18:26:06 -07:00
Tibor Vass
dc387eda7f solver: separate linux-only files
Signed-off-by: Tibor Vass <tibor@docker.com>
2019-03-21 03:53:50 +00:00