Skip to content

Commit

Permalink
doc: document PackManifestOptions to make PackManifest reproducible
Browse files Browse the repository at this point in the history
Signed-off-by: Xiaoxuan Wang <[email protected]>
  • Loading branch information
wangxiaoxuan273 committed Apr 23, 2024
1 parent 11d464f commit 6a24a6b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pack.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 6a24a6b

Please sign in to comment.