Skip to content

Commit 25fabeb

Browse files
authored
Resolving merge cnflict (#11476)
1 parent 3d01a59 commit 25fabeb

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

Tasks/AzureCLIV2/src/Utility.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import fs = require("fs");
66

77
export class Utility {
88

9-
public static async getScriptPath(scriptLocation:string, fileExtensions:string[]): Promise<string> {
9+
public static async getScriptPath(scriptLocation: string, fileExtensions: string[]): Promise<string> {
1010
if (scriptLocation === "scriptPath") {
1111
let filePath: string = tl.getPathInput("scriptPath", true, true);
12-
if(Utility.checkIfFileExists(filePath, fileExtensions)){
12+
if (Utility.checkIfFileExists(filePath, fileExtensions)) {
1313
return filePath;
1414
}
1515
throw new Error(tl.loc('JS_InvalidFilePath', filePath));
@@ -33,14 +33,18 @@ export class Utility {
3333
}
3434

3535
let contents: string[] = [];
36-
contents.push(`$ErrorActionPreference = '${powerShellErrorActionPreference}'`);
36+
contents.push(`$ErrorActionPreference = '${powerShellErrorActionPreference}'`);
3737

3838
if (scriptLocation === "scriptPath") {
3939
let filePath: string = tl.getPathInput("scriptPath", true, true);
40-
if (Utility.checkIfFileExists(filePath, fileExtensions)){
41-
contents.push(`. '${filePath.replace("'", "''")}' ${scriptArguments}`.trim());
40+
if (Utility.checkIfFileExists(filePath, fileExtensions)) {
41+
let content: string = `. '${filePath.replace("'", "''")}' `;
42+
if (scriptArguments) {
43+
content += scriptArguments;
44+
}
45+
contents.push(content.trim());
4246
}
43-
else{
47+
else {
4448
throw new Error(tl.loc('JS_InvalidFilePath', filePath));
4549
}
4650
}
@@ -64,7 +68,7 @@ export class Utility {
6468
tl.checkPath(tempDirectory, `${tempDirectory} (agent.tempDirectory)`);
6569
let scriptPath: string = path.join(tempDirectory, `azureclitaskscript${new Date().getTime()}.${fileExtensions[0]}`);
6670

67-
await Utility.createFile(scriptPath,'\ufeff' + contents.join(os.EOL), { encoding : 'utf8'} );
71+
await Utility.createFile(scriptPath, '\ufeff' + contents.join(os.EOL), { encoding: 'utf8' });
6872
return scriptPath;
6973
}
7074

@@ -82,7 +86,7 @@ export class Utility {
8286
}
8387
}
8488

85-
public static async createFile(filePath: string, data: string, options?:any): Promise<void> {
89+
public static async createFile(filePath: string, data: string, options?: any): Promise<void> {
8690
try {
8791
fs.writeFileSync(filePath, data, options);
8892
}
@@ -93,12 +97,12 @@ export class Utility {
9397
}
9498

9599
public static checkIfFileExists(filePath: string, fileExtensions: string[]): boolean {
96-
let matchingFiles:string[] = fileExtensions.filter((fileExtension:string) => {
100+
let matchingFiles: string[] = fileExtensions.filter((fileExtension: string) => {
97101
if (tl.stats(filePath).isFile() && filePath.toUpperCase().match(new RegExp(`\.${fileExtension.toUpperCase()}$`))) {
98102
return true;
99103
}
100104
});
101-
if (matchingFiles.length > 0){
105+
if (matchingFiles.length > 0) {
102106
return true;
103107
}
104108
return false;

Tasks/AzureCLIV2/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"version": {
2222
"Major": 2,
2323
"Minor": 0,
24-
"Patch": 1
24+
"Patch": 2
2525
},
2626
"minimumAgentVersion": "2.0.0",
2727
"instanceNameFormat": "Azure CLI $(scriptPath)",

Tasks/AzureCLIV2/task.loc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"version": {
2222
"Major": 2,
2323
"Minor": 0,
24-
"Patch": 1
24+
"Patch": 2
2525
},
2626
"minimumAgentVersion": "2.0.0",
2727
"instanceNameFormat": "ms-resource:loc.instanceNameFormat",

0 commit comments

Comments
 (0)