Skip to content

Commit

Permalink
Setting scan ID as an output variable (#431)
Browse files Browse the repository at this point in the history
* setting scan ID as an output variable

* fix issue

---------

Co-authored-by: Pedro Lopes <[email protected]>
  • Loading branch information
igorlombacx and pedrompflopes authored Oct 30, 2023
1 parent 3d3bf6e commit 7b563e3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 4 additions & 3 deletions cxAstScan/services/TaskRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {CxWrapper} from "@checkmarxdev/ast-cli-javascript-wrapper";
import {CxCommandOutput} from "@checkmarxdev/ast-cli-javascript-wrapper/dist/main/wrapper/CxCommandOutput";
import {CxParamType} from "@checkmarxdev/ast-cli-javascript-wrapper/dist/main/wrapper/CxParamType";
import CxScan from "@checkmarxdev/ast-cli-javascript-wrapper/dist/main/scan/CxScan";
import { getConfiguration, getLogFilename } from "./Utils";
import {getConfiguration, getLogFilename} from "./Utils";

export class TaskRunner {

Expand All @@ -28,9 +28,9 @@ export class TaskRunner {
console.log("Additional Params: " + additionalParams);


try {
try {
//Write to file to test if possible to read from file in cleanup post execution event

const wrapper = new CxWrapper(cxScanConfig, getLogFilename());

const cxCommandOutput: CxCommandOutput = await wrapper.scanCreate(params);
Expand All @@ -42,6 +42,7 @@ export class TaskRunner {
const scan: CxScan = cxCommandOutput.payload.pop();

if (agentTempDirectory && scan && scan.id) {
taskLib.setVariable("CxOneScanId", scan.id);
await this.generateResults(wrapper, agentTempDirectory, scan.id);
}
}
Expand Down
8 changes: 7 additions & 1 deletion cxAstScan/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,11 @@
}
},
"messages": {
}
},
"OutputVariables": [
{
"name": "CxOneScanId",
"description": "Checkmarx One scan ID from created scan"
}
]
}

0 comments on commit 7b563e3

Please sign in to comment.