@@ -11,21 +11,52 @@ export function getInput(
11
11
classicEditorKey : string ,
12
12
deprecatedKey : string | null
13
13
) {
14
- const newInput = taskLib . getInput ( newKey ) ;
15
- if ( newInput ) {
16
- return newInput ?. trim ( ) ;
14
+ const key = getInputForYMLAndDeprecatedKey ( newKey , deprecatedKey ) ;
15
+ if ( key ) {
16
+ return key ;
17
+ }
18
+ const classEditorInput = taskLib . getInput ( classicEditorKey ) ;
19
+ if ( classEditorInput ) {
20
+ return classEditorInput ?. trim ( ) ;
17
21
}
18
22
19
- let deprecatedInput ;
20
- if ( deprecatedKey ) {
21
- deprecatedInput = taskLib . getInput ( deprecatedKey ) ;
22
- if ( deprecatedInput ) {
23
- deprecatedInputs . push ( deprecatedKey ) ;
24
- return deprecatedInput ?. trim ( ) ;
25
- }
23
+ return "" ;
24
+ }
25
+
26
+ export function getInputForMultipleClassicEditor (
27
+ newKey : string ,
28
+ polarisClassicEditorKey : string ,
29
+ blackduckSCAClassicEditorKey : string ,
30
+ coverityClassicEditorKey : string ,
31
+ srmClassicEditorKey : string | null ,
32
+ deprecatedKey : string | null
33
+ ) {
34
+ const key = getInputForYMLAndDeprecatedKey ( newKey , deprecatedKey ) ;
35
+ if ( key ) {
36
+ return key ;
26
37
}
27
38
28
- const classEditorInput = taskLib . getInput ( classicEditorKey ) ;
39
+ const scanType = taskLib . getInput ( constants . SCAN_TYPE_KEY ) ;
40
+ let classEditorInput ;
41
+ if ( polarisClassicEditorKey . length > 0 && scanType == constants . POLARIS_KEY ) {
42
+ classEditorInput = taskLib . getInput ( polarisClassicEditorKey ) ;
43
+ } else if (
44
+ blackduckSCAClassicEditorKey . length > 0 &&
45
+ scanType == constants . BLACKDUCKSCA_KEY
46
+ ) {
47
+ classEditorInput = taskLib . getInput ( blackduckSCAClassicEditorKey ) ;
48
+ } else if (
49
+ coverityClassicEditorKey . length > 0 &&
50
+ scanType == constants . COVERITY_KEY
51
+ ) {
52
+ classEditorInput = taskLib . getInput ( coverityClassicEditorKey ) ;
53
+ } else if (
54
+ srmClassicEditorKey &&
55
+ srmClassicEditorKey ?. length > 0 &&
56
+ scanType == constants . SRM_KEY
57
+ ) {
58
+ classEditorInput = taskLib . getInput ( srmClassicEditorKey ) ;
59
+ }
29
60
if ( classEditorInput ) {
30
61
return classEditorInput ?. trim ( ) ;
31
62
}
@@ -41,17 +72,43 @@ export function getArbitraryInputs(
41
72
deprecatedKey : string | null
42
73
) {
43
74
const scanType = taskLib . getInput ( constants . SCAN_TYPE_KEY ) ;
44
- if ( classicEditorKeyForPolaris . length > 0 && scanType == "polaris" ) {
75
+ if (
76
+ classicEditorKeyForPolaris . length > 0 &&
77
+ scanType == constants . POLARIS_KEY
78
+ ) {
45
79
return taskLib . getInput ( classicEditorKeyForPolaris ) ;
46
- } else if ( classicEditorKeyForSrm . length > 0 && scanType == "srm" ) {
80
+ } else if (
81
+ classicEditorKeyForSrm . length > 0 &&
82
+ scanType == constants . SRM_KEY
83
+ ) {
47
84
return taskLib . getInput ( classicEditorKeyForSrm ) ;
48
85
} else if (
49
86
classicEditorKey . length > 0 &&
50
- ( scanType == "coverity" || scanType == "blackduck" )
87
+ ( scanType == constants . COVERITY_KEY ||
88
+ scanType == constants . BLACKDUCKSCA_KEY )
51
89
) {
52
90
return taskLib . getInput ( classicEditorKey ) ;
53
91
}
54
- return getInput ( yamlKey , classicEditorKey , deprecatedKey ) ;
92
+ return getInputForYMLAndDeprecatedKey ( yamlKey , deprecatedKey ) ;
93
+ }
94
+ export function getInputForYMLAndDeprecatedKey (
95
+ newKey : string ,
96
+ deprecatedKey : string | null
97
+ ) {
98
+ const newInput = taskLib . getInput ( newKey ) ;
99
+ if ( newInput ) {
100
+ return newInput ?. trim ( ) ;
101
+ }
102
+
103
+ let deprecatedInput ;
104
+ if ( deprecatedKey ) {
105
+ deprecatedInput = taskLib . getInput ( deprecatedKey ) ;
106
+ if ( deprecatedInput ) {
107
+ deprecatedInputs . push ( deprecatedKey ) ;
108
+ return deprecatedInput ?. trim ( ) ;
109
+ }
110
+ }
111
+ return "" ;
55
112
}
56
113
57
114
export function getBoolInput (
@@ -124,7 +181,7 @@ export function showLogForDeprecatedInputs() {
124
181
`[${ deprecatedInputs . join (
125
182
","
126
183
) } ] is/are deprecated for YAML. Check documentation for new parameters: ${
127
- constants . BLACKDUCK_SCA_SECURITY_SCAN_AZURE_DEVOPS_DOCS_URL
184
+ constants . BLACKDUCKSCA_SECURITY_SCAN_AZURE_DEVOPS_DOCS_URL
128
185
} `
129
186
) ;
130
187
}
@@ -170,15 +227,21 @@ export const BRIDGECLI_DOWNLOAD_VERSION = getInput(
170
227
constants . SYNOPSYS_BRIDGE_DOWNLOAD_VERSION_KEY
171
228
) ;
172
229
173
- export const INCLUDE_DIAGNOSTICS = getInput (
230
+ export const INCLUDE_DIAGNOSTICS = getInputForMultipleClassicEditor (
174
231
constants . INCLUDE_DIAGNOSTICS_KEY ,
175
- constants . INCLUDE_DIAGNOSTICS_KEY_CLASSIC_EDITOR ,
232
+ constants . POLARIS_INCLUDE_DIAGNOSTICS_KEY_CLASSIC_EDITOR ,
233
+ constants . BLACKDUCKSCA_INCLUDE_DIAGNOSTICS_KEY_CLASSIC_EDITOR ,
234
+ constants . COVERITY_INCLUDE_DIAGNOSTICS_KEY_CLASSIC_EDITOR ,
235
+ constants . SRM_INCLUDE_DIAGNOSTICS_KEY_CLASSIC_EDITOR ,
176
236
null
177
237
) ;
178
238
179
- export const AZURE_TOKEN = getInput (
239
+ export const AZURE_TOKEN = getInputForMultipleClassicEditor (
180
240
constants . AZURE_TOKEN_KEY ,
181
- constants . AZURE_TOKEN_KEY_CLASSIC_EDITOR ,
241
+ constants . POLARIS_AZURE_TOKEN_KEY_CLASSIC_EDITOR ,
242
+ constants . BLACKDUCKSCA_AZURE_TOKEN_KEY_CLASSIC_EDITOR ,
243
+ constants . COVERITY_AZURE_TOKEN_KEY_CLASSIC_EDITOR ,
244
+ null ,
182
245
null
183
246
) ;
184
247
@@ -211,11 +274,6 @@ export const POLARIS_ASSESSMENT_TYPES = getDelimitedInput(
211
274
constants . POLARIS_ASSESSMENT_TYPES_KEY_CLASSIC_EDITOR ,
212
275
null
213
276
) ;
214
- export const POLARIS_TRIAGE = getInput (
215
- constants . POLARIS_TRIAGE_KEY ,
216
- constants . POLARIS_TRIAGE_KEY_CLASSIC_EDITOR ,
217
- null
218
- ) ;
219
277
export const POLARIS_BRANCH_NAME = getInput (
220
278
constants . POLARIS_BRANCH_NAME_KEY ,
221
279
constants . POLARIS_BRANCH_NAME_KEY_CLASSIC_EDITOR ,
@@ -421,7 +479,7 @@ export const DETECT_SCAN_FULL = getInput(
421
479
) ;
422
480
export const BLACKDUCKSCA_SCAN_FAILURE_SEVERITIES = getDelimitedInput (
423
481
constants . BLACKDUCKSCA_SCAN_FAILURE_SEVERITIES_KEY ,
424
- constants . BLACKDUCK_SCA_SCAN_FAILURE_SEVERITIES_KEY_CLASSIC_EDITOR ,
482
+ constants . BLACKDUCKSCA_SCAN_FAILURE_SEVERITIES_KEY_CLASSIC_EDITOR ,
425
483
constants . BLACKDUCK_SCAN_FAILURE_SEVERITIES_KEY
426
484
) ;
427
485
@@ -560,8 +618,11 @@ export const SRM_PROJECT_DIRECTORY = getInput(
560
618
export const RETURN_STATUS =
561
619
taskLib . getInput ( constants . RETURN_STATUS_KEY ) ?. trim ( ) || "true" ;
562
620
563
- export const MARK_BUILD_STATUS = getInput (
621
+ export const MARK_BUILD_STATUS = getInputForMultipleClassicEditor (
564
622
constants . MARK_BUILD_STATUS_KEY ,
565
- constants . MARK_BUILD_STATUS_KEY_CLASSIC_EDITOR ,
623
+ constants . POLARIS_MARK_BUILD_STATUS_KEY_CLASSIC_EDITOR ,
624
+ constants . BLACKDUCKSCA_MARK_BUILD_STATUS_KEY_CLASSIC_EDITOR ,
625
+ constants . COVERITY_MARK_BUILD_STATUS_KEY_CLASSIC_EDITOR ,
626
+ constants . SRM_MARK_BUILD_STATUS_KEY_CLASSIC_EDITOR ,
566
627
null
567
628
) ;
0 commit comments