-
Notifications
You must be signed in to change notification settings - Fork 31
Feature/docker validate sha #73
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
Conversation
7e9a34e to
2eb0fd6
Compare
2eb0fd6 to
c7c68f1
Compare
| if err != nil || buildInfoModule == nil { | ||
| return err | ||
| } |
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.
handle both err and buildInfoModule conditions separately
if err != nil {
return errorutils.CheckError(fmt.Errorf("failed to build module info: %w", err))
}
if buildInfoModule == nil {
return errorutils.CheckErrorf("build info module is nil")
}
| if pc.IsValidateSha() { | ||
| log.Info("Performing SHA-based validation for Docker push...") | ||
| // Get image SHA from the container manager | ||
| imageSha2, err := cm.Id(pc.image) |
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.
| imageSha2, err := cm.Id(pc.image) | |
| imageSha256, err := cm.Id(pc.image) |
is it imageSHA256 ?
| return err | ||
| } | ||
| if err = build.SaveBuildInfo(buildName, buildNumber, pc.BuildConfiguration().GetProject(), buildInfoModule); err != nil { | ||
| return err |
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.
| return err | |
| return errorutils.CheckError(fmt.Errorf("failed to save build info: %w", err)) |
| _, err = remoteBuilder.Build("") | ||
| if err != nil { | ||
| return err | ||
| } |
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.
| _, err = remoteBuilder.Build("") | |
| if err != nil { | |
| return err | |
| } | |
| if _, err = remoteBuilder.Build(""); err != nil { | |
| return errorutils.CheckError(fmt.Errorf("failed to build summary info: %w", err)) | |
| } |
nit picking
|
|
||
| // Docker specific commands flags | ||
| skipLogin: components.NewBoolFlag(skipLogin, "[Default: false] Set to true if you'd like the command to skip performing docker login.", components.WithBoolDefaultValueFalse()), | ||
| validateSha: components.NewBoolFlag(validateSha, "[Default: false] Set to true to enable SHA validation during Docker push.", components.WithBoolDefaultValueFalse()), |
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.
flag documentation has to be updated in jfrog/jfrog-documentation?
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.
Yes, will add this there as well.
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.
de829b9 to
342dbcf
Compare
…e-file" This reverts commit 51678d2.
08d064f to
1e1af0b
Compare
Add
--validate-shaflag for Docker push commandDescription
This PR adds support for the new
--validate-shaflag to the Docker push command. When enabled, the flag allows the CLI to use the image's SHA digest for validation instead of the tag name during Docker push operations. This is particularly useful when pushing to virtual repositories where the tag might exist with different content in higher priority repositories.Changes
cliutils/flagkit/flags.gocommands/container/containermanagerbase.goto add validateSha field and methodscommands/container/push.goto implement the SHA-based validation logicTesting
Related PRs