epoch: propagate SOURCE_DATE_EPOCH via ctx
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
@@ -20,7 +20,9 @@ import (
|
||||
gocontext "context"
|
||||
|
||||
"github.com/containerd/containerd"
|
||||
"github.com/containerd/containerd/log"
|
||||
"github.com/containerd/containerd/namespaces"
|
||||
"github.com/containerd/containerd/pkg/epoch"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
@@ -42,6 +44,12 @@ func AppContext(context *cli.Context) (gocontext.Context, gocontext.CancelFunc)
|
||||
} else {
|
||||
ctx, cancel = gocontext.WithCancel(ctx)
|
||||
}
|
||||
if tm, err := epoch.SourceDateEpoch(); err != nil {
|
||||
log.L.WithError(err).Warn("Failed to read SOURCE_DATE_EPOCH")
|
||||
} else if tm != nil {
|
||||
log.L.Debugf("Using SOURCE_DATE_EPOCH: %v", tm)
|
||||
ctx = epoch.WithSourceDateEpoch(ctx, tm)
|
||||
}
|
||||
return ctx, cancel
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user