@@ -88,25 +88,28 @@ async function init() {
8888 */
8989export async function run ( inputArgs : string [ ] , successfulExitCodes : number [ ] = null , publish : boolean = true , publishArtifactName : string = null , telemetryEnvironment : string = 'azdevops' ) : Promise < void > {
9090 let tool = null ;
91- let debugDrop = process . env . GDN_DEBUG_DROP ?. toLowerCase ( ) ;
91+ let debugDrop = common . parseBool ( process . env . GDN_DEBUG_DROP ) ;
9292
9393 let sarifFile : string = path . join ( process . env . BUILD_STAGINGDIRECTORY , '.gdn' , 'msdo.sarif' ) ;
9494 tl . debug ( `sarifFile = ${ sarifFile } ` ) ;
9595
96+ const gdnTaskLibFolder = path . resolve ( __dirname ) ;
97+ tl . debug ( `gdnTaskLibFolder = ${ gdnTaskLibFolder } ` ) ;
98+
99+ const nodeModulesFolder = path . dirname ( path . dirname ( gdnTaskLibFolder ) ) ;
100+ tl . debug ( `nodeModulesFolder = ${ nodeModulesFolder } ` ) ;
101+
102+ const taskFolder = path . dirname ( nodeModulesFolder ) ;
103+ tl . debug ( `taskFolder = ${ taskFolder } ` ) ;
104+
105+ const debugFolder = path . join ( taskFolder , 'debug' ) ;
106+ tl . debug ( `debugFolder = ${ debugFolder } ` ) ;
107+
96108 try {
97109
98110 if ( successfulExitCodes == null ) {
99111 successfulExitCodes = [ 0 ] ;
100112 }
101-
102- const gdnTaskLibFolder = path . resolve ( __dirname ) ;
103- tl . debug ( `gdnTaskLibFolder = ${ gdnTaskLibFolder } ` ) ;
104-
105- const nodeModulesFolder = path . dirname ( path . dirname ( gdnTaskLibFolder ) ) ;
106- tl . debug ( `nodeModulesFolder = ${ nodeModulesFolder } ` ) ;
107-
108- const taskFolder = path . dirname ( nodeModulesFolder ) ;
109- tl . debug ( `taskFolder = ${ taskFolder } ` ) ;
110113
111114 await setupEnvironment ( ) ;
112115 await init ( ) ;
@@ -154,7 +157,7 @@ export async function run(inputArgs: string[], successfulExitCodes: number[] = n
154157
155158 // Include the debug drop option on the command line if applicable.
156159 tl . debug ( `GdnDebugDrop = ${ debugDrop } ` ) ;
157- if ( debugDrop == 'true' )
160+ if ( debugDrop )
158161 {
159162 const dropPathValue = path . join ( taskFolder , 'debug' ) ;
160163 tool . arg ( '--debug-drop' ) . arg ( '--debug-drop-path' ) . arg ( dropPathValue ) ;
@@ -178,8 +181,6 @@ export async function run(inputArgs: string[], successfulExitCodes: number[] = n
178181 tl . debug ( 'Running Microsoft Security DevOps...' ) ;
179182
180183 // Ensure debug folder starts clean
181- const taskFolder = path . dirname ( path . dirname ( path . dirname ( path . resolve ( __dirname ) ) ) ) ;
182- const debugFolder = path . join ( taskFolder , 'debug' ) ;
183184 cleanupDirectory ( debugFolder ) ;
184185
185186 let exitCode = await tool . exec ( options ) ;
@@ -195,7 +196,7 @@ export async function run(inputArgs: string[], successfulExitCodes: number[] = n
195196 // Package up debug drop if applicable.
196197 let debugStagingDir = '' ;
197198 tl . debug ( `GdnDebugDrop = ${ debugDrop } ` ) ;
198- if ( debugDrop == 'true' ) {
199+ if ( debugDrop ) {
199200 if ( fs . existsSync ( debugFolder ) ) {
200201 tl . debug ( "Creating debug drop archive..." ) ;
201202 let zippedOutput = getZippedFolder ( debugFolder ) ;
0 commit comments