image: set up history array on exported image config #196
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
based on #195This PR fills in history array records, either from dockerfile commands or LLB descriptions. It also optimizes out empty layers and sets their history records to reflect that.
Note the history items from dockerfile aren't 100% compatible with docker but carry the same content for the user. For the commands that were executed by LLB, the vertex digest is added as well. This should be replaced by cache checksum in the future but avoids wrong cache hits in other builders that are based on history array because the record wouldn't be unique otherwise. Buildkit itself will likely share cache on a side channel or write it as a single binary value and not repurpose history array for this. Unlike docker, the history records also don't use
sh -c #(nop)
prefixes. This is put there in docker because old versions used the same field for the commands of intermediate images but it carries no information to the user.