2839 Commits

Author SHA1 Message Date
CrazyMax
48d6a3927a
Merge pull request #2867 from crazy-max/v0.19_backport_entitlement-path-fix
[v0.19 backport] bake: change evaluation of entitlement paths
v0.19.3
2024-12-17 12:25:19 +01:00
Tonis Tiigi
2bd4aefb9b
add additional test coverage for FS entitlement paths
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-12-17 10:16:56 +01:00
Tonis Tiigi
f1b3cf74eb
bake: change evaluation of entitlement paths
Currently, to compare the local path used by bake against the paths allowed
by entitlements, symlinks were evaluated for path normalization so that the
local path used by build was allowed to not exist while the path allowed by
entitlement needed to exist. If the path used by the build did not exist,
then the deepest existing parent path was used instead. This was concistent
with entitlement rules as that parent path would be the actual path access
is needed.

This raised an issue with `--set` if one provides a non-existing path as
an argument, as these paths are supposed to be allowed automatically. With
the above restrictions set to allowed paths, this meant the build would fail
as it can't grant entitlement to the non-existing paths.

This changes the evaluation logic for allowing paths so that they do not
need to exist. If such a case appears, then the path is evaluated to the
last component that exists, and then the rest of the path is appended as is.

This means that for example, if `output = /tmp/out/foo/` is set in HCL
and `/tmp` is the last component that exists then invoking build with
`--allow fs.write=/tmp/out/foo` will not fail with stat error anymore
but will fail in entitlements validation as build would also need to
write `/tmp/out` that is not inside the allowed `/tmp/out/foo` path. The
same would apply to `--set` as well so that if it points to
a non-existing path, then an additional `--allow` rule is needed
providing access to writing to the last existing component of that path.
This may or may not be unexpected.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-12-17 10:15:21 +01:00
Tõnis Tiigi
62d486d5a5
Merge pull request #2861 from tonistiigi/v0.19-set-empty-eof
[v0.19] bake: remove empty values set by --set
2024-12-16 10:16:22 -08:00
CrazyMax
afc9cebb48
bake: test empty override
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-12-16 18:35:14 +01:00
Tonis Tiigi
9a9dd4e87e
[v0.19] bake: remove empty values set by --set
These parser functions are called for `--set` to
resolve entitlement paths that would be automatically added
and will fail for empty value.

The empty values would already be ignored but in v0.19 is
done after merging the `--set` values and then calling
parse again.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-12-16 09:12:36 -08:00
CrazyMax
85acd30ed7
Merge pull request #2862 from crazy-max/v0.19_pick-xx-update
[v0.19 backport] update xx to v1.6.1
2024-12-16 13:20:09 +01:00
Tonis Tiigi
90393e68a4
update xx to v1.6.1
Fixes compatibility issues with Alpine 3.21

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-12-16 10:39:49 +01:00
Tõnis Tiigi
1fc5647dc2
Merge pull request #2846 from tonistiigi/v0.19.2-picks
[v0.19] v0.19.2 cherry-picks
v0.19.2
2024-12-06 14:45:47 -08:00
Tonis Tiigi
b2c0c26c26
bake: allow entitlements from overrides automatically
If override specifies a path, mark it automatically allowed
so there is no need to use duplicate flags for defining the
same feature.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit dd596d654213e1ecaa6388e2d96846e784c12e9f)
2024-12-06 14:15:46 -08:00
Tonis Tiigi
c30db6a955
bake: fix entitlements path checks for local outputs
Previous check based on dest attributes was not correct
as the attributes already get converted before validation happens.

Because the local path is not preserved for single-file
outputs and gets replaced by io.Writer, a temporary array variable
was needed. This value should instead be added to ExportEntry
struct in BuildKit in future revision.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit c6e403ad7f239409a28355be9a494805d895759b)
2024-12-06 14:02:04 -08:00
Tõnis Tiigi
5113f9ea89
Merge pull request #2824 from jsternberg/bake-revert-composable-attributes
[v0.19] revert: "bake: initial set of composable bake attributes"
v0.19.1
2024-11-27 09:37:55 -08:00
CrazyMax
8b029626f3
bake: additional test for empty variable
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-11-27 18:28:43 +01:00
Jonathan A. Sternberg
cd017e98ed
revert: "bake: initial set of composable bake attributes"
This reverts commit 3ccbb88e6ad1a45f8ad8ebdfa91b4f524e3e6899.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2024-11-27 09:39:57 -06:00
Tõnis Tiigi
71c7889719
Merge pull request #2821 from tonistiigi/update-buildkit-v0.18.0
vendor: update buildkit to v0.18.0
v0.19.0
2024-11-26 14:49:31 -08:00
Tonis Tiigi
a3418e0178
vendor: update buildkit to v0.18.0
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-11-26 13:57:25 -08:00
Tõnis Tiigi
6a1cf78879
Merge pull request #2818 from tonistiigi/vendor-buildkit-v0.18.0-rc2
vendor: update buildkit to v0.18.0-rc2
v0.19.0-rc2
2024-11-25 17:52:46 -08:00
Tonis Tiigi
ec1f712328
vendor: update buildkit to v0.18.0-rc2
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-11-25 17:42:30 -08:00
CrazyMax
5ce6597c07
Merge pull request #2812 from crazy-max/bake-win-fs-ent
bake: add wildcard to fs entitlements to allow any paths
2024-11-25 20:29:14 +01:00
CrazyMax
9c75071793
bake: add wildcard to fs entitlements to allow any paths
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-11-25 20:13:27 +01:00
Tõnis Tiigi
d612139b19
Merge pull request #2811 from crazy-max/update-buildkit
dockerfile: update buildkit to v0.17.2
2024-11-25 10:11:09 -08:00
Tõnis Tiigi
42f7898c53
Merge pull request #2815 from tonistiigi/entitlements-symlink-tests
bake: fix entitlement test when running from symlink temp
2024-11-25 10:08:19 -08:00
Tonis Tiigi
3148c098a2
bake: remove unnecessary GetLongPathName calls
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-11-25 08:26:02 -08:00
Tonis Tiigi
f95d574f94
bake: fix entitlement test when running from symlink temp
As the paths returned by validator have the symlinks resolved,
the test needs to resolve the symlinks also in the expected
values. Previously this would fail if t.TempDir() or os.GetWd()
returned a path that contained a symlink.

The issue was purely in the test and not in the entitlements
validation logic.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-11-25 00:03:54 -08:00
CrazyMax
60822781be
ci: update buildkit to v0.17.2
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-11-22 13:00:07 +01:00
CrazyMax
4c83475703
dockerfile: update buildkit to v0.17.2
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-11-22 11:27:33 +01:00
Tõnis Tiigi
17eff25fe5
Merge pull request #2807 from tonistiigi/buildkit-v0.18.0-rc1
vendor: update buildkit to v0.18.0-rc1
v0.19.0-rc1
2024-11-21 14:29:29 -08:00
Tõnis Tiigi
9c8ffb77d6
Merge pull request #2806 from tonistiigi/vendor-compose-v2.4.4
vendor: update compose to v2.4.4
2024-11-21 14:29:18 -08:00
Tonis Tiigi
13a426fca6
vendor: update buildkit to v0.18.0-rc1
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-11-21 12:57:27 -08:00
Tõnis Tiigi
1a039115bc
Merge pull request #2758 from jsternberg/bake-composable-attributes
bake: initial set of composable bake attributes
2024-11-21 12:54:54 -08:00
Tonis Tiigi
07d58782b8
vendor: update compose to v2.4.4
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-11-21 10:32:02 -08:00
Jonathan A. Sternberg
3ccbb88e6a
bake: initial set of composable bake attributes
This allows using either the csv syntax or object syntax to specify
certain attributes.

This applies to the following fields:
- output
- cache-from
- cache-to
- secret
- ssh

There are still some remaining fields to translate. Specifically
ulimits, annotations, and attest.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2024-11-21 12:31:11 -06:00
Tõnis Tiigi
a34c641bc4
Merge pull request #2796 from tonistiigi/fs-entitlements
bake: add filesystem entitlements support
2024-11-21 09:51:49 -08:00
CrazyMax
f10be074b4
bake: handle root evaluation with available drives for windows entitlement
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-11-21 14:05:13 +01:00
CrazyMax
9f429965c0
bake: windows entitlement path fixes take 2
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-11-21 14:05:12 +01:00
CrazyMax
f3929447d7
fix lint issues
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-11-21 14:05:12 +01:00
Tonis Tiigi
615f4f6759
bake: windows entitlement path fixes
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-11-21 14:05:12 +01:00
Tonis Tiigi
9a7b028bab
bake: add fs entitlements for context paths
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-11-21 14:05:11 +01:00
Tonis Tiigi
1af4f05ba4
bake: add filesystem entitlements support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-11-21 14:05:11 +01:00
CrazyMax
4b5d78db9b
Merge pull request #2801 from tonistiigi/enable-testifylint
lint: enable testifylint
2024-11-21 13:57:54 +01:00
Tonis Tiigi
d2c512a95b
lint: enable testifylint
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-11-20 10:53:11 -08:00
Tõnis Tiigi
5937ba0e00
Merge pull request #2307 from crazy-max/test-docker-multi-ver
tests: handle multiple docker versions
2024-11-20 09:53:57 -08:00
Tõnis Tiigi
21fb026aa3
Merge pull request #2775 from crazy-max/openbsd
build openbsd
2024-11-20 09:49:49 -08:00
CrazyMax
bc45641086
build openbsd
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-11-20 11:42:10 +01:00
CrazyMax
96689e5d05
Merge pull request #2782 from crazy-max/go-1.23
update to go 1.23
2024-11-20 11:40:54 +01:00
CrazyMax
50a8f11f0f
dockerfile: missing xx update to 1.5.0
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-11-20 11:20:18 +01:00
CrazyMax
11cf38bd97
update to go 1.23
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-11-20 11:20:18 +01:00
CrazyMax
300d56b3ff
update gopls and golangci-lint
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-11-20 11:20:18 +01:00
CrazyMax
e04da86aca
fix golangci-lint issues
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-11-20 11:20:17 +01:00
Akihiro Suda
9f1fc99018
Merge pull request #2797 from crazy-max/ci-macos-14
ci: update runner to macos-14
2024-11-20 18:16:59 +09:00