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: add --only flag in cosign copy to copy sign, att & sbom #3247

Merged
merged 5 commits into from
Oct 17, 2023

Conversation

vishal-chdhry
Copy link
Contributor

Summary

Closes: #2002

This PR will add a new --only flag that accept custom string array to download sboms, signatures and attestations

$ cosign copy --only=sbom,sign,att <SRC> <DST>

Release Note

Added --only flag in cosign copy to copy sign, att & sbom

Documentation

Ran make docgen to generate required docs

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>
@codecov
Copy link

codecov bot commented Sep 17, 2023

Codecov Report

Merging #3247 (cfd7ca4) into main (44f7703) will increase coverage by 0.42%.
Report is 46 commits behind head on main.
The diff coverage is 25.00%.

@@            Coverage Diff             @@
##             main    #3247      +/-   ##
==========================================
+ Coverage   30.35%   30.77%   +0.42%     
==========================================
  Files         155      155              
  Lines        9845     9949     +104     
==========================================
+ Hits         2988     3062      +74     
- Misses       6410     6431      +21     
- Partials      447      456       +9     
Files Coverage Δ
cmd/cosign/cli/options/copy.go 0.00% <0.00%> (ø)
cmd/cosign/cli/copy.go 0.00% <0.00%> (ø)
cmd/cosign/cli/copy/copy.go 35.48% <34.78%> (-13.61%) ⬇️

... and 11 files with indirect coverage changes

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>
Copy link
Contributor

@haydentherapper haydentherapper left a comment

Choose a reason for hiding this comment

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

Looks good, just a few nits!

Sorry for the delay, working through the backlog of PRs.

cmd/cosign/cli/options/copy.go Show resolved Hide resolved
cmd/cosign/cli/copy/copy.go Outdated Show resolved Hide resolved
cmd/cosign/cli/options/copy.go Outdated Show resolved Hide resolved
cmd/cosign/cli/copy/copy.go Outdated Show resolved Hide resolved
Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>
@vishal-chdhry
Copy link
Contributor Author

@haydentherapper Fixed, can you please re-review

Copy link
Contributor

@haydentherapper haydentherapper left a comment

Choose a reason for hiding this comment

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

Can you also run make docgen?

@@ -175,12 +174,13 @@ func remoteCopy(ctx context.Context, pusher *remote.Pusher, src, dest name.Refer
return pusher.Push(ctx, dest, got)
}

func parseOnlyFlag(str string, sigOnly bool) []tagMap {
func parseeOnlyOpt(str string, sigOnly bool) []tagMap {
Copy link
Contributor

Choose a reason for hiding this comment

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

spelling "parseOnlyOpt"

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>
@haydentherapper haydentherapper enabled auto-merge (squash) October 17, 2023 19:16
@vishal-chdhry
Copy link
Contributor Author

@haydentherapper fixed

@haydentherapper haydentherapper merged commit 022fa26 into sigstore:main Oct 17, 2023
28 checks passed
@github-actions github-actions bot added this to the v2.3.0 milestone Oct 17, 2023
@cpanato cpanato modified the milestones: v2.3.0, v2.2.1 Nov 16, 2023
haydentherapper added a commit to haydentherapper/cosign that referenced this pull request Dec 4, 2023
PR sigstore#3247 added an --only flag which when set copies only a subset of
metadata. By default the flag is set to an empty string, meaning that by
default copy would copy nothing. This PR fixes this bug so that if only
is unset, copy defaults to the same behavior as before copying
everything.

Also update the tag name to be sig rather than sign for the flag.

Signed-off-by: Hayden Blauzvern <hblauzvern@google.com>
hectorj2f pushed a commit that referenced this pull request Dec 5, 2023
PR #3247 added an --only flag which when set copies only a subset of
metadata. By default the flag is set to an empty string, meaning that by
default copy would copy nothing. This PR fixes this bug so that if only
is unset, copy defaults to the same behavior as before copying
everything.

Also update the tag name to be sig rather than sign for the flag.

Signed-off-by: Hayden Blauzvern <hblauzvern@google.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.

copy: introduce new --sbom-only, --att-only flags
3 participants