Skip to content

Commit

Permalink
[UseDotNetV2] - Fix NuGet incompatibility (#18898)
Browse files Browse the repository at this point in the history
- Replaced exec with execSync since in node10 the task-lib wasn't catch/failed tasks on async operations (like exec)
  and from node16 it started to throws errors which can be caught by the task-lib. With execSync the UseDotNet task could
  catch and handle the errors in NuGetInstaller.installNuGet method.
  • Loading branch information
DmitriiBobreshev authored Aug 30, 2023
1 parent b55a1a3 commit 114a653
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 24 deletions.
13 changes: 12 additions & 1 deletion Tasks/UseDotNetV2/nugetinstaller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,31 @@ import * as nuGetGetter from 'azure-pipelines-tasks-packaging-common/nuget/NuGet
nuget.arg('config');
nuget.arg('-set');
nuget.arg('http_proxy=' + proxyConfig.proxyUrl);
#if NODE16
nuget.execSync({} as trm.IExecOptions);
#else
nuget.exec({} as trm.IExecOptions);

#endif
// Set proxy username
nuget = tl.tool(nugetPath);
nuget.arg('config');
nuget.arg('-set');
nuget.arg('http_proxy.user=' + proxyConfig.proxyUsername);
#if NODE16
nuget.execSync({} as trm.IExecOptions);
#else
nuget.exec({} as trm.IExecOptions);
#endif

// Set proxy password
nuget = tl.tool(nugetPath);
nuget.arg('config');
nuget.arg('-set');
nuget.arg('http_proxy.password=' + proxyConfig.proxyPassword);
#if NODE16
nuget.execSync({} as trm.IExecOptions);
#else
nuget.exec({} as trm.IExecOptions);
#endif
}
}
2 changes: 1 addition & 1 deletion Tasks/UseDotNetV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 226,
"Minor": 228,
"Patch": 1
},
"satisfies": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/UseDotNetV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 226,
"Minor": 228,
"Patch": 1
},
"satisfies": [
Expand Down
4 changes: 2 additions & 2 deletions _generated/UseDotNetV2.versionmap.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Default|2.226.1
Node16-225|2.226.0
Default|2.228.1
Node16-225|2.228.0
3 changes: 1 addition & 2 deletions _generated/UseDotNetV2/nugetinstaller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import * as nuGetGetter from 'azure-pipelines-tasks-packaging-common/nuget/NuGet
nuget.arg('-set');
nuget.arg('http_proxy=' + proxyConfig.proxyUrl);
nuget.exec({} as trm.IExecOptions);

// Set proxy username
nuget = tl.tool(nugetPath);
nuget.arg('config');
Expand All @@ -43,4 +42,4 @@ import * as nuGetGetter from 'azure-pipelines-tasks-packaging-common/nuget/NuGet
nuget.arg('http_proxy.password=' + proxyConfig.proxyPassword);
nuget.exec({} as trm.IExecOptions);
}
}
}
6 changes: 3 additions & 3 deletions _generated/UseDotNetV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 226,
"Minor": 228,
"Patch": 1
},
"satisfies": [
Expand Down Expand Up @@ -191,7 +191,7 @@
"DepricatedVersionNetCore": "NET Core version you specfied %s is out of support and will be removed from hosted agents soon. Please refer to https://aka.ms/dotnet-core-support for more information about the .NET support policy."
},
"_buildConfigMapping": {
"Default": "2.226.1",
"Node16-225": "2.226.0"
"Default": "2.228.1",
"Node16-225": "2.228.0"
}
}
6 changes: 3 additions & 3 deletions _generated/UseDotNetV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 226,
"Minor": 228,
"Patch": 1
},
"satisfies": [
Expand Down Expand Up @@ -191,7 +191,7 @@
"DepricatedVersionNetCore": "ms-resource:loc.messages.DepricatedVersionNetCore"
},
"_buildConfigMapping": {
"Default": "2.226.1",
"Node16-225": "2.226.0"
"Default": "2.228.1",
"Node16-225": "2.228.0"
}
}
9 changes: 4 additions & 5 deletions _generated/UseDotNetV2_Node16/nugetinstaller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,19 @@ import * as nuGetGetter from 'azure-pipelines-tasks-packaging-common/nuget/NuGet
nuget.arg('config');
nuget.arg('-set');
nuget.arg('http_proxy=' + proxyConfig.proxyUrl);
nuget.exec({} as trm.IExecOptions);

nuget.execSync({} as trm.IExecOptions);
// Set proxy username
nuget = tl.tool(nugetPath);
nuget.arg('config');
nuget.arg('-set');
nuget.arg('http_proxy.user=' + proxyConfig.proxyUsername);
nuget.exec({} as trm.IExecOptions);
nuget.execSync({} as trm.IExecOptions);

// Set proxy password
nuget = tl.tool(nugetPath);
nuget.arg('config');
nuget.arg('-set');
nuget.arg('http_proxy.password=' + proxyConfig.proxyPassword);
nuget.exec({} as trm.IExecOptions);
nuget.execSync({} as trm.IExecOptions);
}
}
}
6 changes: 3 additions & 3 deletions _generated/UseDotNetV2_Node16/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 226,
"Minor": 228,
"Patch": 0
},
"satisfies": [
Expand Down Expand Up @@ -195,7 +195,7 @@
"DepricatedVersionNetCore": "NET Core version you specfied %s is out of support and will be removed from hosted agents soon. Please refer to https://aka.ms/dotnet-core-support for more information about the .NET support policy."
},
"_buildConfigMapping": {
"Default": "2.226.1",
"Node16-225": "2.226.0"
"Default": "2.228.1",
"Node16-225": "2.228.0"
}
}
6 changes: 3 additions & 3 deletions _generated/UseDotNetV2_Node16/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 226,
"Minor": 228,
"Patch": 0
},
"satisfies": [
Expand Down Expand Up @@ -195,7 +195,7 @@
"DepricatedVersionNetCore": "ms-resource:loc.messages.DepricatedVersionNetCore"
},
"_buildConfigMapping": {
"Default": "2.226.1",
"Node16-225": "2.226.0"
"Default": "2.228.1",
"Node16-225": "2.228.0"
}
}

0 comments on commit 114a653

Please sign in to comment.