mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
build: move SOURCE_DATE_EPOCH parsing into option generation
This allows the build package code to become more generic, and also ensures that when the environment variables are not propogated (in the case of the remote controller), that we can still correctly set SOURCE_DATE_EPOCH. Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
@ -100,6 +100,13 @@ func (o *buildOptions) toControllerOptions() (controllerapi.BuildOptions, error)
|
||||
Opts: &o.CommonOptions,
|
||||
}
|
||||
|
||||
// TODO: extract env var parsing to a method easily usable by library consumers
|
||||
if v := os.Getenv("SOURCE_DATE_EPOCH"); v != "" {
|
||||
if _, ok := opts.BuildArgs["SOURCE_DATE_EPOCH"]; !ok {
|
||||
opts.BuildArgs["SOURCE_DATE_EPOCH"] = v
|
||||
}
|
||||
}
|
||||
|
||||
inAttests := append([]string{}, o.attests...)
|
||||
if o.provenance != "" {
|
||||
inAttests = append(inAttests, buildflags.CanonicalizeAttest("provenance", o.provenance))
|
||||
|
Reference in New Issue
Block a user