|
| 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 | +``` |
0 commit comments