Skip to content

Commit

Permalink
PublishSymbolsV2 honors the symbolExpirationInDays input value when r…
Browse files Browse the repository at this point in the history
…unning on non-Windows OSes
  • Loading branch information
Scott Su committed Sep 9, 2022
1 parent d54de00 commit 2753e47
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Tasks/PublishSymbolsV2/PublishSymbols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export async function run(clientToolFilePath: string): Promise<void> {
tl.getVariable("Build.BuildId") + "/" +
uniqueId).toLowerCase();

let expirationInDays: string = tl.getInput("SymbolExpirationInDays", false) ? tl.getInput("SymbolExpirationInDays", false) : '36530';
let detailedLog: boolean = tl.getBoolInput("DetailedLog");

// Determine specific files to publish, if provided
Expand All @@ -62,7 +63,6 @@ export async function run(clientToolFilePath: string): Promise<void> {
tl.setResult(tl.TaskResult.Succeeded, tl.loc("NoFilesForPublishing"));
}
else {
let expirationInDays: string = '36530';
let execResult: IExecSyncResult;
if (fs.existsSync(clientToolFilePath)) {
tl.debug("Publishing the symbols");
Expand Down
2 changes: 1 addition & 1 deletion Tasks/PublishSymbolsV2/Tests/L0NetCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('Publishing Symbol Suite', function () {
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.ran(`mock/location/symbol.exe publish --service https://example.artifacts.visualstudio.com --name testpublishsymbol/testpublishsymbolbuild/2021.11.30/1/8fd4c05c-e13b-4dc1-8f0f-7e1c661db3b5 --directory c:\\temp --expirationInDays 36530 --patAuthEnvVar SYMBOL_PAT_AUTH_TOKEN --fileListFileName ${path.join("c:\\agent\\_temp", "ListOfSymbols-8fd4c05c-e13b-4dc1-8f0f-7e1c661db3b5.txt")} --tracelevel verbose --globalretrycount 2`), 'it should have run client tool symbol.exe');
assert(tr.ran(`mock/location/symbol.exe publish --service https://example.artifacts.visualstudio.com --name testpublishsymbol/testpublishsymbolbuild/2021.11.30/1/8fd4c05c-e13b-4dc1-8f0f-7e1c661db3b5 --directory c:\\temp --expirationInDays 365 --patAuthEnvVar SYMBOL_PAT_AUTH_TOKEN --fileListFileName ${path.join("c:\\agent\\_temp", "ListOfSymbols-8fd4c05c-e13b-4dc1-8f0f-7e1c661db3b5.txt")} --tracelevel verbose --globalretrycount 2`), 'it should have run client tool symbol.exe');
assert(tr.stdOutContained('Symbol.exe output'), "should have symbol output");
assert(tr.succeeded, 'should have succeeded');
assert.strictEqual(tr.errorIssues.length, 0, "should have no errors");
Expand Down
5 changes: 3 additions & 2 deletions Tasks/PublishSymbolsV2/Tests/PublishSymbolsInternal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import { ClientToolMockHelper } from './PublishSymbolsMockHelper';

let taskPath = path.join(__dirname, '..', 'clienttoolmain.js');
let tmr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath);
let umh: ClientToolMockHelper = new ClientToolMockHelper(tmr);

tmr.setInput('PublishSymbols', 'true');
tmr.setInput('DetailedLog', 'true');
tmr.setInput('SymbolsFolder', 'c:\\temp');
tmr.setInput('SearchPattern', 'pattern/to/files/*')
tmr.setInput('SymbolExpirationInDays', '365')
tmr.setVariableName('SYMBOLTOOL_FILE_PATH', 'mock/location/symbol.exe');
let umh: ClientToolMockHelper = new ClientToolMockHelper(tmr);

umh.mockClientToolCommand("publish", "testpublishsymbol/testpublishsymbolbuild/2021.11.30/1/8fd4c05c-e13b-4dc1-8f0f-7e1c661db3b5", "c:\\temp", '36530', path.join("c:\\agent\\_temp", "ListOfSymbols-8fd4c05c-e13b-4dc1-8f0f-7e1c661db3b5.txt"), {
umh.mockClientToolCommand("publish", "testpublishsymbol/testpublishsymbolbuild/2021.11.30/1/8fd4c05c-e13b-4dc1-8f0f-7e1c661db3b5", "c:\\temp", '365', path.join("c:\\agent\\_temp", "ListOfSymbols-8fd4c05c-e13b-4dc1-8f0f-7e1c661db3b5.txt"), {
"code": 0,
"stdout": "Symbol.exe output",
"stderr": ""
Expand Down
10 changes: 5 additions & 5 deletions Tasks/PublishSymbolsV2/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Tasks/PublishSymbolsV2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"homepage": "https://github.com/Microsoft/azure-pipelines-tasks#readme",
"dependencies": {
"azure-pipelines-tasks-packaging-common-v3": "^3.201.0",
"azure-pipelines-tasks-packaging-common-v3": "^3.202.0",
"azure-pipelines-tasks-utility-common": "^3.198.1"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion Tasks/PublishSymbolsV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"preview": false,
"version": {
"Major": 2,
"Minor": 203,
"Minor": 204,
"Patch": 0
},
"minimumAgentVersion": "2.144.0",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/PublishSymbolsV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"preview": false,
"version": {
"Major": 2,
"Minor": 203,
"Minor": 204,
"Patch": 0
},
"minimumAgentVersion": "2.144.0",
Expand Down

0 comments on commit 2753e47

Please sign in to comment.