@@ -48,8 +48,8 @@ const (
48
48
49
49
var (
50
50
// ErrInvalidDateTimeFormat is returned by [Pack] and [PackManifest] when
51
- // AnnotationArtifactCreated or AnnotationCreated is provided, but its value
52
- // is not in RFC 3339 format.
51
+ // "org.opencontainers.artifact.created" or "org.opencontainers.image.created"
52
+ // is provided, but its value is not in RFC 3339 format.
53
53
// Reference: https://www.rfc-editor.org/rfc/rfc3339#section-5.6
54
54
ErrInvalidDateTimeFormat = errors .New ("invalid date and time format" )
55
55
@@ -93,7 +93,10 @@ type PackManifestOptions struct {
93
93
// Layers is the layers of the manifest.
94
94
Layers []ocispec.Descriptor
95
95
96
- // ManifestAnnotations is the annotation map of the manifest.
96
+ // ManifestAnnotations is the annotation map of the manifest. In order to
97
+ // make [PackManifest] reproducible, set the key ocispec.AnnotationCreated
98
+ // (i.e. "org.opencontainers.image.created") to a fixed value. The value
99
+ // must conform to RFC 3339.
97
100
ManifestAnnotations map [string ]string
98
101
99
102
// ConfigDescriptor is a pointer to the descriptor of the config blob.
@@ -126,6 +129,12 @@ var mediaTypeRegexp = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9!#$&-^_.+]{0,126
126
129
//
127
130
// artifactType and opts.ConfigDescriptor.MediaType MUST comply with RFC 6838.
128
131
//
132
+ // Each time when PackManifest is called, if a time stamp is not specified, a new time
133
+ // stamp is generated in the manifest annotations with the key ocispec.AnnotationCreated
134
+ // (i.e. "org.opencontainers.image.created"). To make [PackManifest] reproducible,
135
+ // set the key ocispec.AnnotationCreated to a fixed value in
136
+ // opts.ManifestAnnotations. The value MUST conform to RFC 3339.
137
+ //
129
138
// If succeeded, returns a descriptor of the packed manifest.
130
139
func PackManifest (ctx context.Context , pusher content.Pusher , packManifestVersion PackManifestVersion , artifactType string , opts PackManifestOptions ) (ocispec.Descriptor , error ) {
131
140
switch packManifestVersion {
0 commit comments