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

Add multi_scan_id to scan params for sca scan flow #891

Merged
merged 1 commit into from
Jan 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions xray/services/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ const (

XscGraphAPI = "api/v1/sca/scan/graph"

multiScanIdParam = "multi_scan_id="

scanTechQueryParam = "tech="

XscVersionAPI = "api/v1/system/version"
Expand Down Expand Up @@ -83,6 +85,7 @@ func createScanGraphQueryParams(scanParams XrayGraphScanParams) string {
}

if scanParams.XscVersion != "" {
params = append(params, multiScanIdParam+scanParams.MultiScanId)
gitInfoContext := scanParams.XscGitInfoContext
if gitInfoContext != nil {
if len(gitInfoContext.Technologies) > 0 {
Expand All @@ -108,6 +111,7 @@ func (ss *ScanService) ScanGraph(scanParams XrayGraphScanParams) (string, error)
if err != nil {
return "", fmt.Errorf("failed sending Git Info to XSC service, error: %s ", err.Error())
}
scanParams.MultiScanId = multiScanId
if err = os.Setenv("JF_MSI", multiScanId); err != nil {
// Not a fatal error, if not set the scan will not be shown at the XSC UI, should not fail the scan.
log.Debug(fmt.Sprintf("failed setting MSI as environment variable. Cause: %s", err.Error()))
Expand Down Expand Up @@ -281,6 +285,7 @@ type XrayGraphScanParams struct {
IncludeLicenses bool
XscGitInfoContext *XscGitInfoContext
XscVersion string
MultiScanId string
}

type RequestScanResponse struct {
Expand Down
Loading