Skip to content

Commit

Permalink
Merge pull request #166 from synopsys-sig/SIGINT-1865
Browse files Browse the repository at this point in the history
SIGINT-1865:  turn ON signature scan
  • Loading branch information
maksudur-rahman-maruf authored Jul 16, 2024
2 parents c125a54 + 0385c3a commit e88368a
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 7 deletions.
21 changes: 16 additions & 5 deletions synopsys-task/dist/index.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions synopsys-task/src/synopsys-task/application-constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ export const POLARIS_REPORTS_SARIF_ISSUE_TYPES_KEY_CLASSIC_EDITOR =
export const POLARIS_ASSESSMENT_MODE_KEY = "polaris_assessment_mode";
export const POLARIS_ASSESSMENT_MODE_KEY_CLASSIC_EDITOR =
"polarisAssessmentMode";
export const POLARIS_TEST_SCA_TYPE_KEY = "polaris_test_sca_type";
export const POLARIS_TEST_SCA_TYPE_KEY_CLASSIC_EDITOR = "polarisTestScaType";
export const POLARIS_PROJECT_DIRECTORY_KEY_CLASSIC_EDITOR =
"polarisProjectDirectory";
export const PROJECT_SOURCE_ARCHIVE_KEY = "project_source_archive";
Expand Down
5 changes: 5 additions & 0 deletions synopsys-task/src/synopsys-task/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ export const POLARIS_BRANCH_PARENT_NAME = getInput(
constants.POLARIS_BRANCH_PARENT_NAME_KEY_CLASSIC_EDITOR,
null
);
export const POLARIS_TEST_SCA_TYPE = getInput(
constants.POLARIS_TEST_SCA_TYPE_KEY,
constants.POLARIS_TEST_SCA_TYPE_KEY_CLASSIC_EDITOR,
null
);

export const POLARIS_ASSESSMENT_MODE = getInputForPolarisAssessmentMode();

Expand Down
5 changes: 5 additions & 0 deletions synopsys-task/src/synopsys-task/model/polaris.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ export interface PolarisData {
assessment: { types: string[]; mode?: string };
prcomment?: PRComment;
reports?: Reports;
test?: Test;
}

export interface Test {
sca: { type: string };
}

export interface Branch {
Expand Down
8 changes: 8 additions & 0 deletions synopsys-task/src/synopsys-task/tools-parameter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ export class SynopsysToolsParameter {
polData.data.polaris.triage = inputs.POLARIS_TRIAGE;
}

if (inputs.POLARIS_TEST_SCA_TYPE) {
polData.data.polaris.test = {
sca: {
type: inputs.POLARIS_TEST_SCA_TYPE,
},
};
}

if (
inputs.POLARIS_PROJECT_DIRECTORY ||
inputs.PROJECT_SOURCE_ARCHIVE ||
Expand Down
10 changes: 10 additions & 0 deletions synopsys-task/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,16 @@
"visibleRule": "scanType = polaris",
"groupName": "scanOptions"
},
{
"name": "polarisTestScaType",
"type": "string",
"label": "Polaris Test SCA Type",
"defaultValue": "",
"required": false,
"helpMarkDown": "Polaris test type to trigger signature scan or package manager scan.",
"visibleRule": "scanType = polaris",
"groupName": "scanOptions"
},
{
"name": "polarisReportsSarifCreate",
"type": "boolean",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ describe("Synopsys Tools Parameter test", () => {
Object.defineProperty(inputs, 'POLARIS_BRANCH_PARENT_NAME', {value: ''})
Object.defineProperty(inputs, 'POLARIS_ASSESSMENT_TYPES', {value: ['SCA','sast']})
Object.defineProperty(inputs, 'POLARIS_TRIAGE', {value: ''})
Object.defineProperty(inputs, 'POLARIS_TEST_SCA_TYPE', {value: ''})
Object.defineProperty(inputs, 'COVERITY_BUILD_COMMAND', {value: ''})
Object.defineProperty(inputs, 'COVERITY_CLEAN_COMMAND', {value: ''})
Object.defineProperty(inputs, 'COVERITY_CONFIG_PATH', {value: ''})
Expand All @@ -51,9 +52,9 @@ describe("Synopsys Tools Parameter test", () => {
Object.defineProperty(inputs, 'POLARIS_ACCESS_TOKEN', {value: 'access_token'})
Object.defineProperty(inputs, 'POLARIS_APPLICATION_NAME', {value: 'POLARIS_APPLICATION_NAME'})
Object.defineProperty(inputs, 'POLARIS_PROJECT_NAME', {value: 'POLARIS_PROJECT_NAME'})
Object.defineProperty(inputs, 'POLARIS_BRANCH_NAME', {value: 'POLARIS_BRANCH_NAME'})
Object.defineProperty(inputs, 'POLARIS_ASSESSMENT_TYPES', {value: ['SCA','sast']});
Object.defineProperty(inputs, 'POLARIS_BRANCH_NAME', {value: 'feature1'})
Object.defineProperty(inputs, 'POLARIS_TEST_SCA_TYPE', {value: 'SCA-SIGNATURE'})


const formattedCommand = await synopsysToolsParameter.getFormattedCommandForPolaris();
Expand All @@ -63,7 +64,9 @@ describe("Synopsys Tools Parameter test", () => {
expect(jsonData.data.polaris.serverUrl).to.be.contains('server_url');
expect(jsonData.data.polaris.accesstoken).to.be.contains('access_token');
expect(jsonData.data.polaris.application.name).to.be.contains('POLARIS_APPLICATION_NAME');
expect(jsonData.data.polaris.project.name).to.be.contains('POLARIS_PROJECT_NAME');
expect(jsonData.data.polaris.branch.name).to.be.contains('feature1');
expect(jsonData.data.polaris.test.sca.type).to.be.contains('SCA-SIGNATURE');

expect(formattedCommand).contains('--stage polaris');

Expand Down

0 comments on commit e88368a

Please sign in to comment.