Open tonistiigi opened 1 year ago
I'm not sure how this is implementable.
The controller parses the build arg before it calls the solver to invoke the frontend, which creates LLB git state: https://github.com/moby/buildkit/blob/915d245f67dc0521ef04a09c867c4581713a1e3c/control/control.go#L346-L354 https://github.com/moby/buildkit/blob/915d245f67dc0521ef04a09c867c4581713a1e3c/frontend/dockerui/context.go#L143-L159
The frontend could return the epoch with the result metadata. New code is needed to actually read the timestamp with the commit. In another issue we were discussing making ResolveImageConfig
work with all sources so maybe that would be to place to attach timestamp info if a source supports it. Potentially it could be used for other sources as well like images and maybe by reading headers for HTTP sources.
maybe that would be to place to attach timestamp info if a source supports it
Otoh going through LLB would allow avoiding extra progress messages.
When building from Git URL directly there shouldn't be a need to pass
--build-arg SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
manually. There should be a simple opt-in for BuildKit to do that initialization automatically, or maybe it should even be enabled by default(this does change the image creation time to commit time, but maybe that is for the better).cc @AkihiroSuda