Skip to content

Commit

Permalink
Merge pull request #10 from blackduck-inc/SIGINT-2397
Browse files Browse the repository at this point in the history
SIGINT-2397: few renaming activities and documentation changes
  • Loading branch information
siyaramblackduck authored Oct 23, 2024
2 parents 8739e24 + 2027c77 commit 365db75
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 49 deletions.
36 changes: 18 additions & 18 deletions blackduck-security-task/dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion blackduck-security-task/dist/index.js.map

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ export const DETECT_EXECUTION_PATH_KEY_CLASSIC_EDITOR = "detectExecutionPath";
* @deprecated Use detect_scan_full instead. This can be removed in future release.
*/
export const BLACKDUCK_SCAN_FULL_KEY = "blackduck_scan_full";
export const DETECT_SCAN_FULL_KEY = "detect_scan_full";
export const DETECT_SCAN_FULL_KEY_CLASSIC_EDITOR = "detectScanFull";
export const BLACKDUCKSCA_SCAN_FULL_KEY = "blackducksca_scan_full";
export const BLACKDUCKSCA_SCAN_FULL_KEY_CLASSIC_EDITOR = "blackduckScaScanFull";
/**
* @deprecated Use blackducksca_scan_failure_severities instead. This can be removed in future release.
*/
Expand All @@ -217,7 +217,7 @@ export const BLACKDUCK_SCAN_FAILURE_SEVERITIES_KEY =
export const BLACKDUCKSCA_SCAN_FAILURE_SEVERITIES_KEY =
"blackducksca_scan_failure_severities";
export const BLACKDUCKSCA_SCAN_FAILURE_SEVERITIES_KEY_CLASSIC_EDITOR =
"blackduckScaScaScanFailureSeverities";
"blackduckScaScanFailureSeverities";
/**
* @deprecated Use blackducksca_prComment_enabled instead. This can be removed in future release.
*/
Expand Down
6 changes: 3 additions & 3 deletions blackduck-security-task/src/blackduck-security-task/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,9 @@ export const DETECT_EXECUTION_PATH = getPathInput(
constants.DETECT_EXECUTION_PATH_KEY_CLASSIC_EDITOR,
constants.BLACKDUCK_EXECUTION_PATH_KEY
);
export const DETECT_SCAN_FULL = getInput(
constants.DETECT_SCAN_FULL_KEY,
constants.DETECT_SCAN_FULL_KEY_CLASSIC_EDITOR,
export const BLACKDUCKSCA_SCAN_FULL = getInput(
constants.BLACKDUCKSCA_SCAN_FULL_KEY,
constants.BLACKDUCKSCA_SCAN_FULL_KEY_CLASSIC_EDITOR,
constants.BLACKDUCK_SCAN_FULL_KEY
);
export const BLACKDUCKSCA_SCAN_FAILURE_SEVERITIES = getDelimitedInput(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export interface BlackduckSCAData extends AsyncMode {
}

export interface BlackDuckDetect {
scan?: { full?: boolean };
install?: Install;
search?: Search;
config?: Config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,22 @@ export class BridgeToolsParameter {
directory: inputs.BLACKDUCKSCA_PROJECT_DIRECTORY,
};
}

if (inputs.BLACKDUCKSCA_SCAN_FULL) {
if (
inputs.BLACKDUCKSCA_SCAN_FULL.toLowerCase() === "true" ||
inputs.BLACKDUCKSCA_SCAN_FULL.toLowerCase() === "false"
) {
const scanFullValue =
inputs.BLACKDUCKSCA_SCAN_FULL.toLowerCase() === "true";
blackduckData.data.blackducksca.scan = { full: scanFullValue };
} else {
throw new Error(
MISSING_BOOL_VALUE.concat(constants.BLACKDUCKSCA_SCAN_FULL_KEY)
.concat(constants.SPACE)
.concat(ErrorCode.MISSING_BOOLEAN_VALUE.toString())
);
}
}
blackduckData.data.detect = this.setBlackDuckDetectArgs();

if (failureSeverities && failureSeverities.length > 0) {
Expand Down Expand Up @@ -1053,22 +1068,6 @@ export class BridgeToolsParameter {
};
}

if (inputs.DETECT_SCAN_FULL) {
if (
inputs.DETECT_SCAN_FULL.toLowerCase() === "true" ||
inputs.DETECT_SCAN_FULL.toLowerCase() === "false"
) {
const scanFullValue = inputs.DETECT_SCAN_FULL.toLowerCase() === "true";
blackDuckDetectInputData.data.scan = { full: scanFullValue };
} else {
throw new Error(
MISSING_BOOL_VALUE.concat(constants.DETECT_SCAN_FULL_KEY)
.concat(constants.SPACE)
.concat(ErrorCode.MISSING_BOOLEAN_VALUE.toString())
);
}
}

if (
inputs.DETECT_SEARCH_DEPTH &&
Number.isInteger(parseInt(inputs.DETECT_SEARCH_DEPTH))
Expand Down
2 changes: 1 addition & 1 deletion blackduck-security-task/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@
"groupName": "blackduckScaSarifReport"
},
{
"name": "detectScanFull",
"name": "blackduckScaScanFull",
"type": "boolean",
"label": "Full Scan",
"defaultValue": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ describe("Bridge CLI Tools Parameter test", () => {
Object.defineProperty(inputs, 'BLACKDUCKSCA_URL', {value: ''})
Object.defineProperty(inputs, 'BLACKDUCKSCA_API_TOKEN', {value: ''})
Object.defineProperty(inputs, 'DETECT_INSTALL_DIRECTORY', {value: ''})
Object.defineProperty(inputs, 'DETECT_SCAN_FULL', {value: ''})
Object.defineProperty(inputs, 'BLACKDUCKSCA_SCAN_FULL', {value: ''})
Object.defineProperty(inputs, 'BLACKDUCKSCA_SCAN_FAILURE_SEVERITIES', {value: ''})
Object.defineProperty(inputs, 'BLACKDUCKSCA_FIXPR_ENABLED', {value: ''})
Object.defineProperty(inputs, 'BLACKDUCKSCA_FIXPR_MAXCOUNT', {value: ''})
Expand All @@ -865,7 +865,7 @@ describe("Bridge CLI Tools Parameter test", () => {
Object.defineProperty(inputs, 'BLACKDUCKSCA_URL', {value: 'https://test.com'})
Object.defineProperty(inputs, 'BLACKDUCKSCA_API_TOKEN', {value: 'token'})
Object.defineProperty(inputs, 'DETECT_INSTALL_DIRECTORY', {value: 'test'})
Object.defineProperty(inputs, 'DETECT_SCAN_FULL', {value: 'true'})
Object.defineProperty(inputs, 'BLACKDUCKSCA_SCAN_FULL', {value: 'true'})
Object.defineProperty(inputs, 'BLACKDUCKSCA_SCAN_FAILURE_SEVERITIES', {value : ["BLOCKER","CRITICAL","TRIVIAL"]})

sandbox.stub(validator, "validateBlackduckFailureSeverities").returns(true);
Expand Down Expand Up @@ -1287,7 +1287,7 @@ describe("Bridge CLI Tools Parameter test", () => {
Object.defineProperty(inputs, 'BLACKDUCKSCA_URL', {value: 'https://test.com'})
Object.defineProperty(inputs, 'BLACKDUCKSCA_API_TOKEN', {value: 'token'})
Object.defineProperty(inputs, 'DETECT_INSTALL_DIRECTORY', {value: '/test'})
Object.defineProperty(inputs, 'DETECT_SCAN_FULL', {value: 'false'})
Object.defineProperty(inputs, 'BLACKDUCKSCA_SCAN_FULL', {value: 'false'})
Object.defineProperty(inputs, 'BLACKDUCKSCA_SCAN_FAILURE_SEVERITIES', {value : ["BLOCKER","CRITICAL","TRIVIAL"]})

sandbox.stub(validator, "validateBlackduckFailureSeverities").returns(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ describe("Validator test", () => {
Object.defineProperty(inputs, 'BLACKDUCKSCA_URL', {value: ''})
Object.defineProperty(inputs, 'BLACKDUCKSCA_API_TOKEN', {value: ''})
Object.defineProperty(inputs, 'DETECT_INSTALL_DIRECTORY', {value: ''})
Object.defineProperty(inputs, 'DETECT_SCAN_FULL', {value: true})
Object.defineProperty(inputs, 'BLACKDUCKSCA_SCAN_FULL', {value: true})
Object.defineProperty(inputs, 'BLACKDUCKSCA_SCAN_FAILURE_SEVERITIES', {value: []})

Object.defineProperty(inputs, 'BLACKDUCKSCA_URL', {value: ''})
Expand All @@ -185,7 +185,7 @@ describe("Validator test", () => {
it('should return empty array for validateBlackDuckSCAInputs', function () {
Object.defineProperty(inputs, 'BLACKDUCKSCA_URL', {value: 'server_url'})
Object.defineProperty(inputs, 'BLACKDUCKSCA_API_TOKEN', {value: 'access_token'})
Object.defineProperty(inputs, 'DETECT_SCAN_FULL', {value: true})
Object.defineProperty(inputs, 'BLACKDUCKSCA_SCAN_FULL', {value: true})
Object.defineProperty(inputs, 'BLACKDUCKSCA_SCAN_FAILURE_SEVERITIES', {value: ["BLOCKER","CRITICAL","TRIVIAL"]});

const bdValidationErrors = validator.validateBlackDuckSCAInputs();
Expand Down

0 comments on commit 365db75

Please sign in to comment.