Skip to content
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

feat!: pass annotations as a string #468

Merged
merged 24 commits into from
Aug 15, 2022

Conversation

junczhu
Copy link
Contributor

@junczhu junczhu commented Aug 2, 2022

Resolve #362

BREAKING CHANGE: update annotation UX
Signed-off-by: Juncheng Zhu junczhu@microsoft.com

Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
@codecov-commenter
Copy link

codecov-commenter commented Aug 2, 2022

Codecov Report

Merging #468 (c0ea7d6) into main (7c6fbdb) will increase coverage by 11.88%.
The diff coverage is 81.25%.

@@             Coverage Diff             @@
##             main     #468       +/-   ##
===========================================
+ Coverage   55.69%   67.58%   +11.88%     
===========================================
  Files           6        7        +1     
  Lines         237      327       +90     
===========================================
+ Hits          132      221       +89     
+ Misses         90       85        -5     
- Partials       15       21        +6     
Impacted Files Coverage Δ
cmd/oras/internal/option/packer.go 81.25% <81.25%> (ø)
internal/cache/target.go 72.46% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

junczhu added 4 commits August 3, 2022 02:32
…uggestion

Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
@junczhu junczhu marked this pull request as ready for review August 3, 2022 07:07
@qweeah
Copy link
Contributor

qweeah commented Aug 4, 2022

We need unit tests. Let there be unit tests.

junczhu added 5 commits August 4, 2022 14:23
Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
@junczhu
Copy link
Contributor Author

junczhu commented Aug 8, 2022

Going to update UX, as discussed with the community, exiting with error when both flags are provided is a good option for now. @shizhMSFT

/cc @sajayantony @qweeah

@qweeah
Copy link
Contributor

qweeah commented Aug 8, 2022

Going to update UX, as discussed with the community, exiting with error when both flags are provided is a good option for now. @shizhMSFT

cc. @sajayantony @qweeah

@junczhuMSFT This looks good. I think #466 can also apply this UX: if both manifest-config and artifact-type are specified for oras push, then exit with error /cc @yuehaoliang-microsoft

Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
@junczhu junczhu changed the title Feat. Pass annotations as a string feat. pass annotations as a string Aug 8, 2022
@junczhu junczhu changed the title feat. pass annotations as a string [WIP]feat. pass annotations as a string Aug 8, 2022
Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
@junczhu junczhu changed the title [WIP]feat. pass annotations as a string feat. pass annotations as a string Aug 8, 2022
@junczhu junczhu changed the title feat. pass annotations as a string feat: pass annotations as a string Aug 8, 2022
@junczhu junczhu changed the title feat: pass annotations as a string feat!: pass annotations as a string Aug 9, 2022
@qweeah
Copy link
Contributor

qweeah commented Aug 10, 2022

@junczhuMSFT Since this changes the pusher option, we should also update CLI help doc for oras push and oras attach

@junczhu
Copy link
Contributor Author

junczhu commented Aug 10, 2022

@junczhuMSFT Since this changes the pusher option, we should also update CLI help doc for oras push and oras attach

Well Noted

@junczhu
Copy link
Contributor Author

junczhu commented Aug 10, 2022

We need unit tests. Let there be unit tests.

Working on it

Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
junczhu and others added 3 commits August 10, 2022 17:15
Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
Copy link
Contributor

@qweeah qweeah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
@junczhu junczhu requested a review from shizhMSFT August 15, 2022 05:33
@shizhMSFT shizhMSFT added this to the v0.14.0 milestone Aug 15, 2022
Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

FileRefs []string
}

// ApplyFlags applies flags to a command flag set.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a clarifying question here! In the first implementation I have, the user could provide an annotations file, and this wasn't just for the manifest, you could have keys $manifest or $config or the fullpath/relative path of a blob to indicate that we want to add annotations there. But now the new argument --annotation key=value seems to be scoped just for the final manifest, and not a config or particular blob. Is this a correct interpretation?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And in this case, wouldn't we only care if both are defined given we have $manifest in the file lookup plus an --annotation? E.g., providing this new flag with an annotation file without manifest annotations should not be an issue, but as I see here the client is just disallowing both to be defined.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @vsoch thank you for insight.

  1. If users want to update annotations including keys $manifest, $config and more, they can use --annotation-file and provide an annotations file
  2. If users only want to update manifest annotations, they can use --annotation. They don't have to create a file just to upload a single annotation
  3. I have set up a condition that --annotation and --annotation-file cannot be both specified to make sure their implements are isolated to each other

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes so my question is why not to allow a file with $manifest and a one off annotation that has a key that doesn’t overlap? It could be a use case given that someone has a file with common/shared annotations and then a few custom to a container. I think this should be allowed because there is no complexity in terms of duplicate keys - it’s just reading a file and then adding one off annotations from the command line. And you’d immediately reject/exit given duplicates only.

TerryHowe pushed a commit to TerryHowe/oras that referenced this pull request Feb 2, 2023
Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ORAS Push should support annotations, without having to specify a file
5 participants