-
Notifications
You must be signed in to change notification settings - Fork 13
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 --digest flag #92
Conversation
pkg/oci/skopeo.go
Outdated
return err | ||
} | ||
|
||
fmt.Println("Digest:", digest) |
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.
we shouldn't print out in pkg/
02c1a06
to
13ab9f1
Compare
cmd/oci/oci.go
Outdated
@@ -38,6 +38,8 @@ func init() { | |||
OCICmd.Flags().BoolVarP(&dfSwap, "df-swap", "", false, "Modify base images in Dockerfile") | |||
OCICmd.Flags().StringVarP(&tag, "tag", "t", "", "The tag that will be replaced with original tag in Dockerfile") | |||
OCICmd.Flags().StringVar(&path, "path", "", "The path to Dockerfile") | |||
OCICmd.Flags().BoolVar(&digest, "digest", false, "Get the digest of the image") | |||
OCICmd.Flags().StringVar(&auth, "auth", "", "The auth to use to authenticate to the registry") |
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.
Let's use the same flag name as skopeo for now so this should be dest-creds
.
Also, please add an example on how to use it in the Long
section(for both auth and digest).
pkg/oci/skopeo.go
Outdated
func Push(dir, imageName string, digest bool, auth string) error { | ||
var cmd *exec.Cmd | ||
if digest { | ||
cmd = exec.Command("skopeo", "copy", "--insecure-policy", "dir:"+dir, "docker://"+imageName+"@@unknown-digest@@", "--digestfile=bsf-result/digest", "--dest-creds", auth) |
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.
We can't rely on the directory name being bsf-result
. It is configurable by the user.
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.
Can we use dir
argument somehow?
cmd/oci/oci.go
Outdated
@@ -47,6 +49,7 @@ var OCICmd = &cobra.Command{ | |||
Long: ` | |||
bsf oci <artifact> | |||
bsf oci <artifact> --platform <platform> | |||
bsf oci <artifact> --push --dest-creds user:password |
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.
One more example for digest
flag.
pkg/oci/skopeo.go
Outdated
cmd := exec.Command("nix", "run", "nixpkgs#skopeo", "--", "copy", "--insecure-policy", "dir:"+dir, "docker://"+imageName) | ||
func Push(dir, imageName string, digest bool, destcreds string) error { | ||
var cmd *exec.Cmd | ||
digestPath := strings.Split(dir, "/")[0] + "/digest" |
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.
can we get the digestPath
as an argument? If empty, we do not push by digest.
c772791
to
a7b6f13
Compare
related issue : #39
uses
bsf oci --push --digest --auth=username:password