Skip to content

Commit bd39329

Browse files
committed
migrate to node20
1 parent 4099e05 commit bd39329

11 files changed

+836
-375
lines changed

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ trigger:
66
variables:
77
- group: npm-tokens
88
- name: nodeVersion
9-
value: '16.13.0'
9+
value: '20.3.1'
1010

1111
jobs:
1212
#################################################

node/buildutils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ exports.getExternals = function () {
3535
// and add node to the PATH
3636
var nodeUrl = process.env['TASK_NODE_URL'] || 'https://nodejs.org/dist';
3737
nodeUrl = nodeUrl.replace(/\/$/, ''); // ensure there is no trailing slash on the base URL
38-
var nodeVersion = 'v16.13.0';
38+
var nodeVersion = 'v20.3.1';
3939
switch (platform) {
4040
case 'darwin':
4141
var nodeArchivePath = downloadArchive(nodeUrl + '/' + nodeVersion + '/node-' + nodeVersion + '-darwin-x64.tar.gz');

node/docs/minagent.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Use the details below to determine when specific agent features were added:
3030
- Added in 2.144.0. Used node v10.x
3131
* `node16` handler
3232
- Added in 2.206.1. Used node v16.x
33+
* `node20` handler
34+
- Added in 2.225.0. Used node v20.x
3335
* `powershell3` handler
3436
- Added in 1.95.1
3537
- Updated in 1.97 to propagate `Data` property for endpoints

node/docs/nodeEnvironment.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ With agent version 2.206.1 Node 16 can be used.
2222
},
2323
```
2424

25+
With agent version 2.225.0 Node 20 can be used.
26+
27+
```
28+
"execution": {
29+
"Node20": {
30+
"target": "path/to/entry"
31+
}
32+
},
33+
```
2534
Existing `Node` execution targets will still resolve to a Node 6 environment for now to maintain back-compat.
2635

2736
### Testing your task

node/docs/nodeVersioning.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
## Agent Node Handler
44

5-
The agent currently has 3 different node handlers that it can use to execute node tasks: Node 6, Node 10, Node 16.
5+
The agent currently has 4 different node handlers that it can use to execute node tasks: Node 6, Node 10, Node 16, and Node20.
66
The handler used depends on the `execution` property specified in the tasks `task.json`.
7-
If the `execution` property is specified to be `Node`, the task will run on the Node 6 handler, for `Node10` it will run on the Node 10 handler, for `Node16` it will run on the Node 16 handler.
7+
If the `execution` property is specified to be `Node`, the task will run on the Node 6 handler, for `Node10` it will run on the Node 10 handler, for `Node16` it will run on the Node 16 handler, for `Node20` it will run on the Node 20 handler.
88

99
## Mock-test Node Handler
1010

node/mock-test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,11 @@ export class MockTestRunner {
152152
case 16:
153153
downloadVersion = 'v16.13.0';
154154
break;
155+
case 20:
156+
downloadVersion = 'v20.3.1';
157+
break;
155158
default:
156-
throw new Error('Invalid node version, must be 6, 10, or 16 (received ' + version + ')');
159+
throw new Error('Invalid node version, must be 6, 10, 16, or 20 (received ' + version + ')');
157160
}
158161

159162
// Install node in home directory if it isn't already there.
@@ -185,7 +188,10 @@ export class MockTestRunner {
185188
);
186189
const keys = Object.keys(execution);
187190
for (let i = 0; i < keys.length; i++) {
188-
if (keys[i].toLowerCase() == 'node16') {
191+
if (keys[i].toLowerCase() == 'node20') {
192+
// Prefer node 20 and return immediately.
193+
return 20;
194+
} else if (keys[i].toLowerCase() == 'node16') {
189195
// Prefer node 16 and return immediately.
190196
return 16;
191197
} else if (keys[i].toLowerCase() == 'node10') {

0 commit comments

Comments
 (0)