Skip to content

Commit 3bf465d

Browse files
localconstAndreyIvanov42Andrey IvanovrumyaxRoman-Shchukin
authored
Merge task lib 4.x to master (#903)
* Migrating to Node 16 (#844) * create new release/4.x branch * release for 4 version * update pipeline * update package.json * fix test and build commands * fixed tests on node18 * change image version for linux * fix test for linux * add separete test for linux * node v16.13 * add v16.13.0 to test * test on windows-2022, macOS-11 * separate branch for node16 * remove temporary code * update package.json * changed pipeline * updated pipeline * Microsoft mandatory file (#839) * Update pipeline to include a step for publishing artifacts. (#848) (#849) * Update pipeline * Update azure-pipelines.yml * nodeversion as variable * Added node16 to schema (#852) Co-authored-by: Andrey Ivanov <[email protected]> * bump version (#862) Co-authored-by: Andrey Ivanov <[email protected]> * Update ci-cd for publishing npm package (#863) * fix npm publish Co-authored-by: Andrey Ivanov <[email protected]> * fix add registry (#864) Co-authored-by: Andrey Ivanov <[email protected]> * fix ToolRunner - _getSpawnSyncOptions (#873) * Mockery version is updated from 1.7.0 to 2.1.0 because of vulnerability (#878) * Fixed release path (#888) * Improvement of the release condition (#889) * Added test task with test condition. Negative test * Added test task with test condition. Positive test * Fix path * Fix path * Fix path * Changed build.sourcebranchname -> build.sourcebranch and path to branch * Fix path * Version changed (#894) * Pipeline fixing (#893) * Token test * Test token * Publish test * call order changed * Nmp token syntax reverted * Changed windows job * Script clearing * Uncommented condition * Token changed * Test - off publish condition * Switched on publish condition * Package version was reverted * Add escape for more correct working * Add changelog * Update package-lock version * Bump tl version to 4.1.0 * Update changelog * Remove PS task lib changes from node changelog * Update changelog for 4.0.1-preview Co-authored-by: AndreyIvanov42 <[email protected]> Co-authored-by: Andrey Ivanov <[email protected]> Co-authored-by: Denis Rumyantsev <[email protected]> Co-authored-by: Roman-Shchukin <[email protected]>
1 parent 73e9515 commit 3bf465d

22 files changed

+243
-216
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ Your pull request should:
3838
* At least one test should fail in the absence of your non-test code changes. If your PR does not match this criteria, please specify why
3939
* Tests should include reasonable permutations of the target fix/change
4040
* Include baseline changes with your change
41-
* All changed code must have 100% code coverage
41+
* All changed code must have 100% code coverage
42+

azure-pipelines.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ trigger:
44
- releases/*
55

66
variables:
7-
- group: npm-tokens
8-
- name: nodeVersion
9-
value: '10.23.0'
10-
7+
- group: npm-tokens
8+
- name: nodeVersion
9+
value: '16.13.0'
10+
1111
jobs:
1212
#################################################
1313
- job: windows
@@ -17,11 +17,12 @@ jobs:
1717
vmImage: windows-2019
1818

1919
steps:
20-
- template: azure-pipelines-steps-node.yml
21-
parameters:
22-
nodeVersion: $(nodeVersion)
23-
- template: azure-pipelines-steps-test-build.yml
24-
20+
- template: azure-pipelines-steps-node.yml
21+
parameters:
22+
nodeVersion: $(nodeVersion)
23+
24+
- template: azure-pipelines-steps-test-build.yml
25+
2526
#################################################
2627
- job: linux
2728
#################################################
@@ -59,7 +60,8 @@ jobs:
5960
vmImage: macOS-10.15
6061

6162
steps:
62-
- template: azure-pipelines-steps-node.yml
63-
parameters:
64-
nodeVersion: $(nodeVersion)
65-
- template: azure-pipelines-steps-test-build.yml
63+
- template: azure-pipelines-steps-node.yml
64+
parameters:
65+
nodeVersion: $(nodeVersion)
66+
67+
- template: azure-pipelines-steps-test-build.yml

node/CHANGELOG.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Node.js task lib changes
2+
3+
## 3.x
4+
5+
### 3.3.1
6+
7+
- Update minimatch to version 3.0.5 to fix vulnerability - [#836](https://github.com/microsoft/azure-pipelines-task-lib/pull/836)
8+
9+
### 3.4.0
10+
11+
- Updated mockery and mocha dependencies - [#875](https://github.com/microsoft/azure-pipelines-task-lib/pull/875)
12+
13+
- Include uncought exceptions stack trace to the output logs - [#895](https://github.com/microsoft/azure-pipelines-task-lib/pull/895)
14+
15+
## 4.x
16+
17+
### 4.0.0-preview
18+
19+
- Introduced support for node 16 task handler - [#844](https://github.com/microsoft/azure-pipelines-task-lib/pull/844)
20+
21+
### 4.0.1-preview
22+
23+
- Added node16 to task.schema.json - [#852](https://github.com/microsoft/azure-pipelines-task-lib/pull/852)
24+
- fix ToolRunner - _getSpawnSyncOptions - [#873](https://github.com/microsoft/azure-pipelines-task-lib/pull/873)
25+
26+
### 4.0.2
27+
28+
- Updated mockery because of vulnerabilities - [#878](https://github.com/microsoft/azure-pipelines-task-lib/pull/878)
29+
30+
## 4.1.0
31+
32+
Backported from ver.`3.4.0`:
33+
34+
- Include uncought exceptions stack trace to the output logs - [#895](https://github.com/microsoft/azure-pipelines-task-lib/pull/895)

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 = 'v10.23.0';
38+
var nodeVersion = 'v16.13.0';
3939
switch (platform) {
4040
case 'darwin':
4141
var nodeArchivePath = downloadArchive(nodeUrl + '/' + nodeVersion + '/node-' + nodeVersion + '-darwin-x64.tar.gz');

node/mock-test.ts

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -143,20 +143,17 @@ export class MockTestRunner {
143143

144144
let downloadVersion: string;
145145
switch (version) {
146-
case 5:
147-
downloadVersion = 'v5.10.1';
148-
break;
149146
case 6:
150147
downloadVersion = 'v6.17.1';
151148
break;
152149
case 10:
153150
downloadVersion = 'v10.21.0';
154151
break;
155-
case 14:
156-
downloadVersion = 'v14.11.0';
152+
case 16:
153+
downloadVersion = 'v16.13.0';
157154
break;
158155
default:
159-
throw new Error('Invalid node version, must be 5, 6, 10, or 14 (received ' + version + ')');
156+
throw new Error('Invalid node version, must be 6, 10, or 16 (received ' + version + ')');
160157
}
161158

162159
// Install node in home directory if it isn't already there.
@@ -170,12 +167,12 @@ export class MockTestRunner {
170167
}
171168
}
172169

173-
// Determines the correct version of node to use based on the contents of the task's task.json. Defaults to Node 14.
170+
// Determines the correct version of node to use based on the contents of the task's task.json. Defaults to Node 16.
174171
private getNodeVersion(): number {
175172
const taskJsonPath: string = this.getTaskJsonPath();
176173
if (!taskJsonPath) {
177-
console.warn('Unable to find task.json, defaulting to use Node 14');
178-
return 10;
174+
console.warn('Unable to find task.json, defaulting to use Node 16');
175+
return 16;
179176
}
180177
const taskJsonContents = fs.readFileSync(taskJsonPath, { encoding: 'utf-8' });
181178
const taskJson: object = JSON.parse(taskJsonContents);
@@ -188,9 +185,9 @@ export class MockTestRunner {
188185
);
189186
const keys = Object.keys(execution);
190187
for (let i = 0; i < keys.length; i++) {
191-
if (keys[i].toLowerCase() == 'node14') {
192-
// Prefer node 14 and return immediately.
193-
return 14;
188+
if (keys[i].toLowerCase() == 'node16') {
189+
// Prefer node 16 and return immediately.
190+
return 16;
194191
} else if (keys[i].toLowerCase() == 'node10') {
195192
// Prefer node 10 and return immediately.
196193
return 10;
@@ -200,8 +197,8 @@ export class MockTestRunner {
200197
}
201198

202199
if (!nodeVersionFound) {
203-
console.warn('Unable to determine execution type from task.json, defaulting to use Node 10');
204-
return 10;
200+
console.warn('Unable to determine execution type from task.json, defaulting to use Node 16');
201+
return 16;
205202
}
206203

207204
return 6;

node/package-lock.json

Lines changed: 10 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "azure-pipelines-task-lib",
3-
"version": "3.4.0",
3+
"version": "4.1.0",
44
"description": "Azure Pipelines Task SDK",
55
"main": "./task.js",
66
"typings": "./task.d.ts",
@@ -37,13 +37,13 @@
3737
},
3838
"devDependencies": {
3939
"@types/minimatch": "3.0.3",
40-
"@types/mocha": "^5.2.7",
40+
"@types/mocha": "^9.1.1",
4141
"@types/mockery": "^1.4.29",
42-
"@types/node": "^10.17.0",
42+
"@types/node": "^16.11.39",
4343
"@types/q": "^1.5.4",
4444
"@types/semver": "^7.3.4",
4545
"@types/shelljs": "^0.8.8",
46-
"mocha": "9.2.2",
46+
"mocha": "^9.2.2",
4747
"typescript": "^4.0.0"
4848
}
4949
}

0 commit comments

Comments
 (0)