From 6a24a6b64789f8222d76ba1b8ce50e13613f25fb Mon Sep 17 00:00:00 2001 From: Xiaoxuan Wang Date: Tue, 23 Apr 2024 07:59:02 +0000 Subject: [PATCH] doc: document PackManifestOptions to make PackManifest reproducible Signed-off-by: Xiaoxuan Wang --- pack.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pack.go b/pack.go index 1b9956129..c9d04dbab 100644 --- a/pack.go +++ b/pack.go @@ -93,7 +93,9 @@ type PackManifestOptions struct { // Layers is the layers of the manifest. Layers []ocispec.Descriptor - // ManifestAnnotations is the annotation map of the manifest. + // ManifestAnnotations is the annotation map of the manifest. Set + // "org.opencontainers.image.created" with a value to make PackManifest + // reproducible. ManifestAnnotations map[string]string // ConfigDescriptor is a pointer to the descriptor of the config blob. @@ -126,6 +128,11 @@ var mediaTypeRegexp = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9!#$&-^_.+]{0,126 // // artifactType and opts.ConfigDescriptor.MediaType MUST comply with RFC 6838. // +// Each time when PackManifest is called, it generates a new time stamp in the +// manifest annotations with the key "org.opencontainers.image.created". To make +// PackManifest reproducible, set "org.opencontainers.image.created" with a value +// in opts.ManifestAnnotations. +// // If succeeded, returns a descriptor of the packed manifest. func PackManifest(ctx context.Context, pusher content.Pusher, packManifestVersion PackManifestVersion, artifactType string, opts PackManifestOptions) (ocispec.Descriptor, error) { switch packManifestVersion {