archive: add WithSourceDateEpoch() for whiteouts
This makes diff archives to be reproducible. The value is expected to be passed from CLI applications via the $SOUCE_DATE_EPOCH env var. See https://reproducible-builds.org/docs/source-date-epoch/ for the $SOURCE_DATE_EPOCH specification. Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
@@ -31,6 +31,7 @@ import (
|
||||
"github.com/containerd/containerd/diff"
|
||||
"github.com/containerd/containerd/log"
|
||||
"github.com/containerd/containerd/mount"
|
||||
"github.com/containerd/containerd/pkg/epoch"
|
||||
"github.com/containerd/containerd/pkg/progress"
|
||||
"github.com/containerd/containerd/rootfs"
|
||||
"github.com/containerd/containerd/snapshots"
|
||||
@@ -142,6 +143,14 @@ var diffCommand = cli.Command{
|
||||
diff.WithLabels(labels),
|
||||
}
|
||||
|
||||
ep, err := epoch.SourceDateEpoch()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if ep != nil {
|
||||
opts = append(opts, diff.WithSourceDateEpoch(ep))
|
||||
}
|
||||
|
||||
if idB == "" {
|
||||
desc, err = rootfs.CreateDiff(ctx, idA, snapshotter, client.DiffService(), opts...)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user