Skip to content

Commit 0c16d36

Browse files
Merge pull request #169 from synopsys-sig/SIGINT-865
SIGINT-865: Support async mode
2 parents 3957b01 + 641355e commit 0c16d36

File tree

12 files changed

+231
-13
lines changed

12 files changed

+231
-13
lines changed

synopsys-task/dist/index.js

+30-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

synopsys-task/dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

synopsys-task/src/synopsys-task/application-constant.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ export const POLARIS_ASSESSMENT_MODE_KEY_CLASSIC_EDITOR =
139139
"polarisAssessmentMode";
140140
export const POLARIS_TEST_SCA_TYPE_KEY = "polaris_test_sca_type";
141141
export const POLARIS_TEST_SCA_TYPE_KEY_CLASSIC_EDITOR = "polarisTestScaType";
142+
export const POLARIS_WAITFORSCAN_KEY = "polaris_waitForScan";
143+
export const POLARIS_WAITFORSCAN_KEY_CLASSIC_EDITOR = "polarisWaitForScan";
142144
export const POLARIS_PROJECT_DIRECTORY_KEY_CLASSIC_EDITOR =
143145
"polarisProjectDirectory";
144146
export const PROJECT_SOURCE_ARCHIVE_KEY = "project_source_archive";
@@ -216,6 +218,8 @@ export const COVERITY_POLICY_VIEW_KEY_CLASSIC_EDITOR =
216218
*/
217219
export const BRIDGE_COVERITY_AUTOMATION_PRCOMMENT_KEY =
218220
"bridge_coverity_automation_prcomment";
221+
export const COVERITY_WAITFORSCAN_KEY = "coverity_waitForScan";
222+
export const COVERITY_WAITFORSCAN_KEY_CLASSIC_EDITOR = "coverityWaitForScan";
219223
export const COVERITY_PROJECT_DIRECTORY_KEY_CLASSIC_EDITOR =
220224
"coverityProjectDirectory";
221225
export const COVERITY_PRCOMMENT_ENABLED_KEY = "coverity_prComment_enabled";
@@ -486,7 +490,8 @@ export const BLACKDUCK_FIXPR_UPGRADE_GUIDANCE_KEY =
486490
"blackduck_fixpr_useUpgradeGuidance";
487491
export const BLACKDUCK_FIXPR_UPGRADE_GUIDANCE_KEY_CLASSIC_EDITOR =
488492
"bridge_blackduck_fixpr_useUpgradeGuidance";
489-
493+
export const BLACKDUCK_WAITFORSCAN_KEY = "blackduck_waitForScan";
494+
export const BLACKDUCK_WAITFORSCAN_KEY_CLASSIC_EDITOR = "blackduckWaitForScan";
490495
export const BLACKDUCK_PROJECT_DIRECTORY_KEY_CLASSIC_EDITOR =
491496
"blackduckProjectDirectory";
492497

@@ -566,6 +571,9 @@ export const SRM_BRANCH_NAME_KEY_CLASSIC_EDITOR = "srmBranchName";
566571
export const SRM_BRANCH_PARENT_KEY = "srm_branch_parent";
567572
export const SRM_BRANCH_PARENT_KEY_CLASSIC_EDITOR = "srmBranchParent";
568573

574+
export const SRM_WAITFORSCAN_KEY = "srm_waitForScan";
575+
export const SRM_WAITFORSCAN_KEY_CLASSIC_EDITOR = "srmWaitForScan";
576+
569577
export const SRM_PROJECT_DIRECTORY_KEY_CLASSIC_EDITOR = "srmProjectDirectory";
570578

571579
export const INCLUDE_DIAGNOSTICS_KEY = "include_diagnostics";

synopsys-task/src/synopsys-task/input.ts

+20
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,11 @@ export const POLARIS_TEST_SCA_TYPE = getInput(
228228
constants.POLARIS_TEST_SCA_TYPE_KEY_CLASSIC_EDITOR,
229229
null
230230
);
231+
export const POLARIS_WAITFORSCAN = getInput(
232+
constants.POLARIS_WAITFORSCAN_KEY,
233+
constants.POLARIS_WAITFORSCAN_KEY_CLASSIC_EDITOR,
234+
null
235+
);
231236

232237
export const POLARIS_ASSESSMENT_MODE = getInputForPolarisAssessmentMode();
233238

@@ -345,6 +350,11 @@ export const COVERITY_VERSION = getInput(
345350
constants.COVERITY_VERSION_KEY_CLASSIC_EDITOR,
346351
constants.BRIDGE_COVERITY_VERSION_KEY
347352
);
353+
export const COVERITY_WAITFORSCAN = getInput(
354+
constants.COVERITY_WAITFORSCAN_KEY,
355+
constants.COVERITY_WAITFORSCAN_KEY_CLASSIC_EDITOR,
356+
null
357+
);
348358
export const COVERITY_PROJECT_DIRECTORY = getInput(
349359
constants.PROJECT_DIRECTORY_KEY,
350360
constants.COVERITY_PROJECT_DIRECTORY_KEY_CLASSIC_EDITOR,
@@ -459,6 +469,11 @@ export const BLACKDUCK_REPORTS_SARIF_FILE_PATH = getInput(
459469
constants.BLACKDUCK_REPORTS_SARIF_FILE_PATH_KEY_CLASSIC_EDITOR,
460470
constants.BRIDGE_BLACKDUCK_REPORTS_SARIF_FILE_PATH_KEY
461471
);
472+
export const BLACKDUCK_WAITFORSCAN = getInput(
473+
constants.BLACKDUCK_WAITFORSCAN_KEY,
474+
constants.BLACKDUCK_WAITFORSCAN_KEY_CLASSIC_EDITOR,
475+
null
476+
);
462477
export const BLACKDUCK_PROJECT_DIRECTORY = getInput(
463478
constants.PROJECT_DIRECTORY_KEY,
464479
constants.BLACKDUCK_PROJECT_DIRECTORY_KEY_CLASSIC_EDITOR,
@@ -532,6 +547,11 @@ export const SRM_BRANCH_PARENT = getInput(
532547
constants.SRM_BRANCH_PARENT_KEY_CLASSIC_EDITOR,
533548
null
534549
);
550+
export const SRM_WAITFORSCAN = getInput(
551+
constants.SRM_WAITFORSCAN_KEY,
552+
constants.SRM_WAITFORSCAN_KEY_CLASSIC_EDITOR,
553+
null
554+
);
535555
export const SRM_PROJECT_DIRECTORY = getInput(
536556
constants.PROJECT_DIRECTORY_KEY,
537557
constants.SRM_PROJECT_DIRECTORY_KEY_CLASSIC_EDITOR,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export interface AsyncMode {
2+
waitForScan?: boolean;
3+
}

synopsys-task/src/synopsys-task/model/blackduck.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { AzureData } from "./azure";
22
import { Reports } from "./reports";
3+
import { AsyncMode } from "./async-mode";
34
export enum BLACKDUCK_SCAN_FAILURE_SEVERITIES {
45
ALL = "ALL",
56
NONE = "NONE",
@@ -20,7 +21,7 @@ export interface Blackduck {
2021
environment?: Environment;
2122
}
2223

23-
export interface BlackduckData extends BlackDuckArbitrary {
24+
export interface BlackduckData extends BlackDuckArbitrary, AsyncMode {
2425
url: string;
2526
token: string;
2627
install?: { directory: string };

synopsys-task/src/synopsys-task/model/coverity.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { AzureData } from "./azure";
22
import { Environment } from "./blackduck";
3+
import { AsyncMode } from "./async-mode";
34
import exp from "constants";
45

56
export interface Coverity {
@@ -19,7 +20,7 @@ export interface AutomationData {
1920
prcomment?: boolean;
2021
}
2122

22-
export interface CoverityConnect extends CoverityArbitrary {
23+
export interface CoverityConnect extends CoverityArbitrary, AsyncMode {
2324
connect: CoverityData;
2425
install?: { directory: string };
2526
automation?: AutomationData;

synopsys-task/src/synopsys-task/model/polaris.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { AzureData } from "./azure";
2-
2+
import { AsyncMode } from "./async-mode";
33
import { Reports } from "./reports";
44
import {
55
Coverity,
@@ -17,7 +17,7 @@ export interface Polaris {
1717
blackduck?: BlackDuckArbitrary;
1818
}
1919

20-
export interface PolarisData {
20+
export interface PolarisData extends AsyncMode {
2121
triage?: string;
2222
accesstoken: string;
2323
serverUrl: string;

synopsys-task/src/synopsys-task/model/srm.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { CoverityArbitrary } from "./coverity";
22
import { BlackDuckArbitrary } from "./blackduck";
3+
import { AsyncMode } from "./async-mode";
34

45
export interface Srm {
56
srm: SrmData;
@@ -8,7 +9,7 @@ export interface Srm {
89
project?: ProjectData;
910
}
1011

11-
export interface SrmData {
12+
export interface SrmData extends AsyncMode {
1213
url: string;
1314
apikey: string;
1415
assessment: { types: string[] };

synopsys-task/src/synopsys-task/tools-parameter.ts

+23
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ export class SynopsysToolsParameter {
130130
};
131131
}
132132

133+
if (isBoolean(inputs.POLARIS_WAITFORSCAN)) {
134+
polData.data.polaris.waitForScan = parseToBoolean(
135+
inputs.POLARIS_WAITFORSCAN
136+
);
137+
}
138+
133139
if (
134140
inputs.POLARIS_PROJECT_DIRECTORY ||
135141
inputs.PROJECT_SOURCE_ARCHIVE ||
@@ -265,6 +271,12 @@ export class SynopsysToolsParameter {
265271
},
266272
};
267273

274+
if (isBoolean(inputs.BLACKDUCK_WAITFORSCAN)) {
275+
blackduckData.data.blackduck.waitForScan = parseToBoolean(
276+
inputs.BLACKDUCK_WAITFORSCAN
277+
);
278+
}
279+
268280
if (inputs.BLACKDUCK_PROJECT_DIRECTORY) {
269281
blackduckData.data.project = {
270282
directory: inputs.BLACKDUCK_PROJECT_DIRECTORY,
@@ -529,6 +541,12 @@ export class SynopsysToolsParameter {
529541
};
530542
}
531543

544+
if (isBoolean(inputs.COVERITY_WAITFORSCAN)) {
545+
covData.data.coverity.waitForScan = parseToBoolean(
546+
inputs.COVERITY_WAITFORSCAN
547+
);
548+
}
549+
532550
if (inputs.COVERITY_PROJECT_DIRECTORY) {
533551
covData.data.project = {
534552
directory: inputs.COVERITY_PROJECT_DIRECTORY,
@@ -716,6 +734,11 @@ export class SynopsysToolsParameter {
716734
},
717735
};
718736
}
737+
738+
if (isBoolean(inputs.SRM_WAITFORSCAN)) {
739+
srmData.data.srm.waitForScan = parseToBoolean(inputs.SRM_WAITFORSCAN);
740+
}
741+
719742
if (inputs.SRM_PROJECT_DIRECTORY) {
720743
srmData.data.project = {
721744
directory: inputs.SRM_PROJECT_DIRECTORY,

synopsys-task/task.json

+40
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,16 @@
201201
"visibleRule": "scanType = polaris",
202202
"groupName": "scanOptions"
203203
},
204+
{
205+
"name": "polarisWaitForScan",
206+
"type": "boolean",
207+
"label": "Polaris Wait For Scan",
208+
"defaultValue": true,
209+
"required": false,
210+
"helpMarkDown": "It specifies whether the workflow should wait for the analysis to complete or not. Default value: true.",
211+
"visibleRule": "scanType = polaris",
212+
"groupName": "scanOptions"
213+
},
204214
{
205215
"name": "polarisPRCommentEnabled",
206216
"type": "boolean",
@@ -416,6 +426,16 @@
416426
"visibleRule": "scanType = coverity",
417427
"groupName": "scanOptions"
418428
},
429+
{
430+
"name": "coverityWaitForScan",
431+
"type": "boolean",
432+
"label": "Coverity Wait For Scan",
433+
"defaultValue": true,
434+
"required": false,
435+
"helpMarkDown": "It specifies whether the workflow should wait for the analysis to complete or not. Default value: true.",
436+
"visibleRule": "scanType = coverity",
437+
"groupName": "scanOptions"
438+
},
419439
{
420440
"name": "bridge_coverity_automation_prcomment",
421441
"type": "boolean",
@@ -616,6 +636,16 @@
616636
"visibleRule": "scanType = blackduck",
617637
"groupName": "scanOptions"
618638
},
639+
{
640+
"name": "blackduckWaitForScan",
641+
"type": "boolean",
642+
"label": "Black Duck Wait For Scan",
643+
"defaultValue": true,
644+
"required": false,
645+
"helpMarkDown": "It specifies whether the workflow should wait for the analysis to complete or not. Default value: true.",
646+
"visibleRule": "scanType = blackduck",
647+
"groupName": "scanOptions"
648+
},
619649
{
620650
"name": "bridge_blackduck_automation_prcomment",
621651
"type": "boolean",
@@ -876,6 +906,16 @@
876906
"visibleRule": "scanType = srm",
877907
"groupName": "scanOptions"
878908
},
909+
{
910+
"name": "srmWaitForScan",
911+
"type": "boolean",
912+
"label": "SRM Wait For Scan",
913+
"defaultValue": true,
914+
"required": false,
915+
"helpMarkDown": "It specifies whether the workflow should wait for the analysis to complete or not. Default value: true.",
916+
"visibleRule": "scanType = srm",
917+
"groupName": "scanOptions"
918+
},
879919
{
880920
"name": "coverityExecutionPath",
881921
"type": "string",

0 commit comments

Comments
 (0)