Skip to content

Commit 0bfd541

Browse files
authored
DotNetCoreCLIV2 log restore inputs (#17696)
* add telemetry reporting to restore * bump version
1 parent f817edb commit 0bfd541

File tree

3 files changed

+46
-2
lines changed

3 files changed

+46
-2
lines changed

Tasks/DotNetCoreCLIV2/dotnetcore.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import * as packCommand from './packcommand';
1010
import * as pushCommand from './pushcommand';
1111
import * as restoreCommand from './restorecommand';
1212
import * as utility from './Common/utility';
13+
import * as telemetry from "azure-pipelines-tasks-utility-common/telemetry";
1314

1415
export class dotNetExe {
1516
private command: string;
@@ -52,6 +53,7 @@ export class dotNetExe {
5253
await this.executeTestCommand();
5354
break;
5455
case "restore":
56+
this.logRestoreStartUpVariables();
5557
await restoreCommand.run();
5658
break;
5759
case "pack":
@@ -411,6 +413,48 @@ export class dotNetExe {
411413
private static getModifiedOutputForProjectFile(outputBase: string, projectFile: string): string {
412414
return path.join(outputBase, path.basename(path.dirname(projectFile)));
413415
}
416+
417+
private logRestoreStartUpVariables() {
418+
try {
419+
const nugetfeedtype = tl.getInput("nugetfeedtype");
420+
let externalendpoint = null;
421+
if (nugetfeedtype != null && nugetfeedtype === "external") {
422+
const epId = tl.getInput("externalendpoint");
423+
if (epId) {
424+
externalendpoint = {
425+
feedName: tl.getEndpointUrl(epId, false).replace(/\W/g, ""),
426+
feedUri: tl.getEndpointUrl(epId, false),
427+
};
428+
}
429+
}
430+
431+
let externalendpoints = tl.getDelimitedInput("externalendpoints", ",");
432+
if (externalendpoints) {
433+
externalendpoints = externalendpoints.reduce((ary, id) => {
434+
const te = {
435+
feedName: tl.getEndpointUrl(id, false).replace(/\W/g, ""),
436+
feedUri: tl.getEndpointUrl(id, false),
437+
};
438+
ary.push(te);
439+
return ary;
440+
}, []);
441+
}
442+
const nugetTelem = {
443+
"command": tl.getInput("command"),
444+
"System.TeamFoundationCollectionUri": tl.getVariable("System.TeamFoundationCollectionUri"),
445+
"includenugetorg": tl.getInput("includenugetorg"),
446+
"nocache": tl.getInput("nocache"),
447+
"nugetconfigpath": tl.getInput("nugetconfigpath"),
448+
"nugetfeedtype": nugetfeedtype,
449+
"selectorconfig": tl.getInput("selectorconfig"),
450+
"projects": tl.getInput("projects"),
451+
"verbosityrestore": tl.getInput("verbosityrestore")
452+
};
453+
telemetry.emitTelemetry("Packaging", "DotNetCoreCLIRestore", nugetTelem);
454+
} catch (err) {
455+
tl.debug(`Unable to log NuGet task init telemetry. Err:( ${err} )`);
456+
}
457+
}
414458
}
415459

416460
var exe = new dotNetExe();

Tasks/DotNetCoreCLIV2/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"demands": [],
1818
"version": {
1919
"Major": 2,
20-
"Minor": 216,
20+
"Minor": 217,
2121
"Patch": 0
2222
},
2323
"minimumAgentVersion": "2.144.0",

Tasks/DotNetCoreCLIV2/task.loc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"demands": [],
1818
"version": {
1919
"Major": 2,
20-
"Minor": 216,
20+
"Minor": 217,
2121
"Patch": 0
2222
},
2323
"minimumAgentVersion": "2.144.0",

0 commit comments

Comments
 (0)