Skip to content

Commit 8db3cc5

Browse files
authored
Users/magleaso/remove problematic npm task telemetry (#20611)
* Remove startup variable telemetry from npmv1 * Update version number and build * Modify tests to account for removed code
1 parent e625aaf commit 8db3cc5

File tree

13 files changed

+40
-190
lines changed

13 files changed

+40
-190
lines changed

Tasks/NpmV1/Tests/L0.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ describe('Npm Task', function () {
178178

179179
tr.run();
180180

181-
assert.equal(tr.invokedToolCount, 3, 'task should have run npm');
181+
assert.equal(tr.invokedToolCount, 2, 'task should have run npm');
182182
assert(tr.succeeded, 'task should have succeeded');
183183
assert(tr.stdOutContained('; debug cli configs'), 'should have debug npm config output');
184184
assert(tr.stdOutContained('; cli configs') === false, 'should not have regular npm config output');
@@ -194,7 +194,7 @@ describe('Npm Task', function () {
194194

195195
tr.run();
196196

197-
assert.equal(tr.invokedToolCount, 3, 'task should have run npm');
197+
assert.equal(tr.invokedToolCount, 2, 'task should have run npm');
198198
assert(tr.succeeded, 'task should have succeeded');
199199
assert(tr.stdOutContained('; cli configs'), 'should have regular npm config output');
200200
assert(tr.stdOutContained('; debug cli configs') === false, 'should not have debug npm config output');
@@ -222,7 +222,7 @@ describe('Npm Task', function () {
222222

223223
tr.run();
224224

225-
assert.equal(tr.invokedToolCount, 3, 'task should have run npm');
225+
assert.equal(tr.invokedToolCount, 2, 'task should have run npm');
226226
assert(tr.stdOutContained('npm install successful'), 'npm should have installed the package');
227227
assert(tr.stdOutContained('OverridingProjectNpmrc'), 'install from feed shoud override project .npmrc');
228228
assert(tr.stdOutContained('RestoringProjectNpmrc'), 'install from .npmrc shoud restore project .npmrc');
@@ -238,7 +238,7 @@ describe('Npm Task', function () {
238238

239239
tr.run();
240240

241-
assert.equal(tr.invokedToolCount, 3, 'task should have run npm');
241+
assert.equal(tr.invokedToolCount, 2, 'task should have run npm');
242242
assert(tr.stdOutContained('npm install successful'), 'npm should have installed the package');
243243
assert(tr.stdOutContained('OverridingProjectNpmrc'), 'install from feed shoud override project .npmrc');
244244
assert(tr.stdOutContained('RestoringProjectNpmrc'), 'install from .npmrc shoud restore project .npmrc');
@@ -254,7 +254,7 @@ describe('Npm Task', function () {
254254

255255
tr.run();
256256

257-
assert.equal(tr.invokedToolCount, 3, 'task should have run npm');
257+
assert.equal(tr.invokedToolCount, 2, 'task should have run npm');
258258
assert(tr.stdOutContained('npm install successful'), 'npm should have installed the package');
259259
assert(!tr.stdOutContained('OverridingProjectNpmrc'), 'install from .npmrc shoud not override project .npmrc');
260260
assert(!tr.stdOutContained('RestoringProjectNpmrc'), 'install from .npmrc shoud not restore project .npmrc');
@@ -286,7 +286,7 @@ describe('Npm Task', function () {
286286

287287
tr.run();
288288

289-
assert.equal(tr.invokedToolCount, 3, 'task should have run npm');
289+
assert.equal(tr.invokedToolCount, 2, 'task should have run npm');
290290
assert(tr.stdOutContained('npm publish successful'), 'npm should have published the package');
291291
assert(tr.stdOutContained('OverridingProjectNpmrc'), 'publish should always ooverrideverride project .npmrc');
292292
assert(tr.stdOutContained('RestoringProjectNpmrc'), 'publish should always restore project .npmrc');
@@ -302,7 +302,7 @@ describe('Npm Task', function () {
302302

303303
tr.run();
304304

305-
assert.equal(tr.invokedToolCount, 3, 'task should have run npm');
305+
assert.equal(tr.invokedToolCount, 2, 'task should have run npm');
306306
assert(tr.stdOutContained('npm publish successful'), 'npm should have published the package');
307307
assert(tr.stdOutContained('OverridingProjectNpmrc'), 'publish should always ooverrideverride project .npmrc');
308308
assert(tr.stdOutContained('RestoringProjectNpmrc'), 'publish should always restore project .npmrc');
@@ -318,7 +318,7 @@ describe('Npm Task', function () {
318318

319319
tr.run();
320320

321-
assert.equal(tr.invokedToolCount, 3, 'task should have run npm');
321+
assert.equal(tr.invokedToolCount, 2, 'task should have run npm');
322322
assert(tr.stdOutContained('npm publish successful'), 'npm should have published the package');
323323
assert(tr.succeeded, 'task should have succeeded');
324324

Tasks/NpmV1/npm.ts

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ async function main(): Promise<void> {
2727
packagingLocation.PackagingUris.push(forcedUrl);
2828
}
2929

30-
await _logNpmStartupVariables(packagingLocation);
3130

3231
const command = tl.getInput(NpmTaskInput.Command) || null;
3332
switch (command) {
@@ -45,55 +44,6 @@ async function main(): Promise<void> {
4544
}
4645
}
4746

48-
async function _logNpmStartupVariables(packagingLocation: pkgLocationUtils.PackagingLocation) {
49-
try {
50-
// Log the NPM version
51-
let version: string;
52-
try {
53-
const syncResult: IExecSyncResult = tl.execSync('npm', '--version');
54-
if (syncResult.stdout) {
55-
version = syncResult.stdout.trim();
56-
}
57-
} catch (err) {
58-
tl.debug(`Unable to get NPM config info. Err:( ${err} )`);
59-
}
60-
61-
// Log the NPM registries
62-
const command = tl.getInput(NpmTaskInput.Command) || null;
63-
let npmRegistriesAry: INpmRegistry[];
64-
const registryUrlAry = [];
65-
switch (command) {
66-
case NpmCommand.Install:
67-
case NpmCommand.Custom:
68-
npmRegistriesAry = await npmCustom.getCustomRegistries(packagingLocation);
69-
break;
70-
case NpmCommand.Publish:
71-
npmRegistriesAry = [await npmPublish.getPublishRegistry(packagingLocation)];
72-
break;
73-
}
74-
for (const registry of npmRegistriesAry) {
75-
registryUrlAry.push(registry.url);
76-
}
77-
78-
const npmTelem = {
79-
'command': command,
80-
'verbose': tl.getInput(NpmTaskInput.Verbose) || null,
81-
'customRegistry': tl.getInput(NpmTaskInput.CustomRegistry) || null,
82-
'customFeed': tl.getInput(NpmTaskInput.CustomFeed) || null,
83-
'customEndpoint': tl.getInput(NpmTaskInput.CustomEndpoint) || null,
84-
'publishRegistry': tl.getInput(NpmTaskInput.PublishRegistry) || null,
85-
'publishFeed': tl.getInput(NpmTaskInput.PublishFeed) || null,
86-
'publishEndpoint': tl.getInput(NpmTaskInput.PublishEndpoint) || null,
87-
'npmVersion': version,
88-
'registries': registryUrlAry
89-
};
90-
91-
telemetry.emitTelemetry('Packaging', 'npm', npmTelem);
92-
} catch (err) {
93-
tl.debug(`Unable to log NPM task telemetry. Err:( ${err} )`);
94-
}
95-
}
96-
9747
main().catch(error => {
9848
tl.rmRF(util.getTempPath());
9949
tl.setResult(tl.TaskResult.Failed, error);

Tasks/NpmV1/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"author": "Microsoft Corporation",
1010
"version": {
1111
"Major": 1,
12-
"Minor": 247,
12+
"Minor": 248,
1313
"Patch": 0
1414
},
1515
"runsOn": [

Tasks/NpmV1/task.loc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"author": "Microsoft Corporation",
1010
"version": {
1111
"Major": 1,
12-
"Minor": 247,
12+
"Minor": 248,
1313
"Patch": 0
1414
},
1515
"runsOn": [

_generated/NpmV1.versionmap.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Default|1.247.0
2-
Node20_229_1|1.247.1
1+
Default|1.248.0
2+
Node20_229_1|1.248.1

_generated/NpmV1/Tests/L0.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ describe('Npm Task', function () {
178178

179179
tr.run();
180180

181-
assert.equal(tr.invokedToolCount, 3, 'task should have run npm');
181+
assert.equal(tr.invokedToolCount, 2, 'task should have run npm');
182182
assert(tr.succeeded, 'task should have succeeded');
183183
assert(tr.stdOutContained('; debug cli configs'), 'should have debug npm config output');
184184
assert(tr.stdOutContained('; cli configs') === false, 'should not have regular npm config output');
@@ -194,7 +194,7 @@ describe('Npm Task', function () {
194194

195195
tr.run();
196196

197-
assert.equal(tr.invokedToolCount, 3, 'task should have run npm');
197+
assert.equal(tr.invokedToolCount, 2, 'task should have run npm');
198198
assert(tr.succeeded, 'task should have succeeded');
199199
assert(tr.stdOutContained('; cli configs'), 'should have regular npm config output');
200200
assert(tr.stdOutContained('; debug cli configs') === false, 'should not have debug npm config output');
@@ -222,7 +222,7 @@ describe('Npm Task', function () {
222222

223223
tr.run();
224224

225-
assert.equal(tr.invokedToolCount, 3, 'task should have run npm');
225+
assert.equal(tr.invokedToolCount, 2, 'task should have run npm');
226226
assert(tr.stdOutContained('npm install successful'), 'npm should have installed the package');
227227
assert(tr.stdOutContained('OverridingProjectNpmrc'), 'install from feed shoud override project .npmrc');
228228
assert(tr.stdOutContained('RestoringProjectNpmrc'), 'install from .npmrc shoud restore project .npmrc');
@@ -238,7 +238,7 @@ describe('Npm Task', function () {
238238

239239
tr.run();
240240

241-
assert.equal(tr.invokedToolCount, 3, 'task should have run npm');
241+
assert.equal(tr.invokedToolCount, 2, 'task should have run npm');
242242
assert(tr.stdOutContained('npm install successful'), 'npm should have installed the package');
243243
assert(tr.stdOutContained('OverridingProjectNpmrc'), 'install from feed shoud override project .npmrc');
244244
assert(tr.stdOutContained('RestoringProjectNpmrc'), 'install from .npmrc shoud restore project .npmrc');
@@ -254,7 +254,7 @@ describe('Npm Task', function () {
254254

255255
tr.run();
256256

257-
assert.equal(tr.invokedToolCount, 3, 'task should have run npm');
257+
assert.equal(tr.invokedToolCount, 2, 'task should have run npm');
258258
assert(tr.stdOutContained('npm install successful'), 'npm should have installed the package');
259259
assert(!tr.stdOutContained('OverridingProjectNpmrc'), 'install from .npmrc shoud not override project .npmrc');
260260
assert(!tr.stdOutContained('RestoringProjectNpmrc'), 'install from .npmrc shoud not restore project .npmrc');
@@ -286,7 +286,7 @@ describe('Npm Task', function () {
286286

287287
tr.run();
288288

289-
assert.equal(tr.invokedToolCount, 3, 'task should have run npm');
289+
assert.equal(tr.invokedToolCount, 2, 'task should have run npm');
290290
assert(tr.stdOutContained('npm publish successful'), 'npm should have published the package');
291291
assert(tr.stdOutContained('OverridingProjectNpmrc'), 'publish should always ooverrideverride project .npmrc');
292292
assert(tr.stdOutContained('RestoringProjectNpmrc'), 'publish should always restore project .npmrc');
@@ -302,7 +302,7 @@ describe('Npm Task', function () {
302302

303303
tr.run();
304304

305-
assert.equal(tr.invokedToolCount, 3, 'task should have run npm');
305+
assert.equal(tr.invokedToolCount, 2, 'task should have run npm');
306306
assert(tr.stdOutContained('npm publish successful'), 'npm should have published the package');
307307
assert(tr.stdOutContained('OverridingProjectNpmrc'), 'publish should always ooverrideverride project .npmrc');
308308
assert(tr.stdOutContained('RestoringProjectNpmrc'), 'publish should always restore project .npmrc');
@@ -318,7 +318,7 @@ describe('Npm Task', function () {
318318

319319
tr.run();
320320

321-
assert.equal(tr.invokedToolCount, 3, 'task should have run npm');
321+
assert.equal(tr.invokedToolCount, 2, 'task should have run npm');
322322
assert(tr.stdOutContained('npm publish successful'), 'npm should have published the package');
323323
assert(tr.succeeded, 'task should have succeeded');
324324

_generated/NpmV1/npm.ts

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ async function main(): Promise<void> {
2727
packagingLocation.PackagingUris.push(forcedUrl);
2828
}
2929

30-
await _logNpmStartupVariables(packagingLocation);
3130

3231
const command = tl.getInput(NpmTaskInput.Command) || null;
3332
switch (command) {
@@ -45,55 +44,6 @@ async function main(): Promise<void> {
4544
}
4645
}
4746

48-
async function _logNpmStartupVariables(packagingLocation: pkgLocationUtils.PackagingLocation) {
49-
try {
50-
// Log the NPM version
51-
let version: string;
52-
try {
53-
const syncResult: IExecSyncResult = tl.execSync('npm', '--version');
54-
if (syncResult.stdout) {
55-
version = syncResult.stdout.trim();
56-
}
57-
} catch (err) {
58-
tl.debug(`Unable to get NPM config info. Err:( ${err} )`);
59-
}
60-
61-
// Log the NPM registries
62-
const command = tl.getInput(NpmTaskInput.Command) || null;
63-
let npmRegistriesAry: INpmRegistry[];
64-
const registryUrlAry = [];
65-
switch (command) {
66-
case NpmCommand.Install:
67-
case NpmCommand.Custom:
68-
npmRegistriesAry = await npmCustom.getCustomRegistries(packagingLocation);
69-
break;
70-
case NpmCommand.Publish:
71-
npmRegistriesAry = [await npmPublish.getPublishRegistry(packagingLocation)];
72-
break;
73-
}
74-
for (const registry of npmRegistriesAry) {
75-
registryUrlAry.push(registry.url);
76-
}
77-
78-
const npmTelem = {
79-
'command': command,
80-
'verbose': tl.getInput(NpmTaskInput.Verbose) || null,
81-
'customRegistry': tl.getInput(NpmTaskInput.CustomRegistry) || null,
82-
'customFeed': tl.getInput(NpmTaskInput.CustomFeed) || null,
83-
'customEndpoint': tl.getInput(NpmTaskInput.CustomEndpoint) || null,
84-
'publishRegistry': tl.getInput(NpmTaskInput.PublishRegistry) || null,
85-
'publishFeed': tl.getInput(NpmTaskInput.PublishFeed) || null,
86-
'publishEndpoint': tl.getInput(NpmTaskInput.PublishEndpoint) || null,
87-
'npmVersion': version,
88-
'registries': registryUrlAry
89-
};
90-
91-
telemetry.emitTelemetry('Packaging', 'npm', npmTelem);
92-
} catch (err) {
93-
tl.debug(`Unable to log NPM task telemetry. Err:( ${err} )`);
94-
}
95-
}
96-
9747
main().catch(error => {
9848
tl.rmRF(util.getTempPath());
9949
tl.setResult(tl.TaskResult.Failed, error);

_generated/NpmV1/task.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"author": "Microsoft Corporation",
1010
"version": {
1111
"Major": 1,
12-
"Minor": 247,
12+
"Minor": 248,
1313
"Patch": 0
1414
},
1515
"runsOn": [
@@ -208,7 +208,7 @@
208208
"UnsupportedServiceConnectionAuth": "The service connection does not use a supported authentication method. Please use a service connection with personal access token based auth."
209209
},
210210
"_buildConfigMapping": {
211-
"Default": "1.247.0",
212-
"Node20_229_1": "1.247.1"
211+
"Default": "1.248.0",
212+
"Node20_229_1": "1.248.1"
213213
}
214214
}

_generated/NpmV1/task.loc.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"author": "Microsoft Corporation",
1010
"version": {
1111
"Major": 1,
12-
"Minor": 247,
12+
"Minor": 248,
1313
"Patch": 0
1414
},
1515
"runsOn": [
@@ -208,7 +208,7 @@
208208
"UnsupportedServiceConnectionAuth": "ms-resource:loc.messages.UnsupportedServiceConnectionAuth"
209209
},
210210
"_buildConfigMapping": {
211-
"Default": "1.247.0",
212-
"Node20_229_1": "1.247.1"
211+
"Default": "1.248.0",
212+
"Node20_229_1": "1.248.1"
213213
}
214214
}

0 commit comments

Comments
 (0)