Skip to content

Commit cbc0800

Browse files
committed
resolve discussions
1 parent bd4157c commit cbc0800

19 files changed

+211
-393
lines changed

evidence/cli/command_build.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func NewEvidenceBuildCommand(ctx *components.Context, execute execCommandFunc) E
2222

2323
func (ebc *evidenceBuildCommand) CreateEvidence(ctx *components.Context, serverDetails *config.ServerDetails) error {
2424
if ebc.ctx.GetStringFlagValue(sigstoreBundle) != "" {
25-
return errorutils.CheckErrorf("--sigstore-bundle is currently not supported for build evidence. This feature may be supported in future releases.")
25+
return errorutils.CheckErrorf("--%s is currently not supported for build evidence.", sigstoreBundle)
2626
}
2727

2828
err := ebc.validateEvidenceBuildContext(ctx)

evidence/cli/command_build_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func TestEvidenceBuildCommand_CreateEvidence_SigstoreBundle(t *testing.T) {
2626
setDefaultValue(buildNumber, "123"),
2727
},
2828
expectError: true,
29-
errorContains: "--sigstore-bundle is currently not supported for build evidence. This feature may be supported in future releases.",
29+
errorContains: "--sigstore-bundle is currently not supported for build evidence.",
3030
},
3131
{
3232
name: "Valid_Without_SigstoreBundle",

evidence/cli/command_cli.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func validateCreateEvidenceCommonContext(ctx *components.Context) error {
120120
}
121121

122122
if ctx.IsFlagSet(sigstoreBundle) && assertValueProvided(ctx, sigstoreBundle) == nil {
123-
if err := validateSigstoreBundleConflicts(ctx); err != nil {
123+
if err := validateSigstoreBundleArgsConflicts(ctx); err != nil {
124124
return err
125125
}
126126
return nil
@@ -144,24 +144,24 @@ func validateCreateEvidenceCommonContext(ctx *components.Context) error {
144144
return nil
145145
}
146146

147-
func validateSigstoreBundleConflicts(ctx *components.Context) error {
147+
func validateSigstoreBundleArgsConflicts(ctx *components.Context) error {
148148
var conflictingParams []string
149149

150150
if ctx.IsFlagSet(key) && ctx.GetStringFlagValue(key) != "" {
151-
conflictingParams = append(conflictingParams, "--key")
151+
conflictingParams = append(conflictingParams, "--"+key)
152152
}
153153
if ctx.IsFlagSet(keyAlias) && ctx.GetStringFlagValue(keyAlias) != "" {
154-
conflictingParams = append(conflictingParams, "--key-alias")
154+
conflictingParams = append(conflictingParams, "--"+keyAlias)
155155
}
156156
if ctx.IsFlagSet(predicate) && ctx.GetStringFlagValue(predicate) != "" {
157-
conflictingParams = append(conflictingParams, "--predicate")
157+
conflictingParams = append(conflictingParams, "--"+predicate)
158158
}
159159
if ctx.IsFlagSet(predicateType) && ctx.GetStringFlagValue(predicateType) != "" {
160-
conflictingParams = append(conflictingParams, "--predicate-type")
160+
conflictingParams = append(conflictingParams, "--"+predicateType)
161161
}
162162

163163
if len(conflictingParams) > 0 {
164-
return errorutils.CheckErrorf("The following parameters cannot be used with --sigstore-bundle: %s. When using --sigstore-bundle, these values are extracted from the bundle itself.", strings.Join(conflictingParams, ", "))
164+
return errorutils.CheckErrorf("The following parameters cannot be used with --%s: %s. These values are extracted from the bundle itself:", sigstoreBundle, strings.Join(conflictingParams, ", "))
165165
}
166166

167167
return nil
@@ -238,7 +238,7 @@ func validateKeys(ctx *components.Context) error {
238238
providedKeys := ctx.GetStringsArrFlagValue(publicKeys)
239239
if signingKeyValue == "" {
240240
if len(providedKeys) == 0 && !ctx.GetBoolFlagValue(useArtifactoryKeys) {
241-
return errorutils.CheckErrorf("JFROG_CLI_SIGNING_KEY env variable or --public-keys flag or --use-artifactory-publicKeys must be provided when verifying evidence")
241+
return errorutils.CheckErrorf("JFROG_CLI_SIGNING_KEY env variable or --%s flag or --%s must be provided when verifying evidence", publicKeys, useArtifactoryKeys)
242242
}
243243
return nil
244244
}
@@ -292,7 +292,7 @@ func platformToEvidenceUrls(rtDetails *config.ServerDetails) {
292292

293293
func assertValueProvided(c *components.Context, fieldName string) error {
294294
if c.GetStringFlagValue(fieldName) == "" {
295-
return errorutils.CheckErrorf("the --%s option is mandatory", fieldName)
295+
return errorutils.CheckErrorf("the argument --%s can not be empty", fieldName)
296296
}
297297
return nil
298298
}

evidence/cli/command_cli_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ func TestValidateSigstoreBundleConflicts(t *testing.T) {
586586
t.Fatal(err)
587587
}
588588

589-
err = validateSigstoreBundleConflicts(context)
589+
err = validateSigstoreBundleArgsConflicts(context)
590590

591591
if tt.expectError {
592592
assert.Error(t, err)

evidence/cli/command_custom.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func NewEvidenceCustomCommand(ctx *components.Context, execute execCommandFunc)
2121
}
2222
func (ecc *evidenceCustomCommand) CreateEvidence(_ *components.Context, serverDetails *config.ServerDetails) error {
2323
if ecc.ctx.GetStringFlagValue(sigstoreBundle) != "" && ecc.ctx.GetStringFlagValue(subjectSha256) != "" {
24-
return errorutils.CheckErrorf("The parameter --subject-sha256 cannot be used with --sigstore-bundle. When using --sigstore-bundle, the subject hash is extracted from the bundle itself.")
24+
return errorutils.CheckErrorf("The parameter --%s cannot be used with --%s. The subject hash is extracted from the bundle itself.", subjectSha256, sigstoreBundle)
2525
}
2626

2727
// Single command handles both regular evidence creation and sigstore bundles

evidence/cli/command_github.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func NewEvidenceGitHubCommand(ctx *components.Context, execute execCommandFunc)
2121

2222
func (ebc *evidenceGitHubCommand) CreateEvidence(ctx *components.Context, serverDetails *config.ServerDetails) error {
2323
if ebc.ctx.GetStringFlagValue(sigstoreBundle) != "" {
24-
return errorutils.CheckErrorf("--sigstore-bundle is currently not supported for GitHub evidence. This feature may be supported in future releases.")
24+
return errorutils.CheckErrorf("--%s is currently not supported for GitHub evidence.", sigstoreBundle)
2525
}
2626

2727
err := ebc.validateEvidenceBuildContext(ctx)

evidence/cli/command_github_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func TestEvidenceGitHubCommand_CreateEvidence_SigstoreBundle(t *testing.T) {
2727
setDefaultValue(typeFlag, "github"),
2828
},
2929
expectError: true,
30-
errorContains: "--sigstore-bundle is currently not supported for GitHub evidence. This feature may be supported in future releases.",
30+
errorContains: "--sigstore-bundle is currently not supported for GitHub evidence.",
3131
},
3232
{
3333
name: "Valid_Without_SigstoreBundle",

evidence/cli/command_package.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func NewEvidencePackageCommand(ctx *components.Context, execute execCommandFunc)
2222

2323
func (epc *evidencePackageCommand) CreateEvidence(ctx *components.Context, serverDetails *config.ServerDetails) error {
2424
if epc.ctx.GetStringFlagValue(sigstoreBundle) != "" {
25-
return errorutils.CheckErrorf("--sigstore-bundle is currently not supported for package evidence. This feature may be supported in future releases.")
25+
return errorutils.CheckErrorf("--%s is currently not supported for package evidence.", sigstoreBundle)
2626
}
2727

2828
err := epc.validateEvidencePackageContext(ctx)

evidence/cli/command_package_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func TestEvidencePackageCommand_CreateEvidence_SigstoreBundle(t *testing.T) {
2727
setDefaultValue(packageRepoName, "test-repo"),
2828
},
2929
expectError: true,
30-
errorContains: "--sigstore-bundle is currently not supported for package evidence. This feature may be supported in future releases.",
30+
errorContains: "--sigstore-bundle is currently not supported for package evidence.",
3131
},
3232
{
3333
name: "Valid_Without_SigstoreBundle",

evidence/cli/command_release_bundle.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func NewEvidenceReleaseBundleCommand(ctx *components.Context, execute execComman
2222

2323
func (erc *evidenceReleaseBundleCommand) CreateEvidence(ctx *components.Context, serverDetails *config.ServerDetails) error {
2424
if erc.ctx.GetStringFlagValue(sigstoreBundle) != "" {
25-
return errorutils.CheckErrorf("--sigstore-bundle is currently not supported for release bundle evidence. This feature may be supported in future releases.")
25+
return errorutils.CheckErrorf("--%s is currently not supported for release bundle evidence.", sigstoreBundle)
2626
}
2727

2828
err := erc.validateEvidenceReleaseBundleContext(ctx)

0 commit comments

Comments
 (0)