Skip to content

Commit 4c4a60a

Browse files
committed
Merge remote-tracking branch 'upstream/dev' into static_sca_violations_remediations
2 parents 0420134 + eb980ad commit 4c4a60a

File tree

5 files changed

+19
-6
lines changed

5 files changed

+19
-6
lines changed

cli/docs/flags.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ const (
110110
MinSeverity = "min-severity"
111111
FixableOnly = "fixable-only"
112112
Rescan = "rescan"
113+
TriggerScanRetries = "trigger-scan-retries"
113114
Vuln = "vuln"
114115
buildPrefix = "build-"
115116
BuildVuln = buildPrefix + Vuln
@@ -161,7 +162,7 @@ var commandFlags = map[string][]string{
161162
url, user, password, accessToken, ServerId, Threads, InsecureTls,
162163
},
163164
BuildScan: {
164-
url, user, password, accessToken, ServerId, scanProjectKey, BuildVuln, OutputFormat, Fail, ExtendedTable, Rescan, InsecureTls,
165+
url, user, password, accessToken, ServerId, scanProjectKey, BuildVuln, OutputFormat, Fail, ExtendedTable, Rescan, InsecureTls, TriggerScanRetries,
165166
},
166167
DockerScan: {
167168
url, xrayUrl, user, password, accessToken, ServerId, scanProjectKey, Watches, RepoPath, Licenses, Sbom, OutputFormat, Fail, ExtendedTable, BypassArchiveLimits, MinSeverity, FixableOnly, ScanVuln, SecretValidation, InsecureTls,
@@ -257,6 +258,7 @@ var flagsMap = map[string]components.Flag{
257258
MinSeverity: components.NewStringFlag(MinSeverity, "Set the minimum severity of issues to display. Acceptable values: Low, Medium, High, or Critical."),
258259
FixableOnly: components.NewBoolFlag(FixableOnly, "Set to true if you wish to display issues that have a fix version only."),
259260
Rescan: components.NewBoolFlag(Rescan, "Set to true when scanning an already successfully scanned build, for example after adding an ignore rule."),
261+
TriggerScanRetries: components.NewStringFlag(TriggerScanRetries, "Number of retries for triggering the build scan in Xray in case of failure.", components.WithIntDefaultValue(12)), // 5 seconds * 12 = 1 minute
260262
BuildVuln: components.NewBoolFlag(Vuln, "Set to true if you'd like to receive all vulnerabilities, regardless of the policy configured in Xray. Ignored if provided 'format' is 'sarif'."),
261263
ScanVuln: components.NewBoolFlag(Vuln, "Set to true if you'd like to receive all vulnerabilities, regardless of the policy configured in Xray."),
262264
InsecureTls: components.NewBoolFlag(InsecureTls, "Set to true to skip TLS certificates verification."),

cli/scancommands.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,10 @@ func BuildScan(c *components.Context) error {
353353
if err != nil {
354354
return err
355355
}
356+
fetchRetries, err := c.GetIntFlagValue(flags.TriggerScanRetries)
357+
if err != nil {
358+
return err
359+
}
356360
if err = validateConnectionAndViolationContextInputs(c, serverDetails, format); err != nil {
357361
return err
358362
}
@@ -361,6 +365,7 @@ func BuildScan(c *components.Context) error {
361365
// Sarif shouldn't include the additional all-vulnerabilities info that received by adding the vuln flag
362366
SetIncludeVulnerabilities(getProject(c) == "" || (format != outputFormat.Sarif && c.GetBoolFlagValue(flags.Vuln))).
363367
SetFailBuild(c.GetBoolFlagValue(flags.Fail)).
368+
SetTriggerScanRetries(fetchRetries).
364369
SetBuildConfiguration(buildConfiguration).
365370
SetOutputFormat(format).
366371
SetPrintExtendedTable(c.GetBoolFlagValue(flags.ExtendedTable)).

commands/scan/buildscan.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ type BuildScanCommand struct {
3333
failBuild bool
3434
printExtendedTable bool
3535
rescan bool
36+
triggerRetries int
3637
}
3738

3839
func NewBuildScanCommand() *BuildScanCommand {
@@ -78,6 +79,11 @@ func (bsc *BuildScanCommand) SetRescan(rescan bool) *BuildScanCommand {
7879
return bsc
7980
}
8081

82+
func (bsc *BuildScanCommand) SetTriggerScanRetries(triggerRetries int) *BuildScanCommand {
83+
bsc.triggerRetries = triggerRetries
84+
return bsc
85+
}
86+
8187
// Scan published builds with Xray
8288
func (bsc *BuildScanCommand) Run() (err error) {
8389
xrayManager, xrayVersion, err := xrayutils.CreateXrayServiceManagerAndGetVersion(bsc.serverDetails, xrayutils.WithScopedProjectKey(bsc.buildConfiguration.GetProject()))
@@ -121,7 +127,7 @@ func (bsc *BuildScanCommand) Run() (err error) {
121127
}
122128

123129
func (bsc *BuildScanCommand) runBuildScanAndPrintResults(xrayManager *xray.XrayServicesManager, xrayVersion string, params services.XrayBuildParams) (isFailBuildResponse bool, err error) {
124-
buildScanResults, noFailBuildPolicy, err := xrayManager.BuildScan(params, bsc.includeVulnerabilities)
130+
buildScanResults, noFailBuildPolicy, err := xrayManager.BuildScan(params, bsc.includeVulnerabilities, bsc.triggerRetries)
125131
if err != nil {
126132
return false, err
127133
}

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ require (
1414
github.com/gookit/color v1.6.0
1515
github.com/hashicorp/go-hclog v1.6.3
1616
github.com/hashicorp/go-plugin v1.6.3
17-
github.com/jfrog/build-info-go v1.12.0
17+
github.com/jfrog/build-info-go v1.12.1
1818
github.com/jfrog/froggit-go v1.20.4
1919
github.com/jfrog/gofrog v1.7.6
2020
github.com/jfrog/jfrog-apps-config v1.0.1
2121
github.com/jfrog/jfrog-cli-artifactory v0.7.3-0.20251021143342-49bab7f38cec
2222
github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20251023084247-a56afca52451
23-
github.com/jfrog/jfrog-client-go v1.55.1-0.20251023073119-78f187c9afbf
23+
github.com/jfrog/jfrog-client-go v1.55.1-0.20251030113529-d87ecf28ffb6
2424
github.com/magiconair/properties v1.8.10
2525
github.com/owenrumney/go-sarif/v3 v3.2.3
2626
github.com/package-url/packageurl-go v0.1.3

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ github.com/jedib0t/go-pretty/v6 v6.6.8 h1:JnnzQeRz2bACBobIaa/r+nqjvws4yEhcmaZ4n1
130130
github.com/jedib0t/go-pretty/v6 v6.6.8/go.mod h1:YwC5CE4fJ1HFUDeivSV1r//AmANFHyqczZk+U6BDALU=
131131
github.com/jfrog/archiver/v3 v3.6.1 h1:LOxnkw9pOn45DzCbZNFV6K0+6dCsQ0L8mR3ZcujO5eI=
132132
github.com/jfrog/archiver/v3 v3.6.1/go.mod h1:VgR+3WZS4N+i9FaDwLZbq+jeU4B4zctXL+gL4EMzfLw=
133-
github.com/jfrog/build-info-go v1.12.0 h1:/abBQdIxrkYjOwO79sIL0p+XPnMCCtKhiWToHKXXqHg=
134-
github.com/jfrog/build-info-go v1.12.0/go.mod h1:szdz9+WzB7+7PGnILLUgyY+OF5qD5geBT7UGNIxibyw=
133+
github.com/jfrog/build-info-go v1.12.1 h1:pXyx2F3MzrdbLPhYU8om+RHl87yEDYW+UwAUw3f40fQ=
134+
github.com/jfrog/build-info-go v1.12.1/go.mod h1:szdz9+WzB7+7PGnILLUgyY+OF5qD5geBT7UGNIxibyw=
135135
github.com/jfrog/froggit-go v1.20.4 h1:N9XkNV00HNjpI8p6xXlF9DrWmvE9hz3z2XRDAYJDweQ=
136136
github.com/jfrog/froggit-go v1.20.4/go.mod h1:obSG1SlsWjktkuqmKtpq7MNTTL63e0ot+ucTnlOMV88=
137137
github.com/jfrog/gofrog v1.7.6 h1:QmfAiRzVyaI7JYGsB7cxfAJePAZTzFz0gRWZSE27c6s=

0 commit comments

Comments
 (0)