diff --git a/CHANGELOG.md b/CHANGELOG.md
index b32065a..c1e0c1e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,16 @@
Task 6.0.3
- Fix minimum agent requirement to `2.206.1` ([#13](https://github.com/qetza/replacetokens-task/issues/13)).
- Fix paths in sources incompatible with `fast-glob` syntax on win32 ([#16](https://github.com/qetza/replacetokens-task/issues/16)).
+- Add agent OS in telemetry ([#5](https://github.com/qetza/replacetokens-task/issues/5)).
+
+Task 5.3.1
+- Add agent OS in telemetry ([#5](https://github.com/qetza/replacetokens-task/issues/5)).
+
+Task 4.4.1
+- Add agent OS in telemetry ([#5](https://github.com/qetza/replacetokens-task/issues/5)).
+
+Task 3.12.1
+- Add agent OS in telemetry ([#5](https://github.com/qetza/replacetokens-task/issues/5)).
## 5.0.2
Task 6.0.2
diff --git a/README.md b/README.md
index 3a72e9e..556dd91 100644
--- a/README.md
+++ b/README.md
@@ -319,6 +319,7 @@ The following **anonymous** data is send:
- the **hash** of your collection id
- the **hash** of your project id and pipeline definition id
- the hosting (`server` or `cloud`)
+- the agent OS (`Windows`, `macOS` or `Linux`)
- the inputs values for
- _addBOM_
- _charsToEscape_
diff --git a/tasks/ReplaceTokensV3/CHANGELOG.md b/tasks/ReplaceTokensV3/CHANGELOG.md
index 5d7cb6d..ccc5b8c 100644
--- a/tasks/ReplaceTokensV3/CHANGELOG.md
+++ b/tasks/ReplaceTokensV3/CHANGELOG.md
@@ -1,5 +1,8 @@
# Changelog
+## 3.12.1
+- Add agent OS in telemetry ([#5](https://github.com/qetza/replacetokens-task/issues/5)).
+
## 3.12.0
- Add support for `indent` transformation with indent size and indent first line parameters ([326](https://github.com/qetza/vsts-replacetokens-task/issues/326)).
- Add support for `REPLACETOKENS_TELEMETRY_OPTOUT` environment variable.
diff --git a/tasks/ReplaceTokensV3/README.md b/tasks/ReplaceTokensV3/README.md
index 2b277b5..33e3764 100644
--- a/tasks/ReplaceTokensV3/README.md
+++ b/tasks/ReplaceTokensV3/README.md
@@ -240,6 +240,7 @@ The following **anonymous** data is send:
- the **hash** of your project id and pipeline definition id
- the pipeline type (`build` or `release`)
- the hosting (`server` or `services`)
+- the agent OS (`Windows`, `macOS` or `Linux`)
- the input values for
- _actionOnMissing_
- _charsToEscape_
diff --git a/tasks/ReplaceTokensV3/index.ts b/tasks/ReplaceTokensV3/index.ts
index 928f617..80a7ab9 100644
--- a/tasks/ReplaceTokensV3/index.ts
+++ b/tasks/ReplaceTokensV3/index.ts
@@ -520,6 +520,19 @@ async function run() {
.digest('hex');
telemetryEvent.pipelineType = tl.getVariable('release.releaseid') ? 'release' : 'build';
telemetryEvent.serverType = !serverType || serverType.toLowerCase() !== 'hosted' ? 'server' : 'cloud';
+ telemetryEvent.os = (() => {
+ const os = tl.getVariable('Agent.OS');
+ switch (os) {
+ case 'Windows_NT':
+ return 'Windows';
+ case 'Darwin':
+ return 'macOS';
+ case 'Linux':
+ return 'Linux';
+ default:
+ return os || 'unknown';
+ }
+ })();
// load inputs
const root: string = tl.getPathInput('rootDirectory', false, true);
diff --git a/tasks/ReplaceTokensV3/task.json b/tasks/ReplaceTokensV3/task.json
index 16b9213..b928770 100644
--- a/tasks/ReplaceTokensV3/task.json
+++ b/tasks/ReplaceTokensV3/task.json
@@ -13,7 +13,7 @@
"version": {
"Major": 3,
"Minor": 12,
- "Patch": 0
+ "Patch": 1
},
"instanceNameFormat": "Replace tokens in $(targetFiles)",
"minimumAgentVersion": "2.105.0",
diff --git a/tasks/ReplaceTokensV3/telemetry.ts b/tasks/ReplaceTokensV3/telemetry.ts
index c5d46b0..0369ea7 100644
--- a/tasks/ReplaceTokensV3/telemetry.ts
+++ b/tasks/ReplaceTokensV3/telemetry.ts
@@ -73,7 +73,8 @@ export default function trackEvent(event: TelemetryEvent, proxyUrl?: string): st
inlineVariables: event.inlineVariables,
enableRecursion: event.enableRecursion,
useLegacyEmptyFeature: event.useLegacyEmptyFeature,
- useDefaultValue: event.useDefaultValue
+ useDefaultValue: event.useDefaultValue,
+ os: event.os
}
}
}
@@ -170,4 +171,5 @@ export interface TelemetryEvent {
enableRecursion: boolean;
useLegacyEmptyFeature: boolean;
useDefaultValue: boolean;
+ os: string;
}
diff --git a/tasks/ReplaceTokensV3/tests/L0.ts b/tasks/ReplaceTokensV3/tests/L0.ts
index cfc3645..09fd436 100644
--- a/tasks/ReplaceTokensV3/tests/L0.ts
+++ b/tasks/ReplaceTokensV3/tests/L0.ts
@@ -56,6 +56,7 @@ describe('ReplaceTokens v3 L0 suite', function () {
process.env['SYSTEM_COLLECTIONID'] = 'col01';
process.env['SYSTEM_TEAMPROJECTID'] = 'project01';
process.env['SYSTEM_DEFINITIONID'] = 'def01';
+ process.env['AGENT_OS'] = 'Windows_NT';
if (fs.existsSync(tmp)) removeFolder(tmp);
@@ -67,6 +68,7 @@ describe('ReplaceTokens v3 L0 suite', function () {
delete process.env['SYSTEM_COLLECTIONID'];
delete process.env['SYSTEM_TEAMPROJECTID'];
delete process.env['SYSTEM_DEFINITIONID'];
+ delete process.env['AGENT_OS'];
});
afterEach(() => {
@@ -165,7 +167,7 @@ describe('ReplaceTokens v3 L0 suite', function () {
tr.stdout.should.include('telemetry sent');
tr.stdout.should.match(
- /\{"name":"Microsoft\.ApplicationInsights\.Dev\.\*+\.Event","time":"[^"]+","iKey":"\*+","tags":\{"ai\.application\.ver":"3\.\d+\.\d+","ai\.cloud\.role":"server","ai\.internal\.sdkVersion":"replacetokens:1\.0\.0","ai\.operation\.id":"([^"]+)","ai\.operation\.name":"replacetokens-task","ai\.operation\.parentId":"\|\1","ai\.user\.accountId":"494d0aad9d06c4ddb51d5300620122ce55366a9382b3cc2835ed5f0e2e67b4d0","ai\.user\.authUserId":"b98ed03d3eec376dcc015365c1a944e3ebbcc33d30e3261af3f4e4abb107aa82"},"data":\{"baseType":"EventData","baseData":\{"ver":"2","name":"tokens\.replaced","properties":\{"preview":false,"pipelineType":"build","result":"failed"}}}}/
+ /\{"name":"Microsoft\.ApplicationInsights\.Dev\.\*+\.Event","time":"[^"]+","iKey":"\*+","tags":\{"ai\.application\.ver":"3\.\d+\.\d+","ai\.cloud\.role":"server","ai\.internal\.sdkVersion":"replacetokens:1\.0\.0","ai\.operation\.id":"([^"]+)","ai\.operation\.name":"replacetokens-task","ai\.operation\.parentId":"\|\1","ai\.user\.accountId":"494d0aad9d06c4ddb51d5300620122ce55366a9382b3cc2835ed5f0e2e67b4d0","ai\.user\.authUserId":"b98ed03d3eec376dcc015365c1a944e3ebbcc33d30e3261af3f4e4abb107aa82"},"data":\{"baseType":"EventData","baseData":\{"ver":"2","name":"tokens\.replaced","properties":\{"preview":false,"pipelineType":"build","result":"failed","os":"Windows"}}}}/
);
},
tr,
@@ -190,7 +192,7 @@ describe('ReplaceTokens v3 L0 suite', function () {
tr.stdout.should.include('telemetry sent');
tr.stdout.should.match(
- /\{"name":"Microsoft\.ApplicationInsights\.Dev\.\*+\.Event","time":"[^"]+","iKey":"\*+","tags":\{"ai\.application\.ver":"3\.\d+\.\d+","ai\.cloud\.role":"server","ai\.internal\.sdkVersion":"replacetokens:1\.0\.0","ai\.operation\.id":"([^"]+)","ai\.operation\.name":"replacetokens-task","ai\.operation\.parentId":"\|\1","ai\.user\.accountId":"494d0aad9d06c4ddb51d5300620122ce55366a9382b3cc2835ed5f0e2e67b4d0","ai\.user\.authUserId":"b98ed03d3eec376dcc015365c1a944e3ebbcc33d30e3261af3f4e4abb107aa82"},"data":\{"baseType":"EventData","baseData":\{"ver":"2","name":"tokens\.replaced","properties":\{"preview":false,"pipelineType":"build","result":"succeed","tokenPrefix":"#{","tokenSuffix":"}#","pattern":"#\\\\{\\\\s\*\(\(\?:\(\?!#\\\\{\)\(\?!\\\\s\*\\\\}#\)\.\)\*\)\\\\s\*\\\\}#","encoding":"auto","keepToken":false,"actionOnMissing":"warn","writeBOM":true,"verbosity":"normal","variableFiles":0,"rules":1,"rulesWithInputWildcard":0,"rulesWithOutputPattern":0,"rulesWithNegativePattern":0,"duration":\d+(?:\.\d+)?,"tokenReplaced":1,"tokenFound":1,"fileProcessed":1,"useLegacyPattern":false,"enableTransforms":false,"transformPrefix":"\(","transformSuffix":"\)","transformPattern":"\\\\s\*\(\.\*\)\\\\\(\\\\s\*\(\(\?:\(\?!\\\\\(\)\(\?!\\\\s\*\\\\\)\)\.\)\*\)\\\\s\*\\\\\)\\\\s\*","transformExecuted":0,"defaultValue":"","defaultValueReplaced":0,"actionOnNoFiles":"continue","inlineVariables":0,"enableRecursion":false,"useLegacyEmptyFeature":false,"useDefaultValue":false}}}}/
+ /\{"name":"Microsoft\.ApplicationInsights\.Dev\.\*+\.Event","time":"[^"]+","iKey":"\*+","tags":\{"ai\.application\.ver":"3\.\d+\.\d+","ai\.cloud\.role":"server","ai\.internal\.sdkVersion":"replacetokens:1\.0\.0","ai\.operation\.id":"([^"]+)","ai\.operation\.name":"replacetokens-task","ai\.operation\.parentId":"\|\1","ai\.user\.accountId":"494d0aad9d06c4ddb51d5300620122ce55366a9382b3cc2835ed5f0e2e67b4d0","ai\.user\.authUserId":"b98ed03d3eec376dcc015365c1a944e3ebbcc33d30e3261af3f4e4abb107aa82"},"data":\{"baseType":"EventData","baseData":\{"ver":"2","name":"tokens\.replaced","properties":\{"preview":false,"pipelineType":"build","result":"succeed","tokenPrefix":"#{","tokenSuffix":"}#","pattern":"#\\\\{\\\\s\*\(\(\?:\(\?!#\\\\{\)\(\?!\\\\s\*\\\\}#\)\.\)\*\)\\\\s\*\\\\}#","encoding":"auto","keepToken":false,"actionOnMissing":"warn","writeBOM":true,"verbosity":"normal","variableFiles":0,"rules":1,"rulesWithInputWildcard":0,"rulesWithOutputPattern":0,"rulesWithNegativePattern":0,"duration":\d+(?:\.\d+)?,"tokenReplaced":1,"tokenFound":1,"fileProcessed":1,"useLegacyPattern":false,"enableTransforms":false,"transformPrefix":"\(","transformSuffix":"\)","transformPattern":"\\\\s\*\(\.\*\)\\\\\(\\\\s\*\(\(\?:\(\?!\\\\\(\)\(\?!\\\\s\*\\\\\)\)\.\)\*\)\\\\s\*\\\\\)\\\\s\*","transformExecuted":0,"defaultValue":"","defaultValueReplaced":0,"actionOnNoFiles":"continue","inlineVariables":0,"enableRecursion":false,"useLegacyEmptyFeature":false,"useDefaultValue":false,"os":"Windows"}}}}/
);
},
tr,
diff --git a/tasks/ReplaceTokensV4/CHANGELOG.md b/tasks/ReplaceTokensV4/CHANGELOG.md
index 7c7dcc1..85f38c7 100644
--- a/tasks/ReplaceTokensV4/CHANGELOG.md
+++ b/tasks/ReplaceTokensV4/CHANGELOG.md
@@ -1,5 +1,8 @@
# Changelog
+## 4.4.1
+- Add agent OS in telemetry ([#5](https://github.com/qetza/replacetokens-task/issues/5)).
+
## 4.4.0
- Add support for `indent` transformation with indent size and indent first line parameters ([326](https://github.com/qetza/vsts-replacetokens-task/issues/326)).
- Add support for `REPLACETOKENS_TELEMETRY_OPTOUT` environment variable.
diff --git a/tasks/ReplaceTokensV4/README.md b/tasks/ReplaceTokensV4/README.md
index aad28a4..45db8e9 100644
--- a/tasks/ReplaceTokensV4/README.md
+++ b/tasks/ReplaceTokensV4/README.md
@@ -278,6 +278,7 @@ The following **anonymous** data is send:
- the **hash** of your project id and pipeline definition id
- the pipeline type (`build` or `release`)
- the hosting (`server` or `services`)
+- the agent OS (`Windows`, `macOS` or `Linux`)
- the input values for
- _actionOnMissing_
- _charsToEscape_
diff --git a/tasks/ReplaceTokensV4/index.ts b/tasks/ReplaceTokensV4/index.ts
index e93c1e6..ca53996 100644
--- a/tasks/ReplaceTokensV4/index.ts
+++ b/tasks/ReplaceTokensV4/index.ts
@@ -520,6 +520,19 @@ async function run() {
.digest('hex');
telemetryEvent.pipelineType = tl.getVariable('release.releaseid') ? 'release' : 'build';
telemetryEvent.serverType = !serverType || serverType.toLowerCase() !== 'hosted' ? 'server' : 'cloud';
+ telemetryEvent.os = (() => {
+ const os = tl.getVariable('Agent.OS');
+ switch (os) {
+ case 'Windows_NT':
+ return 'Windows';
+ case 'Darwin':
+ return 'macOS';
+ case 'Linux':
+ return 'Linux';
+ default:
+ return os || 'unknown';
+ }
+ })();
// load inputs
const root: string = tl.getPathInput('rootDirectory', false, true);
diff --git a/tasks/ReplaceTokensV4/task.json b/tasks/ReplaceTokensV4/task.json
index 3847cf2..597effa 100644
--- a/tasks/ReplaceTokensV4/task.json
+++ b/tasks/ReplaceTokensV4/task.json
@@ -13,7 +13,7 @@
"version": {
"Major": 4,
"Minor": 4,
- "Patch": 0
+ "Patch": 1
},
"releaseNotes": "Added output variables (breaking change).
Added token pattern dropdown (breaking change).",
"instanceNameFormat": "Replace tokens in $(targetFiles)",
diff --git a/tasks/ReplaceTokensV4/telemetry.ts b/tasks/ReplaceTokensV4/telemetry.ts
index ac97b26..0d678a6 100644
--- a/tasks/ReplaceTokensV4/telemetry.ts
+++ b/tasks/ReplaceTokensV4/telemetry.ts
@@ -74,7 +74,8 @@ export default function trackEvent(event: TelemetryEvent, proxyUrl?: string): st
inlineVariables: event.inlineVariables,
enableRecursion: event.enableRecursion,
useLegacyEmptyFeature: event.useLegacyEmptyFeature,
- useDefaultValue: event.useDefaultValue
+ useDefaultValue: event.useDefaultValue,
+ os: event.os
}
}
}
@@ -172,4 +173,5 @@ export interface TelemetryEvent {
enableRecursion: boolean;
useLegacyEmptyFeature: boolean;
useDefaultValue: boolean;
+ os: string;
}
diff --git a/tasks/ReplaceTokensV4/tests/L0.ts b/tasks/ReplaceTokensV4/tests/L0.ts
index 6c9fb1f..3726a27 100644
--- a/tasks/ReplaceTokensV4/tests/L0.ts
+++ b/tasks/ReplaceTokensV4/tests/L0.ts
@@ -56,6 +56,7 @@ describe('ReplaceTokens v4 L0 suite', function () {
process.env['SYSTEM_COLLECTIONID'] = 'col01';
process.env['SYSTEM_TEAMPROJECTID'] = 'project01';
process.env['SYSTEM_DEFINITIONID'] = 'def01';
+ process.env['AGENT_OS'] = 'Windows_NT';
if (fs.existsSync(tmp)) removeFolder(tmp);
@@ -67,6 +68,7 @@ describe('ReplaceTokens v4 L0 suite', function () {
delete process.env['SYSTEM_COLLECTIONID'];
delete process.env['SYSTEM_TEAMPROJECTID'];
delete process.env['SYSTEM_DEFINITIONID'];
+ delete process.env['AGENT_OS'];
});
afterEach(() => {
@@ -165,7 +167,7 @@ describe('ReplaceTokens v4 L0 suite', function () {
tr.stdout.should.include('telemetry sent');
tr.stdout.should.match(
- /\{"name":"Microsoft\.ApplicationInsights\.Dev\.\*+\.Event","time":"[^"]+","iKey":"\*+","tags":\{"ai\.application\.ver":"4\.\d+\.\d+","ai\.cloud\.role":"server","ai\.internal\.sdkVersion":"replacetokens:1\.0\.0","ai\.operation\.id":"([^"]+)","ai\.operation\.name":"replacetokens-task","ai\.operation\.parentId":"\|\1","ai\.user\.accountId":"494d0aad9d06c4ddb51d5300620122ce55366a9382b3cc2835ed5f0e2e67b4d0","ai\.user\.authUserId":"b98ed03d3eec376dcc015365c1a944e3ebbcc33d30e3261af3f4e4abb107aa82"},"data":\{"baseType":"EventData","baseData":\{"ver":"2","name":"tokens\.replaced","properties":\{"preview":false,"pipelineType":"build","result":"failed"}}}}/
+ /\{"name":"Microsoft\.ApplicationInsights\.Dev\.\*+\.Event","time":"[^"]+","iKey":"\*+","tags":\{"ai\.application\.ver":"4\.\d+\.\d+","ai\.cloud\.role":"server","ai\.internal\.sdkVersion":"replacetokens:1\.0\.0","ai\.operation\.id":"([^"]+)","ai\.operation\.name":"replacetokens-task","ai\.operation\.parentId":"\|\1","ai\.user\.accountId":"494d0aad9d06c4ddb51d5300620122ce55366a9382b3cc2835ed5f0e2e67b4d0","ai\.user\.authUserId":"b98ed03d3eec376dcc015365c1a944e3ebbcc33d30e3261af3f4e4abb107aa82"},"data":\{"baseType":"EventData","baseData":\{"ver":"2","name":"tokens\.replaced","properties":\{"preview":false,"pipelineType":"build","result":"failed","os":"Windows"}}}}/
);
},
tr,
@@ -190,7 +192,7 @@ describe('ReplaceTokens v4 L0 suite', function () {
tr.stdout.should.include('telemetry sent');
tr.stdout.should.match(
- /\{"name":"Microsoft\.ApplicationInsights\.Dev\.\*+\.Event","time":"[^"]+","iKey":"\*+","tags":\{"ai\.application\.ver":"4\.\d+\.\d+","ai\.cloud\.role":"server","ai\.internal\.sdkVersion":"replacetokens:1\.0\.0","ai\.operation\.id":"([^"]+)","ai\.operation\.name":"replacetokens-task","ai\.operation\.parentId":"\|\1","ai\.user\.accountId":"494d0aad9d06c4ddb51d5300620122ce55366a9382b3cc2835ed5f0e2e67b4d0","ai\.user\.authUserId":"b98ed03d3eec376dcc015365c1a944e3ebbcc33d30e3261af3f4e4abb107aa82"},"data":\{"baseType":"EventData","baseData":\{"ver":"2","name":"tokens\.replaced","properties":\{"preview":false,"pipelineType":"build","result":"succeed","tokenPrefix":"#{","tokenSuffix":"}#","pattern":"#\\\\{\\\\s\*\(\(\?:\(\?!#\\\\{\)\(\?!\\\\s\*\\\\}#\)\.\)\*\)\\\\s\*\\\\}#","encoding":"auto","keepToken":false,"actionOnMissing":"warn","writeBOM":true,"verbosity":"normal","variableFiles":0,"rules":1,"rulesWithInputWildcard":0,"rulesWithOutputPattern":0,"rulesWithNegativePattern":0,"duration":\d+(?:\.\d+)?,"tokenReplaced":1,"tokenFound":1,"fileProcessed":1,"useLegacyPattern":false,"enableTransforms":false,"transformPrefix":"\(","transformSuffix":"\)","transformPattern":"\\\\s\*\(\.\*\)\\\\\(\\\\s\*\(\(\?:\(\?!\\\\\(\)\(\?!\\\\s\*\\\\\)\)\.\)\*\)\\\\s\*\\\\\)\\\\s\*","transformExecuted":0,"defaultValue":"","defaultValueReplaced":0,"tokenPattern":"default","actionOnNoFiles":"continue","inlineVariables":0,"enableRecursion":false,"useLegacyEmptyFeature":false,"useDefaultValue":false}}}}/
+ /\{"name":"Microsoft\.ApplicationInsights\.Dev\.\*+\.Event","time":"[^"]+","iKey":"\*+","tags":\{"ai\.application\.ver":"4\.\d+\.\d+","ai\.cloud\.role":"server","ai\.internal\.sdkVersion":"replacetokens:1\.0\.0","ai\.operation\.id":"([^"]+)","ai\.operation\.name":"replacetokens-task","ai\.operation\.parentId":"\|\1","ai\.user\.accountId":"494d0aad9d06c4ddb51d5300620122ce55366a9382b3cc2835ed5f0e2e67b4d0","ai\.user\.authUserId":"b98ed03d3eec376dcc015365c1a944e3ebbcc33d30e3261af3f4e4abb107aa82"},"data":\{"baseType":"EventData","baseData":\{"ver":"2","name":"tokens\.replaced","properties":\{"preview":false,"pipelineType":"build","result":"succeed","tokenPrefix":"#{","tokenSuffix":"}#","pattern":"#\\\\{\\\\s\*\(\(\?:\(\?!#\\\\{\)\(\?!\\\\s\*\\\\}#\)\.\)\*\)\\\\s\*\\\\}#","encoding":"auto","keepToken":false,"actionOnMissing":"warn","writeBOM":true,"verbosity":"normal","variableFiles":0,"rules":1,"rulesWithInputWildcard":0,"rulesWithOutputPattern":0,"rulesWithNegativePattern":0,"duration":\d+(?:\.\d+)?,"tokenReplaced":1,"tokenFound":1,"fileProcessed":1,"useLegacyPattern":false,"enableTransforms":false,"transformPrefix":"\(","transformSuffix":"\)","transformPattern":"\\\\s\*\(\.\*\)\\\\\(\\\\s\*\(\(\?:\(\?!\\\\\(\)\(\?!\\\\s\*\\\\\)\)\.\)\*\)\\\\s\*\\\\\)\\\\s\*","transformExecuted":0,"defaultValue":"","defaultValueReplaced":0,"tokenPattern":"default","actionOnNoFiles":"continue","inlineVariables":0,"enableRecursion":false,"useLegacyEmptyFeature":false,"useDefaultValue":false,"os":"Windows"}}}}/
);
},
tr,
diff --git a/tasks/ReplaceTokensV5/CHANGELOG.md b/tasks/ReplaceTokensV5/CHANGELOG.md
index c89901f..c6511de 100644
--- a/tasks/ReplaceTokensV5/CHANGELOG.md
+++ b/tasks/ReplaceTokensV5/CHANGELOG.md
@@ -1,5 +1,8 @@
# Changelog
+## 5.3.1
+- Add agent OS in telemetry ([#5](https://github.com/qetza/replacetokens-task/issues/5)).
+
## 5.3.0
- Add support for `indent` transformation with indent size and indent first line parameters ([326](https://github.com/qetza/vsts-replacetokens-task/issues/326)).
- Add support for `REPLACETOKENS_TELEMETRY_OPTOUT` environment variable.
diff --git a/tasks/ReplaceTokensV5/README.md b/tasks/ReplaceTokensV5/README.md
index ef6bdcc..7cb29dd 100644
--- a/tasks/ReplaceTokensV5/README.md
+++ b/tasks/ReplaceTokensV5/README.md
@@ -276,6 +276,7 @@ The following **anonymous** data is send:
- the **hash** of your project id and pipeline definition id
- the pipeline type (`build` or `release`)
- the hosting (`server` or `services`)
+- the agent OS (`Windows`, `macOS` or `Linux`)
- the input values for
- _actionOnMissing_
- _charsToEscape_
diff --git a/tasks/ReplaceTokensV5/index.ts b/tasks/ReplaceTokensV5/index.ts
index 064b751..e154981 100644
--- a/tasks/ReplaceTokensV5/index.ts
+++ b/tasks/ReplaceTokensV5/index.ts
@@ -519,6 +519,19 @@ async function run() {
.digest('hex');
telemetryEvent.pipelineType = tl.getVariable('release.releaseid') ? 'release' : 'build';
telemetryEvent.serverType = !serverType || serverType.toLowerCase() !== 'hosted' ? 'server' : 'cloud';
+ telemetryEvent.os = (() => {
+ const os = tl.getVariable('Agent.OS');
+ switch (os) {
+ case 'Windows_NT':
+ return 'Windows';
+ case 'Darwin':
+ return 'macOS';
+ case 'Linux':
+ return 'Linux';
+ default:
+ return os || 'unknown';
+ }
+ })();
// load inputs
const root: string = tl.getPathInput('rootDirectory', false, true);
diff --git a/tasks/ReplaceTokensV5/task.json b/tasks/ReplaceTokensV5/task.json
index b660542..ada9230 100644
--- a/tasks/ReplaceTokensV5/task.json
+++ b/tasks/ReplaceTokensV5/task.json
@@ -13,7 +13,7 @@
"version": {
"Major": 5,
"Minor": 3,
- "Patch": 0
+ "Patch": 1
},
"releaseNotes": "Migrate to Node10 handler (breaking change).
Add Node16 handler.",
"instanceNameFormat": "Replace tokens in $(targetFiles)",
diff --git a/tasks/ReplaceTokensV5/telemetry.ts b/tasks/ReplaceTokensV5/telemetry.ts
index 80e1ac6..e5c8566 100644
--- a/tasks/ReplaceTokensV5/telemetry.ts
+++ b/tasks/ReplaceTokensV5/telemetry.ts
@@ -74,7 +74,8 @@ export default function trackEvent(event: TelemetryEvent, proxyUrl?: string): st
inlineVariables: event.inlineVariables,
enableRecursion: event.enableRecursion,
useLegacyEmptyFeature: event.useLegacyEmptyFeature,
- useDefaultValue: event.useDefaultValue
+ useDefaultValue: event.useDefaultValue,
+ os: event.os
}
}
}
@@ -175,4 +176,5 @@ export interface TelemetryEvent {
enableRecursion: boolean;
useLegacyEmptyFeature: boolean;
useDefaultValue: boolean;
+ os: string;
}
diff --git a/tasks/ReplaceTokensV5/tests/L0.ts b/tasks/ReplaceTokensV5/tests/L0.ts
index a4ab251..d2b4e7d 100644
--- a/tasks/ReplaceTokensV5/tests/L0.ts
+++ b/tasks/ReplaceTokensV5/tests/L0.ts
@@ -55,6 +55,7 @@ describe('ReplaceTokens v5 L0 suite', function () {
process.env['SYSTEM_COLLECTIONID'] = 'col01';
process.env['SYSTEM_TEAMPROJECTID'] = 'project01';
process.env['SYSTEM_DEFINITIONID'] = 'def01';
+ process.env['AGENT_OS'] = 'Windows_NT';
if (fs.existsSync(tmp)) removeFolder(tmp);
@@ -66,6 +67,7 @@ describe('ReplaceTokens v5 L0 suite', function () {
delete process.env['SYSTEM_COLLECTIONID'];
delete process.env['SYSTEM_TEAMPROJECTID'];
delete process.env['SYSTEM_DEFINITIONID'];
+ delete process.env['AGENT_OS'];
});
afterEach(() => {
@@ -164,7 +166,7 @@ describe('ReplaceTokens v5 L0 suite', function () {
tr.stdout.should.include('telemetry sent');
tr.stdout.should.match(
- /\{"name":"Microsoft\.ApplicationInsights\.Dev\.\*+\.Event","time":"[^"]+","iKey":"\*+","tags":\{"ai\.application\.ver":"5\.\d+\.\d+","ai\.cloud\.role":"server","ai\.internal\.sdkVersion":"replacetokens:1\.0\.0","ai\.operation\.id":"([^"]+)","ai\.operation\.name":"replacetokens-task","ai\.operation\.parentId":"\|\1","ai\.user\.accountId":"494d0aad9d06c4ddb51d5300620122ce55366a9382b3cc2835ed5f0e2e67b4d0","ai\.user\.authUserId":"b98ed03d3eec376dcc015365c1a944e3ebbcc33d30e3261af3f4e4abb107aa82"},"data":\{"baseType":"EventData","baseData":\{"ver":"2","name":"tokens\.replaced","properties":\{"preview":false,"pipelineType":"build","result":"failed"}}}}/
+ /\{"name":"Microsoft\.ApplicationInsights\.Dev\.\*+\.Event","time":"[^"]+","iKey":"\*+","tags":\{"ai\.application\.ver":"5\.\d+\.\d+","ai\.cloud\.role":"server","ai\.internal\.sdkVersion":"replacetokens:1\.0\.0","ai\.operation\.id":"([^"]+)","ai\.operation\.name":"replacetokens-task","ai\.operation\.parentId":"\|\1","ai\.user\.accountId":"494d0aad9d06c4ddb51d5300620122ce55366a9382b3cc2835ed5f0e2e67b4d0","ai\.user\.authUserId":"b98ed03d3eec376dcc015365c1a944e3ebbcc33d30e3261af3f4e4abb107aa82"},"data":\{"baseType":"EventData","baseData":\{"ver":"2","name":"tokens\.replaced","properties":\{"preview":false,"pipelineType":"build","result":"failed","os":"Windows"}}}}/
);
},
tr,
@@ -188,7 +190,7 @@ describe('ReplaceTokens v5 L0 suite', function () {
tr.succeeded.should.equal(true, 'task succeeded');
tr.stdout.should.include('telemetry sent');
tr.stdout.should.match(
- /\{"name":"Microsoft\.ApplicationInsights\.Dev\.\*+\.Event","time":"[^"]+","iKey":"\*+","tags":\{"ai\.application\.ver":"5\.\d+\.\d+","ai\.cloud\.role":"server","ai\.internal\.sdkVersion":"replacetokens:1\.0\.0","ai\.operation\.id":"([^"]+)","ai\.operation\.name":"replacetokens-task","ai\.operation\.parentId":"\|\1","ai\.user\.accountId":"494d0aad9d06c4ddb51d5300620122ce55366a9382b3cc2835ed5f0e2e67b4d0","ai\.user\.authUserId":"b98ed03d3eec376dcc015365c1a944e3ebbcc33d30e3261af3f4e4abb107aa82"},"data":\{"baseType":"EventData","baseData":\{"ver":"2","name":"tokens\.replaced","properties":\{"preview":false,"pipelineType":"build","result":"succeed","tokenPrefix":"#{","tokenSuffix":"}#","pattern":"#\\\\{\\\\s\*\(\(\?:\(\?!#\\\\{\)\(\?!\\\\s\*\\\\}#\)\.\)\*\)\\\\s\*\\\\}#","encoding":"auto","keepToken":false,"actionOnMissing":"warn","writeBOM":true,"verbosity":"normal","variableFiles":0,"rules":1,"rulesWithInputWildcard":0,"rulesWithOutputPattern":0,"rulesWithNegativePattern":0,"duration":\d+(?:\.\d+)?,"tokenReplaced":1,"tokenFound":1,"fileProcessed":1,"useLegacyPattern":false,"enableTransforms":false,"transformPrefix":"\(","transformSuffix":"\)","transformPattern":"\\\\s\*\(\.\*\)\\\\\(\\\\s\*\(\(\?:\(\?!\\\\\(\)\(\?!\\\\s\*\\\\\)\)\.\)\*\)\\\\s\*\\\\\)\\\\s\*","transformExecuted":0,"defaultValue":"","defaultValueReplaced":0,"tokenPattern":"default","actionOnNoFiles":"continue","inlineVariables":0,"enableRecursion":false,"useLegacyEmptyFeature":false,"useDefaultValue":false}}}}/
+ /\{"name":"Microsoft\.ApplicationInsights\.Dev\.\*+\.Event","time":"[^"]+","iKey":"\*+","tags":\{"ai\.application\.ver":"5\.\d+\.\d+","ai\.cloud\.role":"server","ai\.internal\.sdkVersion":"replacetokens:1\.0\.0","ai\.operation\.id":"([^"]+)","ai\.operation\.name":"replacetokens-task","ai\.operation\.parentId":"\|\1","ai\.user\.accountId":"494d0aad9d06c4ddb51d5300620122ce55366a9382b3cc2835ed5f0e2e67b4d0","ai\.user\.authUserId":"b98ed03d3eec376dcc015365c1a944e3ebbcc33d30e3261af3f4e4abb107aa82"},"data":\{"baseType":"EventData","baseData":\{"ver":"2","name":"tokens\.replaced","properties":\{"preview":false,"pipelineType":"build","result":"succeed","tokenPrefix":"#{","tokenSuffix":"}#","pattern":"#\\\\{\\\\s\*\(\(\?:\(\?!#\\\\{\)\(\?!\\\\s\*\\\\}#\)\.\)\*\)\\\\s\*\\\\}#","encoding":"auto","keepToken":false,"actionOnMissing":"warn","writeBOM":true,"verbosity":"normal","variableFiles":0,"rules":1,"rulesWithInputWildcard":0,"rulesWithOutputPattern":0,"rulesWithNegativePattern":0,"duration":\d+(?:\.\d+)?,"tokenReplaced":1,"tokenFound":1,"fileProcessed":1,"useLegacyPattern":false,"enableTransforms":false,"transformPrefix":"\(","transformSuffix":"\)","transformPattern":"\\\\s\*\(\.\*\)\\\\\(\\\\s\*\(\(\?:\(\?!\\\\\(\)\(\?!\\\\s\*\\\\\)\)\.\)\*\)\\\\s\*\\\\\)\\\\s\*","transformExecuted":0,"defaultValue":"","defaultValueReplaced":0,"tokenPattern":"default","actionOnNoFiles":"continue","inlineVariables":0,"enableRecursion":false,"useLegacyEmptyFeature":false,"useDefaultValue":false,"os":"Windows"}}}}/
);
},
tr,
diff --git a/tasks/ReplaceTokensV6/CHANGELOG.md b/tasks/ReplaceTokensV6/CHANGELOG.md
index 7de3893..3312772 100644
--- a/tasks/ReplaceTokensV6/CHANGELOG.md
+++ b/tasks/ReplaceTokensV6/CHANGELOG.md
@@ -2,6 +2,7 @@
## 6.0.3
- Fix minimum agent requirement to `2.206.1` ([#13](https://github.com/qetza/replacetokens-task/issues/13)).
- Fix paths in sources incompatible with `fast-glob` syntax on win32 ([#16](https://github.com/qetza/replacetokens-task/issues/16)).
+- Add agent OS in telemetry ([#5](https://github.com/qetza/replacetokens-task/issues/5)).
## 6.0.2
- Add aliases for renamed inputs to ease upgrade ([#11](https://github.com/qetza/replacetokens-task/issues/11)).
diff --git a/tasks/ReplaceTokensV6/README.md b/tasks/ReplaceTokensV6/README.md
index 3bddab4..cfebd39 100644
--- a/tasks/ReplaceTokensV6/README.md
+++ b/tasks/ReplaceTokensV6/README.md
@@ -319,6 +319,7 @@ The following **anonymous** data is send:
- the **hash** of your collection id
- the **hash** of your project id and pipeline definition id
- the hosting (`server` or `cloud`)
+- the agent OS (`Windows`, `macOS` or `Linux`)
- the inputs values for
- _addBOM_
- _charsToEscape_
diff --git a/tasks/ReplaceTokensV6/index.ts b/tasks/ReplaceTokensV6/index.ts
index 2160b54..718aa9c 100644
--- a/tasks/ReplaceTokensV6/index.ts
+++ b/tasks/ReplaceTokensV6/index.ts
@@ -28,7 +28,20 @@ async function run() {
'run',
tl.getVariable('system.collectionid'),
`${tl.getVariable('system.teamprojectid')}${tl.getVariable('system.definitionid')}`,
- !serverType || serverType.toLowerCase() !== 'hosted' ? 'server' : 'cloud'
+ !serverType || serverType.toLowerCase() !== 'hosted' ? 'server' : 'cloud',
+ (() => {
+ const os = tl.getVariable('Agent.OS');
+ switch (os) {
+ case 'Windows_NT':
+ return 'Windows';
+ case 'Darwin':
+ return 'macOS';
+ case 'Linux':
+ return 'Linux';
+ default:
+ return os || 'unknown';
+ }
+ })()
);
try {
diff --git a/tasks/ReplaceTokensV6/telemetry.ts b/tasks/ReplaceTokensV6/telemetry.ts
index 92cd3d0..a17deb2 100644
--- a/tasks/ReplaceTokensV6/telemetry.ts
+++ b/tasks/ReplaceTokensV6/telemetry.ts
@@ -121,7 +121,7 @@ export function useApplicationInsightsExporter(proxy?: string) {
provider.addSpanProcessor(new SimpleSpanProcessor(new ApplicationInsightsExporter({ proxy: proxy })));
}
-export function startSpan(name: string, account: string, pipeline: string, host: string) {
+export function startSpan(name: string, account: string, pipeline: string, host: string, os: string) {
return tracer.startSpan(name, {
attributes: {
account: crypto
@@ -132,7 +132,8 @@ export function startSpan(name: string, account: string, pipeline: string, host:
.createHash('sha256')
.update(pipeline || '')
.digest('hex'),
- host: host
+ host: host,
+ os: os
}
});
}
diff --git a/tasks/ReplaceTokensV6/tests/L0.ts b/tasks/ReplaceTokensV6/tests/L0.ts
index f4bb01e..8a27b9f 100644
--- a/tasks/ReplaceTokensV6/tests/L0.ts
+++ b/tasks/ReplaceTokensV6/tests/L0.ts
@@ -224,6 +224,7 @@ describe('ReplaceTokens v6 L0 suite', function () {
process.env['SYSTEM_COLLECTIONID'] = 'col01';
process.env['SYSTEM_TEAMPROJECTID'] = 'project01';
process.env['SYSTEM_DEFINITIONID'] = 'def01';
+ process.env['AGENT_OS'] = 'Windows_NT';
try {
// act
@@ -235,7 +236,7 @@ describe('ReplaceTokens v6 L0 suite', function () {
tr.stdout.should.include('telemetry sent');
tr.stdout.should.match(
- /\[\{"name":"\*+","time":"[^"]+","iKey":"\*+","tags":\{"ai\.application\.ver":"6\.\d+\.\d+","ai\.cloud\.role":"cloud","ai\.internal\.sdkVersion":"replacetokens:2\.0\.0","ai\.operation\.id":"[^"]+","ai\.operation\.name":"replacetokens-task","ai\.user\.accountId":"494d0aad9d06c4ddb51d5300620122ce55366a9382b3cc2835ed5f0e2e67b4d0","ai\.user\.authUserId":"b98ed03d3eec376dcc015365c1a944e3ebbcc33d30e3261af3f4e4abb107aa82"},"data":\{"baseType":"EventData","baseData":\{"ver":"2","name":"tokens\.replaced","properties":\{"sources":3,"add-bom":false,"encoding":"auto","escape":"auto","if-no-files-found":"ignore","log-level":"info","missing-var-action":"none","missing-var-default":"","missing-var-log":"warn","recusrive":false,"separator":"\.","token-pattern":"default","transforms":false,"transforms-prefix":"\(","transforms-suffix":"\)","variable-files":0,"variable-envs":0,"inline-variables":0,"output-defaults":1,"output-files":2,"output-replaced":3,"output-tokens":4,"output-transforms":5,"result":"success","duration":\d+(?:\.\d+)?}}}}]/
+ /\[\{"name":"\*+","time":"[^"]+","iKey":"\*+","tags":\{"ai\.application\.ver":"6\.\d+\.\d+","ai\.cloud\.role":"cloud","ai\.internal\.sdkVersion":"replacetokens:2\.0\.0","ai\.operation\.id":"[^"]+","ai\.operation\.name":"replacetokens-task","ai\.user\.accountId":"494d0aad9d06c4ddb51d5300620122ce55366a9382b3cc2835ed5f0e2e67b4d0","ai\.user\.authUserId":"b98ed03d3eec376dcc015365c1a944e3ebbcc33d30e3261af3f4e4abb107aa82"},"data":\{"baseType":"EventData","baseData":\{"ver":"2","name":"tokens\.replaced","properties":\{"os":"Windows","sources":3,"add-bom":false,"encoding":"auto","escape":"auto","if-no-files-found":"ignore","log-level":"info","missing-var-action":"none","missing-var-default":"","missing-var-log":"warn","recusrive":false,"separator":"\.","token-pattern":"default","transforms":false,"transforms-prefix":"\(","transforms-suffix":"\)","variable-files":0,"variable-envs":0,"inline-variables":0,"output-defaults":1,"output-files":2,"output-replaced":3,"output-tokens":4,"output-transforms":5,"result":"success","duration":\d+(?:\.\d+)?}}}}]/
);
}, tr);
} finally {
@@ -243,6 +244,7 @@ describe('ReplaceTokens v6 L0 suite', function () {
delete process.env['SYSTEM_COLLECTIONID'];
delete process.env['SYSTEM_TEAMPROJECTID'];
delete process.env['SYSTEM_DEFINITIONID'];
+ delete process.env['AGENT_OS'];
cleanVariables(Object.keys(vars));
cleanSecrets(Object.keys(secrets));
@@ -263,6 +265,7 @@ describe('ReplaceTokens v6 L0 suite', function () {
process.env['SYSTEM_COLLECTIONID'] = 'col01';
process.env['SYSTEM_TEAMPROJECTID'] = 'project01';
process.env['SYSTEM_DEFINITIONID'] = 'def01';
+ process.env['AGENT_OS'] = 'Windows_NT';
try {
// act
@@ -274,7 +277,7 @@ describe('ReplaceTokens v6 L0 suite', function () {
tr.stdout.should.include('telemetry sent');
tr.stdout.should.match(
- /\[\{"name":"\*+","time":"[^"]+","iKey":"\*+","tags":\{"ai\.application\.ver":"6\.\d+\.\d+","ai\.cloud\.role":"cloud","ai\.internal\.sdkVersion":"replacetokens:2\.0\.0","ai\.operation\.id":"[^"]+","ai\.operation\.name":"replacetokens-task","ai\.user\.accountId":"494d0aad9d06c4ddb51d5300620122ce55366a9382b3cc2835ed5f0e2e67b4d0","ai\.user\.authUserId":"b98ed03d3eec376dcc015365c1a944e3ebbcc33d30e3261af3f4e4abb107aa82"},"data":\{"baseType":"EventData","baseData":\{"ver":"2","name":"tokens\.replaced","properties":\{"result":"failed","duration":\d+(?:\.\d+)?}}}}]/
+ /\[\{"name":"\*+","time":"[^"]+","iKey":"\*+","tags":\{"ai\.application\.ver":"6\.\d+\.\d+","ai\.cloud\.role":"cloud","ai\.internal\.sdkVersion":"replacetokens:2\.0\.0","ai\.operation\.id":"[^"]+","ai\.operation\.name":"replacetokens-task","ai\.user\.accountId":"494d0aad9d06c4ddb51d5300620122ce55366a9382b3cc2835ed5f0e2e67b4d0","ai\.user\.authUserId":"b98ed03d3eec376dcc015365c1a944e3ebbcc33d30e3261af3f4e4abb107aa82"},"data":\{"baseType":"EventData","baseData":\{"ver":"2","name":"tokens\.replaced","properties":\{"os":"Windows","result":"failed","duration":\d+(?:\.\d+)?}}}}]/
);
}, tr);
} finally {
@@ -282,6 +285,7 @@ describe('ReplaceTokens v6 L0 suite', function () {
delete process.env['SYSTEM_COLLECTIONID'];
delete process.env['SYSTEM_TEAMPROJECTID'];
delete process.env['SYSTEM_DEFINITIONID'];
+ delete process.env['AGENT_OS'];
cleanVariables(Object.keys(vars));
cleanSecrets(Object.keys(secrets));