Commit Graph

38 Commits

Author SHA1 Message Date
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
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
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
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
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
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
Tonis Tiigi
dc95525191 vendor: update fsutil to c3ed55f3b4
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-07-26 23:25:00 -07: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
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
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
Tonis Tiigi
0d17ac323e fileop: updates with new fsutil copy pkg
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-03-15 17:49:58 -07:00
Tonis Tiigi
7210bf6806 fileop: add chown support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-03-15 17:49:50 -07:00
Tonis Tiigi
4ffd79735b fileop: connect with contenthash
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-03-15 16:31:00 -07:00
Tonis Tiigi
81a5fa5a2e llbsolver: fileop implementation
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-03-15 16:22:35 -07:00
Tonis Tiigi
2be999ba52 fileop: llbsolver implementation
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-03-15 16:22:35 -07:00