Skip to content

Commit 5e0b785

Browse files
authored
Merge pull request moby#3582 from crazy-max/deprecate-buildinfo
remove buildinfo
2 parents ce4ad75 + 6d9c24d commit 5e0b785

File tree

23 files changed

+69
-2370
lines changed

23 files changed

+69
-2370
lines changed

README.md

Lines changed: 0 additions & 22 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/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`)
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.
@@ -582,26 +580,6 @@ jq '.' metadata.json
582580
```
583581
```json
584582
{
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-
},
605583
"containerimage.config.digest": "sha256:2937f66a9722f7f4a2df583de2f8cb97fc9196059a410e7f00072fc918930e66",
606584
"containerimage.descriptor": {
607585
"annotations": {

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)

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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Build information
2+
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.

0 commit comments

Comments
 (0)