-
Notifications
You must be signed in to change notification settings - Fork 557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add annotations for upload blob. #2188
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bar |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
foo |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,9 @@ func NewFile(payload []byte, opts ...Option) (oci.File, error) { | |
return nil, err | ||
} | ||
|
||
// Add annotations from options | ||
img = mutate.Annotations(img, o.Annotations).(v1.Image) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of calling mutate again, I think you can add the annotations in the addendum on line 42? img, err := mutate.Append(base, mutate.Addendum{
Layer: layer,
Annotations: annotations,
}) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmmm when using addendum the annotations are not correctly added to the image as it seems. I do believe that the image needs to be annotated (as for CreatedAt) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
No worries! |
||
|
||
// Set the Created date to time of execution | ||
img, err = mutate.CreatedAt(img, v1.Time{Time: time.Now()}) | ||
if err != nil { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're already including annotations when the file is initially created in line 112, do we need to add them in again here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is only run if we have an image index, the annotations are (also) added to the image index, the annotations on line 112 are added to the the image it self. So when accessing a multiplatform image index the annotations needs to be on the index, for a plain image it's enough for them to be on the image.
The tests should handle this :)