Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buildctl: support exporting SolveResponse as a JSON file #2815

Closed

Conversation

AkihiroSuda
Copy link
Member

@AkihiroSuda AkihiroSuda commented Apr 20, 2022

e.g.,

$ buildctl build  --frontend dockerfile.v0  --local dockerfile=. --local context=. --output type=image,name=foo --response-file resp.json
$ cat resp.json
{
  "exporterResponse": {
    "containerimage.buildinfo": "eyJmcm9udGVuZCI6ImRvY2tlcmZpbGUudjAiLCJzb3VyY2VzIjpbeyJ0eXBlIjoiZG9ja2VyLWltYWdlIiwicmVmIjoiZG9ja2VyLmlvL2xpYnJhcnkvYWxwaW5lOmxhdGVzdCIsInBpbiI6InNoYTI1Njo0ZWRiZDJiZWI1Zjc4YjEwMTQwMjhmNGZiYjk5ZjMyMzdkOTU2MTEwMGI2ODgxYWFiYmY1YWNjZTJjNGY5NDU0In0seyJ0eXBlIjoiaHR0cCIsInJlZiI6Imh0dHBzOi8vcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbS9tb2J5L2J1aWxka2l0L3YwLjEwLjEvUkVBRE1FLm1kIiwicGluIjoic2hhMjU2OjZlNGI5NGZjMjcwZTcwOGUxMDY4YmUyOGJkMzU1MWRjNjkxN2E0ZmM1YTYxMjkzZDUxYmIzNmU2Yjc1YzRiNTMifV19",
    "containerimage.config.digest": "sha256:715a5c56573fe9c46812f100bb6f359436a3ee627e521310b6ca2bfea2d837a3",
    "containerimage.descriptor": "eyJtZWRpYVR5cGUiOiJhcHBsaWNhdGlvbi92bmQuZG9ja2VyLmRpc3RyaWJ1dGlvbi5tYW5pZmVzdC52Mitqc29uIiwiZGlnZXN0Ijoic2hhMjU2OmRhNWZiMjhiMjgwZGY1MGExMGQxMTg0ZjJmMTU4ZGE2OGNhMmY5YTZkYjUxY2ZkYzFiNmM0YTk5NGFjNTIyMjMiLCJzaXplIjo3MzZ9",
    "containerimage.digest": "sha256:da5fb28b280df50a10d1184f2f158da68ca2f9a6db51cfdc1b6c4a994ac52223",
    "image.name": "foo"
  }
}

This can be used for inspecting metadata that aren't placed in --metadata-file.
e.g., consumedPin data discussed in #2794 (comment)

e.g.,
```console
$ buildctl build  --frontend dockerfile.v0  --local dockerfile=. --local context=. --output type=image,name=foo --response-file resp.json
$ cat resp.json
{
  "exporterResponse": {
    "containerimage.buildinfo": "eyJmcm9udGVuZCI6ImRvY2tlcmZpbGUudjAiLCJzb3VyY2VzIjpbeyJ0eXBlIjoiZG9ja2VyLWltYWdlIiwicmVmIjoiZG9ja2VyLmlvL2xpYnJhcnkvYWxwaW5lOmxhdGVzdCIsInBpbiI6InNoYTI1Njo0ZWRiZDJiZWI1Zjc4YjEwMTQwMjhmNGZiYjk5ZjMyMzdkOTU2MTEwMGI2ODgxYWFiYmY1YWNjZTJjNGY5NDU0In0seyJ0eXBlIjoiaHR0cCIsInJlZiI6Imh0dHBzOi8vcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbS9tb2J5L2J1aWxka2l0L3YwLjEwLjEvUkVBRE1FLm1kIiwicGluIjoic2hhMjU2OjZlNGI5NGZjMjcwZTcwOGUxMDY4YmUyOGJkMzU1MWRjNjkxN2E0ZmM1YTYxMjkzZDUxYmIzNmU2Yjc1YzRiNTMifV19",
    "containerimage.config.digest": "sha256:715a5c56573fe9c46812f100bb6f359436a3ee627e521310b6ca2bfea2d837a3",
    "containerimage.descriptor": "eyJtZWRpYVR5cGUiOiJhcHBsaWNhdGlvbi92bmQuZG9ja2VyLmRpc3RyaWJ1dGlvbi5tYW5pZmVzdC52Mitqc29uIiwiZGlnZXN0Ijoic2hhMjU2OmRhNWZiMjhiMjgwZGY1MGExMGQxMTg0ZjJmMTU4ZGE2OGNhMmY5YTZkYjUxY2ZkYzFiNmM0YTk5NGFjNTIyMjMiLCJzaXplIjo3MzZ9",
    "containerimage.digest": "sha256:da5fb28b280df50a10d1184f2f158da68ca2f9a6db51cfdc1b6c4a994ac52223",
    "image.name": "foo"
  }
}
```

Signed-off-by: Akihiro Suda <[email protected]>
@tonistiigi
Copy link
Member

This can be used for inspecting metadata that aren't placed in --metadata-file.

I don't understand what's the difference. If a field is useful for the user it should in metadata-file.

@AkihiroSuda
Copy link
Member Author

This can be used for inspecting metadata that aren't placed in --metadata-file.

I don't understand what's the difference. If a field is useful for the user it should in metadata-file.

IIUC, the metadata-file should only contain deterministic information.
#2794 (comment)

Non-deterministic information should be excluded from the metadata-file even when they are useful for the user.

@tonistiigi
Copy link
Member

My comment wasn't directly about non-determinism but stability of the BuildInfo type. Is there any field atm that behaves differently from metadata file? For consumedPin, that needs to be discussed in the other proposal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants