Skip to content

Commit 6d9c24d

Browse files
committed
remove buildinfo
Signed-off-by: CrazyMax <[email protected]>
1 parent b646761 commit 6d9c24d

File tree

23 files changed

+26
-2403
lines changed

23 files changed

+26
-2403
lines changed

.golangci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,3 @@ 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: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,6 @@ 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/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`)
264262
* `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).
265263
* `annotation.<key>=<value>`: attach an annotation with the respective `key` and `value` to the built image
266264
* 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,12 +269,6 @@ Keys supported by image output:
271269
If credentials are required, `buildctl` will attempt to read Docker configuration file `$DOCKER_CONFIG/config.json`.
272270
`$DOCKER_CONFIG` defaults to `~/.docker`.
273271

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-
280272
#### Local directory
281273

282274
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.

client/client_test.go

Lines changed: 0 additions & 162 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ import (
5151
sourcepolicypb "github.com/moby/buildkit/sourcepolicy/pb"
5252
spb "github.com/moby/buildkit/sourcepolicy/pb"
5353
"github.com/moby/buildkit/util/attestation"
54-
binfotypes "github.com/moby/buildkit/util/buildinfo/types"
5554
"github.com/moby/buildkit/util/contentutil"
5655
"github.com/moby/buildkit/util/entitlements"
5756
"github.com/moby/buildkit/util/purl"
@@ -168,9 +167,6 @@ func TestIntegration(t *testing.T) {
168167
testRmSymlink,
169168
testMoveParentDir,
170169
testBuildExportWithForeignLayer,
171-
testBuildInfoExporter,
172-
testBuildInfoInline,
173-
testBuildInfoNoExport,
174170
testZstdLocalCacheExport,
175171
testCacheExportIgnoreError,
176172
testZstdRegistryCacheImportExport,
@@ -6672,164 +6668,6 @@ func testRelativeMountpoint(t *testing.T, sb integration.Sandbox) {
66726668
require.Equal(t, dt, []byte(id))
66736669
}
66746670

6675-
// moby/buildkit#2476
6676-
func testBuildInfoExporter(t *testing.T, sb integration.Sandbox) {
6677-
requiresLinux(t)
6678-
c, err := New(sb.Context(), sb.Address())
6679-
require.NoError(t, err)
6680-
defer c.Close()
6681-
6682-
frontend := func(ctx context.Context, c gateway.Client) (*gateway.Result, error) {
6683-
st := llb.Image("busybox:latest").Run(
6684-
llb.Args([]string{"/bin/sh", "-c", `echo hello`}),
6685-
)
6686-
def, err := st.Marshal(sb.Context())
6687-
if err != nil {
6688-
return nil, err
6689-
}
6690-
return c.Solve(ctx, gateway.SolveRequest{
6691-
Definition: def.ToPB(),
6692-
})
6693-
}
6694-
6695-
var exports []ExportEntry
6696-
if integration.IsTestDockerdMoby(sb) {
6697-
exports = []ExportEntry{{
6698-
Type: "moby",
6699-
Attrs: map[string]string{
6700-
"name": "reg.dummy:5000/buildkit/test:latest",
6701-
},
6702-
}}
6703-
} else {
6704-
exports = []ExportEntry{{
6705-
Type: ExporterOCI,
6706-
Attrs: map[string]string{},
6707-
Output: fixedWriteCloser(nopWriteCloser{io.Discard}),
6708-
}}
6709-
}
6710-
6711-
res, err := c.Build(sb.Context(), SolveOpt{
6712-
Exports: exports,
6713-
}, "", frontend, nil)
6714-
require.NoError(t, err)
6715-
6716-
require.Contains(t, res.ExporterResponse, exptypes.ExporterBuildInfo)
6717-
decbi, err := base64.StdEncoding.DecodeString(res.ExporterResponse[exptypes.ExporterBuildInfo])
6718-
require.NoError(t, err)
6719-
6720-
var exbi binfotypes.BuildInfo
6721-
err = json.Unmarshal(decbi, &exbi)
6722-
require.NoError(t, err)
6723-
6724-
require.Equal(t, len(exbi.Sources), 1)
6725-
require.Equal(t, exbi.Sources[0].Type, binfotypes.SourceTypeDockerImage)
6726-
require.Equal(t, exbi.Sources[0].Ref, "docker.io/library/busybox:latest")
6727-
}
6728-
6729-
// moby/buildkit#2476
6730-
func testBuildInfoInline(t *testing.T, sb integration.Sandbox) {
6731-
integration.CheckFeatureCompat(t, sb, integration.FeatureDirectPush)
6732-
requiresLinux(t)
6733-
c, err := New(sb.Context(), sb.Address())
6734-
require.NoError(t, err)
6735-
defer c.Close()
6736-
6737-
st := llb.Image("busybox:latest").Run(
6738-
llb.Args([]string{"/bin/sh", "-c", `echo hello`}),
6739-
)
6740-
def, err := st.Marshal(sb.Context())
6741-
require.NoError(t, err)
6742-
6743-
registry, err := sb.NewRegistry()
6744-
if errors.Is(err, integration.ErrRequirements) {
6745-
t.Skip(err.Error())
6746-
}
6747-
require.NoError(t, err)
6748-
6749-
cdAddress := sb.ContainerdAddress()
6750-
if cdAddress == "" {
6751-
t.Skip("rest of test requires containerd worker")
6752-
}
6753-
6754-
client, err := newContainerd(cdAddress)
6755-
require.NoError(t, err)
6756-
defer client.Close()
6757-
6758-
ctx := namespaces.WithNamespace(sb.Context(), "buildkit")
6759-
6760-
target := registry + "/buildkit/test-buildinfo:latest"
6761-
6762-
_, err = c.Solve(sb.Context(), def, SolveOpt{
6763-
Exports: []ExportEntry{
6764-
{
6765-
Type: ExporterImage,
6766-
Attrs: map[string]string{
6767-
"name": target,
6768-
"push": "true",
6769-
},
6770-
},
6771-
},
6772-
}, nil)
6773-
require.NoError(t, err)
6774-
6775-
img, err := client.GetImage(ctx, target)
6776-
require.NoError(t, err)
6777-
6778-
desc, err := img.Config(ctx)
6779-
require.NoError(t, err)
6780-
6781-
dt, err := content.ReadBlob(ctx, img.ContentStore(), desc)
6782-
require.NoError(t, err)
6783-
6784-
var config binfotypes.ImageConfig
6785-
require.NoError(t, json.Unmarshal(dt, &config))
6786-
6787-
dec, err := base64.StdEncoding.DecodeString(config.BuildInfo)
6788-
require.NoError(t, err)
6789-
6790-
var bi binfotypes.BuildInfo
6791-
require.NoError(t, json.Unmarshal(dec, &bi))
6792-
6793-
require.Equal(t, len(bi.Sources), 1)
6794-
require.Equal(t, bi.Sources[0].Type, binfotypes.SourceTypeDockerImage)
6795-
require.Equal(t, bi.Sources[0].Ref, "docker.io/library/busybox:latest")
6796-
}
6797-
6798-
func testBuildInfoNoExport(t *testing.T, sb integration.Sandbox) {
6799-
requiresLinux(t)
6800-
c, err := New(sb.Context(), sb.Address())
6801-
require.NoError(t, err)
6802-
defer c.Close()
6803-
6804-
frontend := func(ctx context.Context, c gateway.Client) (*gateway.Result, error) {
6805-
st := llb.Image("busybox:latest").Run(
6806-
llb.Args([]string{"/bin/sh", "-c", `echo hello`}),
6807-
)
6808-
def, err := st.Marshal(sb.Context())
6809-
if err != nil {
6810-
return nil, err
6811-
}
6812-
return c.Solve(ctx, gateway.SolveRequest{
6813-
Definition: def.ToPB(),
6814-
})
6815-
}
6816-
6817-
res, err := c.Build(sb.Context(), SolveOpt{}, "", frontend, nil)
6818-
require.NoError(t, err)
6819-
6820-
require.Contains(t, res.ExporterResponse, exptypes.ExporterBuildInfo)
6821-
decbi, err := base64.StdEncoding.DecodeString(res.ExporterResponse[exptypes.ExporterBuildInfo])
6822-
require.NoError(t, err)
6823-
6824-
var exbi binfotypes.BuildInfo
6825-
err = json.Unmarshal(decbi, &exbi)
6826-
require.NoError(t, err)
6827-
6828-
require.Equal(t, len(exbi.Sources), 1)
6829-
require.Equal(t, exbi.Sources[0].Type, binfotypes.SourceTypeDockerImage)
6830-
require.Equal(t, exbi.Sources[0].Ref, "docker.io/library/busybox:latest")
6831-
}
6832-
68336671
func testPullWithLayerLimit(t *testing.T, sb integration.Sandbox) {
68346672
integration.CheckFeatureCompat(t, sb, integration.FeatureDirectPush)
68356673
requiresLinux(t)

control/control.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -337,15 +337,6 @@ func (c *Controller) Solve(ctx context.Context, req *controlapi.SolveRequest) (*
337337
}
338338
}
339339

340-
if v, ok := req.FrontendAttrs["build-arg:BUILDKIT_BUILDINFO"]; ok && v != "" {
341-
if _, ok := req.ExporterAttrs["buildinfo"]; !ok {
342-
if req.ExporterAttrs == nil {
343-
req.ExporterAttrs = make(map[string]string)
344-
}
345-
req.ExporterAttrs["buildinfo"] = v
346-
}
347-
}
348-
349340
if req.Exporter != "" {
350341
exp, err := w.Exporter(req.Exporter, c.opt.SessionManager)
351342
if err != nil {

docs/buildinfo.md

Lines changed: 2 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -1,141 +1,4 @@
11
# Build information
22

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-
```
3+
Build information has been removed since BuildKit v0.12.0. See the [Deprecated features page](https://github.com/moby/buildkit/blob/master/docs/deprecated.md)
4+
for status and alternative recommendation about this feature.

docs/deprecated.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,5 @@ information is also embedded into the image configuration if one is generated.
4242

4343
With the introduction of [provenance attestations](./attestations/slsa-provenance.md)
4444
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.
47-
48-
To completely disable the build information feature, set the build-arg
49-
`BUILDKIT_BUILDINFO=false`.
45+
the build information feature has been deprecated and removed in v0.12.0
46+
release.

exporter/containerimage/export.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ func (e *imageExporter) Resolve(ctx context.Context, opt map[string]string) (exp
7878
RefCfg: cacheconfig.RefConfig{
7979
Compression: compression.New(compression.Default),
8080
},
81-
BuildInfo: true,
8281
ForceInlineAttestations: true,
8382
},
8483
store: true,

0 commit comments

Comments
 (0)