Skip to content

Commit cc5db24

Browse files
authored
Merge pull request #21522 from docker/published-update
publish updates from main
2 parents c13e563 + 380ca6c commit cc5db24

File tree

10 files changed

+231
-35
lines changed

10 files changed

+231
-35
lines changed

_vendor/github.com/docker/buildx/docs/bake-reference.md

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

_vendor/github.com/moby/buildkit/frontend/dockerfile/docs/reference.md

Lines changed: 2 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

_vendor/modules.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# github.com/moby/moby v27.3.1+incompatible
2-
# github.com/moby/buildkit v0.17.1-0.20241031124041-354f2d13c905
3-
# github.com/docker/buildx v0.18.0
4-
# github.com/docker/cli v27.3.2-0.20241107125754-eb986ae71b0c+incompatible
2+
# github.com/moby/buildkit v0.18.0
3+
# github.com/docker/buildx v0.19.1
4+
# github.com/docker/cli v27.4.0-rc.2+incompatible
55
# github.com/docker/compose/v2 v2.30.3
66
# github.com/docker/scout-cli v1.15.0

content/guides/compose-bake/index.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,23 +172,19 @@ represents a single build.
172172
"result": {
173173
"context": "result",
174174
"dockerfile": "Dockerfile",
175-
"network": ""
176175
},
177176
"seed": {
178177
"context": "seed-data",
179178
"dockerfile": "Dockerfile",
180-
"network": ""
181179
},
182180
"vote": {
183181
"context": "vote",
184182
"dockerfile": "Dockerfile",
185183
"target": "dev",
186-
"network": ""
187184
},
188185
"worker": {
189186
"context": "worker",
190187
"dockerfile": "Dockerfile",
191-
"network": ""
192188
}
193189
}
194190
}

content/manuals/build/bake/overrides.md

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -288,43 +288,63 @@ which is the short commit hash generated by `git rev-parse --short HEAD`.
288288
Overriding non-string variables with environment variables is supported. Values
289289
passed as environment variables are coerced into suitable types first.
290290

291-
The following example defines a `PORT` variable with a default value of `8080`.
292-
The `default` target uses a [ternary operator](expressions.md#ternary-operators)
293-
to set the `PORT` variable to the value of the environment variable `PORT`
294-
if it is greater than `1024`, otherwise it uses the default value.
295-
296-
In this case, the `PORT` variable is coerced to an integer before the ternary
297-
operator is evaluated.
291+
The following example defines a `PORT` variable. The `backend` target uses the
292+
`PORT` variable as-is, and the `frontend` target uses the value of `PORT`
293+
incremented by one.
298294

299295
```hcl
300-
default_port = 8080
301-
302296
variable "PORT" {
303-
default = default_port
297+
default = 3000
304298
}
305299
306-
target "default" {
300+
group "default" {
301+
targets = ["backend", "frontend"]
302+
}
303+
304+
target "backend" {
307305
args = {
308-
PORT = PORT > 1024 ? PORT : default_port
306+
PORT = PORT
307+
}
308+
}
309+
310+
target "frontend" {
311+
args = {
312+
PORT = add(PORT, 1)
309313
}
310314
}
311315
```
312316

313-
Attempting to set the `PORT` variable with a value less than `1024` will result
314-
in the default value being used.
317+
Overriding `PORT` using an environment variable will first coerce the value
318+
into the expected type, an integer, before the expression in the `frontend`
319+
target runs.
315320

316321
```console
317-
$ PORT=80 docker buildx bake --print
322+
$ PORT=7070 docker buildx bake --print
318323
```
319324

320325
```json
321326
{
322-
"target": {
327+
"group": {
323328
"default": {
329+
"targets": [
330+
"backend",
331+
"frontend"
332+
]
333+
}
334+
},
335+
"target": {
336+
"backend": {
337+
"context": ".",
338+
"dockerfile": "Dockerfile",
339+
"args": {
340+
"PORT": "7070"
341+
}
342+
},
343+
"frontend": {
324344
"context": ".",
325345
"dockerfile": "Dockerfile",
326346
"args": {
327-
"PORT": "8080"
347+
"PORT": "7071"
328348
}
329349
}
330350
}

content/manuals/build/bake/variables.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,94 @@ $ docker buildx bake --print
7878
}
7979
```
8080

81+
## Validating variables
82+
83+
To verify that the value of a variable conforms to an expected type, value
84+
range, or other condition, you can define custom validation rules using the
85+
`validation` block.
86+
87+
In the following example, validation is used to enforce a numeric constraint on
88+
a variable value; the `PORT` variable must be 1024 or higher.
89+
90+
```hcl
91+
# Define a variable `PORT` with a default value and a validation rule
92+
variable "PORT" {
93+
default = 3000 # Default value assigned to `PORT`
94+
95+
# Validation block to ensure `PORT` is a valid number within the acceptable range
96+
validation {
97+
condition = PORT >= 1024 # Ensure `PORT` is at least 1024
98+
error_message = "The variable 'PORT' must be 1024 or higher." # Error message for invalid values
99+
}
100+
}
101+
```
102+
103+
If the `condition` expression evaluates to `false`, the variable value is
104+
considered invalid, whereby the build invocation fails and `error_message` is
105+
emitted. For example, if `PORT=443`, the condition evaluates to `false`, and
106+
the error is raised.
107+
108+
Values are coerced into the expected type before the validation is set. This
109+
ensures that any overrides set with environment variables work as expected.
110+
111+
### Validate multiple conditions
112+
113+
To evaluate more than one condition, define multiple `validation` blocks for
114+
the variable. All conditions must be `true`.
115+
116+
Here’s an example:
117+
118+
```hcl
119+
# Define a variable `VAR` with multiple validation rules
120+
variable "VAR" {
121+
# First validation block: Ensure the variable is not empty
122+
validation {
123+
condition = VAR != ""
124+
error_message = "The variable 'VAR' must not be empty."
125+
}
126+
127+
# Second validation block: Ensure the value contains only alphanumeric characters
128+
validation {
129+
# VAR and the regex match must be identical:
130+
condition = VAR == regex("[a-zA-Z0-9]+", VAR)
131+
error_message = "The variable 'VAR' can only contain letters and numbers."
132+
}
133+
}
134+
```
135+
136+
This example enforces:
137+
138+
- The variable must not be empty.
139+
- The variable must match a specific character set.
140+
141+
For invalid inputs like `VAR="hello@world"`, the validation would fail.
142+
143+
### Validating variable dependencies
144+
145+
You can reference other Bake variables in your condition expression, enabling
146+
validations that enforce dependencies between variables. This ensures that
147+
dependent variables are set correctly before proceeding.
148+
149+
Here’s an example:
150+
151+
```hcl
152+
# Define a variable `FOO`
153+
variable "FOO" {}
154+
155+
# Define a variable `BAR` with a validation rule that references `FOO`
156+
variable "BAR" {
157+
# Validation block to ensure `FOO` is set if `BAR` is used
158+
validation {
159+
condition = FOO != "" # Check if `FOO` is not an empty string
160+
error_message = "The variable 'BAR' requires 'FOO' to be set."
161+
}
162+
}
163+
```
164+
165+
This configuration ensures that the `BAR` variable can only be used if `FOO`
166+
has been assigned a non-empty value. Attempting to build without setting `FOO`
167+
will trigger the validation error.
168+
81169
## Escape variable interpolation
82170

83171
If you want to bypass variable interpolation when parsing the Bake definition,

content/manuals/build/buildkit/dockerfile-release-notes.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,21 @@ issues, and bug fixes in [Dockerfile reference](/reference/dockerfile.md).
1313

1414
For usage, see the [Dockerfile frontend syntax](frontend.md) page.
1515

16+
## 1.12.0
17+
18+
{{< release-date date="2024-11-27" >}}
19+
20+
The full release note for this release is available
21+
[on GitHub](https://github.com/moby/buildkit/releases/tag/dockerfile%2F1.12.0).
22+
23+
```dockerfile
24+
# syntax=docker/dockerfile:1.12.0
25+
```
26+
27+
- Fix incorrect description in History line of image configuration with multiple `ARG` instructions. [moby/buildkit#5508]
28+
29+
[moby/buildkit#5508]: https://github.com/moby/buildkit/pull/5508
30+
1631
## 1.11.1
1732

1833
{{< release-date date="2024-11-08" >}}

content/manuals/build/release-notes.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,70 @@ toc_max: 2
1010
This page contains information about the new features, improvements, and bug
1111
fixes in [Docker Buildx](https://github.com/docker/buildx).
1212

13+
## 0.19.1
14+
15+
{{< release-date date="2024-11-27" >}}
16+
17+
The full release note for this release is available
18+
[on GitHub](https://github.com/docker/buildx/releases/tag/v0.19.1).
19+
20+
### Bug fixes
21+
22+
- Reverted the change in v0.19.0 that added new object notation for the fields
23+
that previously required CSV strings in Bake definition. This enhancement was
24+
reverted because of backwards incompatibility issues were discovered in some
25+
edge cases. This feature has now been postponed to the v0.20.0 release.
26+
[docker/buildx#2824](https://github.com/docker/buildx/pull/2824)
27+
28+
## 0.19.0
29+
30+
{{< release-date date="2024-11-27" >}}
31+
32+
The full release note for this release is available
33+
[on GitHub](https://github.com/docker/buildx/releases/tag/v0.19.0).
34+
35+
### New
36+
37+
- Bake now requires you to allow filesystem entitlements when your build needs
38+
to read or write files outside of your current working directory.
39+
[docker/buildx#2796](https://github.com/docker/buildx/pull/2796),
40+
[docker/buildx#2812](https://github.com/docker/buildx/pull/2812).
41+
42+
To allow filesystem entitlements, use the `--allow fs.read=<path>` flag for
43+
the `docker buildx bake` command.
44+
45+
This feature currently only reports a warning when using a local Bake
46+
definition, but will start to produce an error starting from the v0.20
47+
release. To enable the error in the current release, you can set
48+
`BUILDX_BAKE_ENTITLEMENTS_FS=1`.
49+
50+
### Enhancements
51+
52+
- Bake definition now supports new object notation for the fields that previously required CSV strings as inputs. [docker/buildx#2758](https://github.com/docker/buildx/pull/2758)
53+
54+
> [!NOTE]
55+
> This enhancement was reverted in [v0.19.1](#0191) due to a bug.
56+
57+
- Bake definition now allows defining validation conditions to variables. [docker/buildx#2794](https://github.com/docker/buildx/pull/2794)
58+
- Metadata file values can now contain JSON array values. [docker/buildx#2777](https://github.com/docker/buildx/pull/2777)
59+
- Improved error messages when using an incorrect format for labels. [docker/buildx#2778](https://github.com/docker/buildx/pull/2778)
60+
- FreeBSD and OpenBSD artifacts are now included in the release. [docker/buildx#2774](https://github.com/docker/buildx/pull/2774), [docker/buildx#2775](https://github.com/docker/buildx/pull/2775), [docker/buildx#2781](https://github.com/docker/buildx/pull/2781)
61+
62+
### Bug fixes
63+
64+
- Fixed an issue with printing Bake definitions containing empty Compose networks. [docker/buildx#2790](https://github.com/docker/buildx/pull/2790).
65+
66+
### Packaging
67+
68+
- Compose support has been updated to v2.4.4. [docker/buildx#2806](https://github.com/docker/buildx/pull/2806) [docker/buildx#2780](https://github.com/docker/buildx/pull/2780).
69+
1370
## 0.18.0
1471

72+
{{< release-date date="2024-10-31" >}}
73+
74+
The full release note for this release is available
75+
[on GitHub](https://github.com/docker/buildx/releases/tag/v0.18.0).
76+
1577
### New
1678

1779
- The `docker buildx inspect` command now displays BuildKit daemon configuration options set with a TOML file. [docker/buildx#2684](https://github.com/docker/buildx/pull/2684)

go.mod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ module github.com/docker/docs
33
go 1.23.1
44

55
require (
6-
github.com/docker/buildx v0.18.0 // indirect
7-
github.com/docker/cli v27.3.2-0.20241107125754-eb986ae71b0c+incompatible // indirect
6+
github.com/docker/buildx v0.19.1 // indirect
7+
github.com/docker/cli v27.4.0-rc.2+incompatible // indirect
88
github.com/docker/compose/v2 v2.30.3 // indirect
99
github.com/docker/scout-cli v1.15.0 // indirect
10-
github.com/moby/buildkit v0.17.1-0.20241031124041-354f2d13c905 // indirect
10+
github.com/moby/buildkit v0.18.0 // indirect
1111
github.com/moby/moby v27.3.1+incompatible // indirect
1212
)
1313

1414
replace (
15-
github.com/docker/buildx => github.com/docker/buildx v0.18.0
15+
github.com/docker/buildx => github.com/docker/buildx v0.19.1
1616
github.com/docker/cli => github.com/docker/cli v27.3.2-0.20241107125754-eb986ae71b0c+incompatible
1717
github.com/docker/compose/v2 => github.com/docker/compose/v2 v2.30.3
1818
github.com/docker/scout-cli => github.com/docker/scout-cli v1.15.0
19-
github.com/moby/buildkit => github.com/moby/buildkit v0.17.1-0.20241031124041-354f2d13c905
19+
github.com/moby/buildkit => github.com/moby/buildkit v0.18.0
2020
github.com/moby/moby => github.com/moby/moby v27.3.1+incompatible
2121
)

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ github.com/docker/buildx v0.17.1 h1:9ob2jGp4+W9PxWw68GsoNFp+eYFc7eUoRL9VljLCSM4=
8484
github.com/docker/buildx v0.17.1/go.mod h1:kJOhOhS47LRvrLFRulFiO5SE6VJf54yYMn7DzjgO5W0=
8585
github.com/docker/buildx v0.18.0 h1:rSauXHeJt90NvtXrLK5J992Eb0UPJZs2vV3u1zTf1nE=
8686
github.com/docker/buildx v0.18.0/go.mod h1:JGNSshOhHs5FhG3u51jXUf4lLOeD2QBIlJ2vaRB67p4=
87+
github.com/docker/buildx v0.19.1 h1:muQEvRJLvOCS0p/67gPwjnQPWqE5ot3sGkb2Eq7vCmw=
88+
github.com/docker/buildx v0.19.1/go.mod h1:k4WP+XmGRYL0a7l4RZAI2TqpwhuAuSQ5U/rosRgFmAA=
8789
github.com/docker/cli v24.0.2+incompatible h1:QdqR7znue1mtkXIJ+ruQMGQhpw2JzMJLRXp6zpzF6tM=
8890
github.com/docker/cli v24.0.2+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
8991
github.com/docker/cli v24.0.4+incompatible h1:Y3bYF9ekNTm2VFz5U/0BlMdJy73D+Y1iAAZ8l63Ydzw=
@@ -314,6 +316,8 @@ github.com/moby/buildkit v0.17.0 h1:ZA/4AxwBbve1f3ZaNNJQiCBtTV62R6YweWNwq4A+sTc=
314316
github.com/moby/buildkit v0.17.0/go.mod h1:ru8NFyDHD8HbuKaLXJIjK9nr3x6FZR+IWjtF07S+wdM=
315317
github.com/moby/buildkit v0.17.1-0.20241031124041-354f2d13c905 h1:KMEmQThIQYXKvBurcvM+6zZjxP2CoNSsF/wUpW+RC/E=
316318
github.com/moby/buildkit v0.17.1-0.20241031124041-354f2d13c905/go.mod h1:ru8NFyDHD8HbuKaLXJIjK9nr3x6FZR+IWjtF07S+wdM=
319+
github.com/moby/buildkit v0.18.0 h1:KSelhNINJcNA3FCWBbGCytvicjP+kjU5kZlZhkTUkVo=
320+
github.com/moby/buildkit v0.18.0/go.mod h1:vCR5CX8NGsPTthTg681+9kdmfvkvqJBXEv71GZe5msU=
317321
github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc=
318322
github.com/moby/moby v24.0.2+incompatible h1:yH+5dRHH1x3XRKzl1THA2aGTy6CHYnkt5N924ADMax8=
319323
github.com/moby/moby v24.0.2+incompatible/go.mod h1:fDXVQ6+S340veQPv35CzDahGBmHsiclFwfEygB/TWMc=

0 commit comments

Comments
 (0)