Skip to content

Commit 031b9f6

Browse files
committed
buildinfo: mark as deprecated
Signed-off-by: CrazyMax <[email protected]>
1 parent 3cb5ac6 commit 031b9f6

File tree

12 files changed

+196
-166
lines changed

12 files changed

+196
-166
lines changed

.golangci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,6 @@ issues:
6565
- linters:
6666
- revive
6767
text: "stutters"
68+
- linters:
69+
- staticcheck
70+
text: "SA1019: .*Build information format has been deprecated. Status and alternative recommendation can be found at: https://github.com/moby/buildkit/blob/master/docs/deprecated.md"

README.md

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ Keys supported by image output:
259259
* `compression=<uncompressed|gzip|estargz|zstd>`: choose compression type for layers newly created and cached, gzip is default value. estargz should be used with `oci-mediatypes=true`.
260260
* `compression-level=<value>`: compression level for gzip, estargz (0-9) and zstd (0-22)
261261
* `force-compression=true`: forcefully apply `compression` option to all layers (including already existing layers)
262-
* `buildinfo=true`: attach inline build info in [image config](docs/build-repro.md#image-config) (default `true`)
263-
* `buildinfo-attrs=true`: attach inline build info attributes in [image config](docs/build-repro.md#image-config) (default `false`)
262+
* `buildinfo=true`: attach inline build info in [image config](docs/buildinfo.md#image-config) (default `true`)
263+
* `buildinfo-attrs=true`: attach inline build info attributes in [image config](docs/buildinfo.md#image-config) (default `false`)
264264
* `store=true`: store the result images to the worker's (e.g. containerd) image store as well as ensures that the image has all blobs in the content store (default `true`). Ignored if the worker doesn't have image store (e.g. OCI worker).
265265
* `annotation.<key>=<value>`: attach an annotation with the respective `key` and `value` to the built image
266266
* Using the extended syntaxes, `annotation-<type>.<key>=<value>`, `annotation[<platform>].<key>=<value>` and both combined with `annotation-<type>[<platform>].<key>=<value>`, allows configuring exactly where to attach the annotation.
@@ -271,6 +271,12 @@ Keys supported by image output:
271271
If credentials are required, `buildctl` will attempt to read Docker configuration file `$DOCKER_CONFIG/config.json`.
272272
`$DOCKER_CONFIG` defaults to `~/.docker`.
273273

274+
> **Warning**
275+
>
276+
> Build information along `buildinfo` and `buildinfo-attrs` attributes are
277+
> deprecated and will be removed in the next release. See the [Deprecated features page](./docs/deprecated.md)
278+
> for status and alternative recommendation about this feature.
279+
274280
#### Local directory
275281

276282
The local client will copy the files directly to the client. This is useful if BuildKit is being used for building something else than container images.
@@ -582,26 +588,6 @@ jq '.' metadata.json
582588
```
583589
```json
584590
{
585-
"containerimage.buildinfo": {
586-
"frontend": "dockerfile.v0",
587-
"attrs": {
588-
"context": "https://github.com/crazy-max/buildkit-buildsources-test.git#master",
589-
"filename": "Dockerfile",
590-
"source": "docker/dockerfile:master"
591-
},
592-
"sources": [
593-
{
594-
"type": "docker-image",
595-
"ref": "docker.io/docker/buildx-bin:0.6.1@sha256:a652ced4a4141977c7daaed0a074dcd9844a78d7d2615465b12f433ae6dd29f0",
596-
"pin": "sha256:a652ced4a4141977c7daaed0a074dcd9844a78d7d2615465b12f433ae6dd29f0"
597-
},
598-
{
599-
"type": "docker-image",
600-
"ref": "docker.io/library/alpine:3.13",
601-
"pin": "sha256:026f721af4cf2843e07bba648e158fb35ecc876d822130633cc49f707f0fc88c"
602-
}
603-
]
604-
},
605591
"containerimage.config.digest": "sha256:2937f66a9722f7f4a2df583de2f8cb97fc9196059a410e7f00072fc918930e66",
606592
"containerimage.descriptor": {
607593
"annotations": {

docs/build-repro.md

Lines changed: 1 addition & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -1,134 +1,6 @@
11
# Build reproducibility
22

3-
## Build dependencies
4-
5-
Build dependencies are generated when your image has been built. These
6-
dependencies include versions of used images, git repositories and HTTP URLs
7-
used by LLB `Source` operation as well as build request attributes.
8-
9-
The structure is base64 encoded and has the following format when decoded:
10-
11-
```json
12-
{
13-
"frontend": "dockerfile.v0",
14-
"attrs": {
15-
"build-arg:foo": "bar",
16-
"context": "https://github.com/crazy-max/buildkit-buildsources-test.git#master",
17-
"filename": "Dockerfile",
18-
"platform": "linux/amd64,linux/arm64",
19-
"source": "crazymax/dockerfile:master"
20-
},
21-
"sources": [
22-
{
23-
"type": "docker-image",
24-
"ref": "docker.io/docker/buildx-bin:0.6.1@sha256:a652ced4a4141977c7daaed0a074dcd9844a78d7d2615465b12f433ae6dd29f0",
25-
"pin": "sha256:a652ced4a4141977c7daaed0a074dcd9844a78d7d2615465b12f433ae6dd29f0"
26-
},
27-
{
28-
"type": "docker-image",
29-
"ref": "docker.io/library/alpine:3.13",
30-
"pin": "sha256:1d30d1ba3cb90962067e9b29491fbd56997979d54376f23f01448b5c5cd8b462"
31-
},
32-
{
33-
"type": "git",
34-
"ref": "https://github.com/crazy-max/buildkit-buildsources-test.git#master",
35-
"pin": "259a5aa5aa5bb3562d12cc631fe399f4788642c1"
36-
},
37-
{
38-
"type": "http",
39-
"ref": "https://raw.githubusercontent.com/moby/moby/v20.10.21/README.md",
40-
"pin": "sha256:419455202b0ef97e480d7f8199b26a721a417818bc0e2d106975f74323f25e6c"
41-
}
42-
]
43-
}
44-
```
45-
46-
* `frontend` defines the frontend used to build.
47-
* `attrs` defines build request attributes.
48-
* `sources` defines build sources.
49-
* `type` defines the source type (`docker-image`, `git` or `http`).
50-
* `ref` is the reference of the source.
51-
* `pin` is the source digest.
52-
* `deps` defines build dependencies of input contexts.
53-
54-
### Image config
55-
56-
A new field similar to the one for inline cache has been added to the image
57-
configuration to embed build dependencies:
58-
59-
```json
60-
{
61-
"moby.buildkit.buildinfo.v0": "<base64>"
62-
}
63-
```
64-
65-
By default, the build dependencies are inlined in the image configuration. You
66-
can disable this behavior with the [`buildinfo` attribute](../README.md#imageregistry).
67-
68-
### Exporter response (metadata)
69-
70-
The solver response (`ExporterResponse`) also contains a new key
71-
`containerimage.buildinfo` with the same structure as image config encoded in
72-
base64:
73-
74-
```json
75-
{
76-
"ExporterResponse": {
77-
"containerimage.buildinfo": "<base64>",
78-
"containerimage.digest": "sha256:..."
79-
}
80-
}
81-
```
82-
83-
If multi-platforms are specified, they will be suffixed with the corresponding
84-
platform:
85-
86-
```json
87-
{
88-
"ExporterResponse": {
89-
"containerimage.buildinfo/linux/amd64": "<base64>",
90-
"containerimage.buildinfo/linux/arm64": "<base64>",
91-
"containerimage.digest": "sha256:..."
92-
}
93-
}
94-
```
95-
96-
### Metadata JSON output
97-
98-
If you're using the `--metadata-file` flag with [`buildctl`](../README.md#metadata),
99-
[`buildx build`](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md)
100-
or [`buildx bake`](https://github.com/docker/buildx/blob/master/docs/reference/buildx_bake.md):
101-
102-
```shell
103-
jq '.' metadata.json
104-
```
105-
```json
106-
{
107-
"containerimage.buildinfo": {
108-
"frontend": "dockerfile.v0",
109-
"attrs": {
110-
"context": "https://github.com/crazy-max/buildkit-buildsources-test.git#master",
111-
"filename": "Dockerfile",
112-
"source": "docker/dockerfile:master"
113-
},
114-
"sources": [
115-
{
116-
"type": "docker-image",
117-
"ref": "docker.io/docker/buildx-bin:0.6.1@sha256:a652ced4a4141977c7daaed0a074dcd9844a78d7d2615465b12f433ae6dd29f0",
118-
"pin": "sha256:a652ced4a4141977c7daaed0a074dcd9844a78d7d2615465b12f433ae6dd29f0"
119-
},
120-
{
121-
"type": "docker-image",
122-
"ref": "docker.io/library/alpine:3.13",
123-
"pin": "sha256:026f721af4cf2843e07bba648e158fb35ecc876d822130633cc49f707f0fc88c"
124-
}
125-
]
126-
},
127-
"containerimage.digest": "sha256:..."
128-
}
129-
```
130-
131-
### Reproducing the pinned dependencies
3+
## Reproducing the pinned dependencies
1324

1335
Reproducing the pinned dependencies is supported since BuildKit v0.11.
1346

docs/buildinfo.md

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# Build information
2+
3+
> **Warning**
4+
>
5+
> Build information is deprecated and will be removed in the next release. See
6+
> the [Deprecated features page](https://github.com/moby/buildkit/blob/master/docs/deprecated.md)
7+
> for status and alternative recommendation about this feature.
8+
9+
Build information structures are generated with build metadata that allows you
10+
to see all the sources (images, git repositories) that were used by the build
11+
with their exact versions and also the configuration that was passed to the
12+
build. This information is also embedded into the image configuration if one
13+
is generated.
14+
15+
## Build dependencies
16+
17+
Build dependencies are generated when your image has been built. These
18+
dependencies include versions of used images, git repositories and HTTP URLs
19+
used by LLB `Source` operation as well as build request attributes.
20+
21+
The structure is base64 encoded and has the following format when decoded:
22+
23+
```json
24+
{
25+
"frontend": "dockerfile.v0",
26+
"attrs": {
27+
"build-arg:foo": "bar",
28+
"context": "https://github.com/crazy-max/buildkit-buildsources-test.git#master",
29+
"filename": "Dockerfile",
30+
"platform": "linux/amd64,linux/arm64",
31+
"source": "crazymax/dockerfile:master"
32+
},
33+
"sources": [
34+
{
35+
"type": "docker-image",
36+
"ref": "docker.io/docker/buildx-bin:0.6.1@sha256:a652ced4a4141977c7daaed0a074dcd9844a78d7d2615465b12f433ae6dd29f0",
37+
"pin": "sha256:a652ced4a4141977c7daaed0a074dcd9844a78d7d2615465b12f433ae6dd29f0"
38+
},
39+
{
40+
"type": "docker-image",
41+
"ref": "docker.io/library/alpine:3.13",
42+
"pin": "sha256:1d30d1ba3cb90962067e9b29491fbd56997979d54376f23f01448b5c5cd8b462"
43+
},
44+
{
45+
"type": "git",
46+
"ref": "https://github.com/crazy-max/buildkit-buildsources-test.git#master",
47+
"pin": "259a5aa5aa5bb3562d12cc631fe399f4788642c1"
48+
},
49+
{
50+
"type": "http",
51+
"ref": "https://raw.githubusercontent.com/moby/moby/v20.10.21/README.md",
52+
"pin": "sha256:419455202b0ef97e480d7f8199b26a721a417818bc0e2d106975f74323f25e6c"
53+
}
54+
]
55+
}
56+
```
57+
58+
* `frontend` defines the frontend used to build.
59+
* `attrs` defines build request attributes.
60+
* `sources` defines build sources.
61+
* `type` defines the source type (`docker-image`, `git` or `http`).
62+
* `ref` is the reference of the source.
63+
* `pin` is the source digest.
64+
* `deps` defines build dependencies of input contexts.
65+
66+
### Image config
67+
68+
A new field similar to the one for inline cache has been added to the image
69+
configuration to embed build dependencies:
70+
71+
```json
72+
{
73+
"moby.buildkit.buildinfo.v0": "<base64>"
74+
}
75+
```
76+
77+
By default, the build dependencies are inlined in the image configuration. You
78+
can disable this behavior with the [`buildinfo` attribute](../README.md#imageregistry).
79+
80+
### Exporter response (metadata)
81+
82+
The solver response (`ExporterResponse`) also contains a new key
83+
`containerimage.buildinfo` with the same structure as image config encoded in
84+
base64:
85+
86+
```json
87+
{
88+
"ExporterResponse": {
89+
"containerimage.buildinfo": "<base64>",
90+
"containerimage.digest": "sha256:..."
91+
}
92+
}
93+
```
94+
95+
If multi-platforms are specified, they will be suffixed with the corresponding
96+
platform:
97+
98+
```json
99+
{
100+
"ExporterResponse": {
101+
"containerimage.buildinfo/linux/amd64": "<base64>",
102+
"containerimage.buildinfo/linux/arm64": "<base64>",
103+
"containerimage.digest": "sha256:..."
104+
}
105+
}
106+
```
107+
108+
### Metadata JSON output
109+
110+
If you're using the `--metadata-file` flag with [`buildctl`](../README.md#metadata),
111+
[`buildx build`](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md)
112+
or [`buildx bake`](https://github.com/docker/buildx/blob/master/docs/reference/buildx_bake.md):
113+
114+
```shell
115+
jq '.' metadata.json
116+
```
117+
```json
118+
{
119+
"containerimage.buildinfo": {
120+
"frontend": "dockerfile.v0",
121+
"attrs": {
122+
"context": "https://github.com/crazy-max/buildkit-buildsources-test.git#master",
123+
"filename": "Dockerfile",
124+
"source": "docker/dockerfile:master"
125+
},
126+
"sources": [
127+
{
128+
"type": "docker-image",
129+
"ref": "docker.io/docker/buildx-bin:0.6.1@sha256:a652ced4a4141977c7daaed0a074dcd9844a78d7d2615465b12f433ae6dd29f0",
130+
"pin": "sha256:a652ced4a4141977c7daaed0a074dcd9844a78d7d2615465b12f433ae6dd29f0"
131+
},
132+
{
133+
"type": "docker-image",
134+
"ref": "docker.io/library/alpine:3.13",
135+
"pin": "sha256:026f721af4cf2843e07bba648e158fb35ecc876d822130633cc49f707f0fc88c"
136+
}
137+
]
138+
},
139+
"containerimage.digest": "sha256:..."
140+
}
141+
```

docs/deprecated.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ features:
2727
migrate to alternatives. In such cases, a warning may be printed, and users
2828
should not rely on this feature.
2929

30-
| Status | Feature | Deprecated | Remove | Recommendation |
31-
|--------|---------|------------|--------|----------------|
32-
| | | - | - | |
30+
| Status | Feature | Deprecated | Remove | Recommendation |
31+
|------------|-----------------------------------------|------------|--------|------------------------------------------------------------------|
32+
| Deprecated | [Build information](#build-information) | v0.11 | v0.12 | Use [provenance attestations](./attestations/slsa-provenance.md) |
33+
34+
## Build information
35+
36+
[Build information](https://github.com/moby/buildkit/blob/v0.11/docs/buildinfo.md)
37+
structures have been introduced in [BuildKit v0.10.0](https://github.com/moby/buildkit/releases/tag/v0.10.0)
38+
and are generated with build metadata that allows you to see all the sources
39+
(images, git repositories) that were used by the build with their exact
40+
versions and also the configuration that was passed to the build. This
41+
information is also embedded into the image configuration if one is generated.
42+
43+
With the introduction of [provenance attestations](./attestations/slsa-provenance.md)
44+
in [BuildKit v0.11.0](https://github.com/moby/buildkit/releases/tag/v0.11.0),
45+
the build information feature has been deprecated and will be removed in the
46+
next release.

exporter/containerimage/exptypes/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const (
1111
ExporterImageConfigDigestKey = "containerimage.config.digest"
1212
ExporterImageDescriptorKey = "containerimage.descriptor"
1313
ExporterInlineCache = "containerimage.inlinecache"
14-
ExporterBuildInfo = "containerimage.buildinfo"
14+
ExporterBuildInfo = "containerimage.buildinfo" // Deprecated: Build information format has been deprecated. Status and alternative recommendation can be found at: https://github.com/moby/buildkit/blob/master/docs/deprecated.md
1515
ExporterPlatformsKey = "refs.platforms"
1616
ExporterEpochKey = "source.date.epoch"
1717
)

exporter/containerimage/opts.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,16 @@ const (
2525
)
2626

2727
type ImageCommitOpts struct {
28-
ImageName string
29-
RefCfg cacheconfig.RefConfig
30-
OCITypes bool
31-
BuildInfo bool
32-
BuildInfoAttrs bool
33-
Annotations AnnotationsGroup
34-
Epoch *time.Time
28+
ImageName string
29+
RefCfg cacheconfig.RefConfig
30+
OCITypes bool
31+
Annotations AnnotationsGroup
32+
Epoch *time.Time
3533

3634
ForceInlineAttestations bool // force inline attestations to be attached
35+
36+
BuildInfo bool // Deprecated: Build information format has been deprecated. Status and alternative recommendation can be found at: https://github.com/moby/buildkit/blob/master/docs/deprecated.md
37+
BuildInfoAttrs bool // Deprecated: Build information format has been deprecated. Status and alternative recommendation can be found at: https://github.com/moby/buildkit/blob/master/docs/deprecated.md
3738
}
3839

3940
func (c *ImageCommitOpts) Load(opt map[string]string) (map[string]string, error) {

0 commit comments

Comments
 (0)