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

added ability to get image digest back via triangulate #3255

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

garethahealy
Copy link
Contributor

@garethahealy garethahealy commented Sep 21, 2023

Summary

Provides the ability to resolve digest for image without the need to use another tool, such as crane/skopeo

Fixes #3034

Documentation

CLI provides self-documentation via extra option on flag.

@haydentherapper
Copy link
Contributor

@garethahealy Thanks for the PR! Looks good, can you rebase and add a comment that demonstrates this in use?

@garethahealy
Copy link
Contributor Author

rebased

@garethahealy
Copy link
Contributor Author

usage:

$ ./cosign triangulate --help
Outputs the located cosign image reference. This is the location cosign stores the specified artifact type.

Usage:
cosign triangulate [flags]

Examples:
  cosign triangulate <IMAGE>

Flags:
    --allow-http-registry=false:
	whether to allow using HTTP protocol while connecting to registries. Don't use this for anything but testing

    --allow-insecure-registry=false:
	whether to allow insecure connections to registries (e.g., with expired or self-signed TLS certificates).
	Don't use this for anything but testing

    --attachment-tag-prefix='':
	optional custom prefix to use for attached image tags. Attachment images are tagged as:
	`[AttachmentTagPrefix]sha256-[TargetImageDigest].[AttachmentName]`

    -h, --help=false:
	help for triangulate

    --k8s-keychain=false:
	whether to use the kubernetes keychain instead of the default keychain (supports workload identity).

    --type='signature':
	related attachment to triangulate (attestation|sbom|signature|digest), default signature (sbom is deprecated)

Global Flags:
      --output-file string   log output to a file
  -t, --timeout duration     timeout for commands (default 3m0s)
  -d, --verbose              log debug output

$ ./cosign triangulate --type=digest gcr.io/projectsigstore/cosign:v1.13.0
gcr.io/projectsigstore/cosign@sha256:398f441c46e58906dc6d3aaaad22fe63f018dc30acbe13b326e5a016e711301c
Screenshot 2023-10-17 at 09 25 40

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 great, thank you!

@codecov
Copy link

codecov bot commented Oct 17, 2023

Codecov Report

Merging #3255 (a638314) into main (022fa26) will increase coverage by 0.00%.
The diff coverage is 61.53%.

@@           Coverage Diff           @@
##             main    #3255   +/-   ##
=======================================
  Coverage   30.65%   30.65%           
=======================================
  Files         155      155           
  Lines        9989     9994    +5     
=======================================
+ Hits         3062     3064    +2     
- Misses       6471     6474    +3     
  Partials      456      456           
Files Coverage Δ
pkg/cosign/fetch.go 0.00% <ø> (ø)
cmd/cosign/cli/options/triangulate.go 0.00% <0.00%> (ø)
pkg/oci/remote/remote.go 36.87% <66.66%> (+0.10%) ⬆️

@haydentherapper
Copy link
Contributor

Can you run make docgen?

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! Not sure why linter is failing, trying to rerun

@haydentherapper
Copy link
Contributor

@cpanato Any guesses why the linter is complaining? we're using the latest golangci-lint version

Signed-off-by: Gareth Healy <garethahealy@gmail.com>
@garethahealy
Copy link
Contributor Author

garethahealy commented Oct 18, 2023

@haydentherapper ; ran linting locally that highlighted an indenting issue - fixed and pushed, hopefully that fixes linting.

green on my fork:

@cpanato
Copy link
Member

cpanato commented Oct 18, 2023

it is all good on the ci side :)

@haydentherapper haydentherapper merged commit 0cf3cef into sigstore:main Oct 18, 2023
28 checks passed
@github-actions github-actions bot added this to the v2.3.0 milestone Oct 18, 2023
@cpanato cpanato modified the milestones: v2.3.0, v2.2.1 Nov 16, 2023
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.

cosign digest subcommand to resolve tag to digest
3 participants