Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge task lib 4.x to master #903

Merged
merged 19 commits into from
Dec 2, 2022
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ Your pull request should:
* 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
* Tests should include reasonable permutations of the target fix/change
* Include baseline changes with your change
* All changed code must have 100% code coverage
* All changed code must have 100% code coverage

28 changes: 15 additions & 13 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ trigger:
- releases/*

variables:
- group: npm-tokens
- name: nodeVersion
value: '10.23.0'
- group: npm-tokens
- name: nodeVersion
value: '16.13.0'

jobs:
#################################################
- job: windows
Expand All @@ -17,11 +17,12 @@ jobs:
vmImage: windows-2019

steps:
- template: azure-pipelines-steps-node.yml
parameters:
nodeVersion: $(nodeVersion)
- template: azure-pipelines-steps-test-build.yml

- template: azure-pipelines-steps-node.yml
parameters:
nodeVersion: $(nodeVersion)

- template: azure-pipelines-steps-test-build.yml

#################################################
- job: linux
#################################################
Expand Down Expand Up @@ -59,7 +60,8 @@ jobs:
vmImage: macOS-10.15

steps:
- template: azure-pipelines-steps-node.yml
parameters:
nodeVersion: $(nodeVersion)
- template: azure-pipelines-steps-test-build.yml
- template: azure-pipelines-steps-node.yml
parameters:
nodeVersion: $(nodeVersion)

- template: azure-pipelines-steps-test-build.yml
33 changes: 33 additions & 0 deletions node/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Node.js task lib changes

## 3.x

### 3.3.1

- Update minimatch to version 3.0.5 to fix vulnerability - [#836](https://github.com/microsoft/azure-pipelines-task-lib/pull/836)

### 3.4.0

- Updated mockery and mocha dependencies - [#875](https://github.com/microsoft/azure-pipelines-task-lib/pull/875)

- Include uncought exceptions stack trace to the output logs - [#895](https://github.com/microsoft/azure-pipelines-task-lib/pull/895)

## 4.x

### 4.0.0-preview

- Introduced support for node 16 task handler - [#844](https://github.com/microsoft/azure-pipelines-task-lib/pull/844)

### 4.0.1-preview

- Added node16 to task.schema.json - [#852](https://github.com/microsoft/azure-pipelines-task-lib/pull/852)

### 4.0.2

- Updated mockery because of vulnerabilities - [#878](https://github.com/microsoft/azure-pipelines-task-lib/pull/878)

## 4.1.0

Backported from ver.`3.4.0`:

- Include uncought exceptions stack trace to the output logs - [#895](https://github.com/microsoft/azure-pipelines-task-lib/pull/895)
2 changes: 1 addition & 1 deletion node/buildutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ exports.getExternals = function () {
// and add node to the PATH
var nodeUrl = process.env['TASK_NODE_URL'] || 'https://nodejs.org/dist';
nodeUrl = nodeUrl.replace(/\/$/, ''); // ensure there is no trailing slash on the base URL
var nodeVersion = 'v10.23.0';
var nodeVersion = 'v16.13.0';
switch (platform) {
case 'darwin':
var nodeArchivePath = downloadArchive(nodeUrl + '/' + nodeVersion + '/node-' + nodeVersion + '-darwin-x64.tar.gz');
Expand Down
25 changes: 11 additions & 14 deletions node/mock-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,20 +143,17 @@ export class MockTestRunner {

let downloadVersion: string;
switch (version) {
case 5:
downloadVersion = 'v5.10.1';
break;
case 6:
downloadVersion = 'v6.17.1';
break;
case 10:
downloadVersion = 'v10.21.0';
break;
case 14:
downloadVersion = 'v14.11.0';
case 16:
downloadVersion = 'v16.13.0';
break;
default:
throw new Error('Invalid node version, must be 5, 6, 10, or 14 (received ' + version + ')');
throw new Error('Invalid node version, must be 6, 10, or 16 (received ' + version + ')');
}

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

// Determines the correct version of node to use based on the contents of the task's task.json. Defaults to Node 14.
// Determines the correct version of node to use based on the contents of the task's task.json. Defaults to Node 16.
private getNodeVersion(): number {
const taskJsonPath: string = this.getTaskJsonPath();
if (!taskJsonPath) {
console.warn('Unable to find task.json, defaulting to use Node 14');
return 10;
console.warn('Unable to find task.json, defaulting to use Node 16');
return 16;
}
const taskJsonContents = fs.readFileSync(taskJsonPath, { encoding: 'utf-8' });
const taskJson: object = JSON.parse(taskJsonContents);
Expand All @@ -188,9 +185,9 @@ export class MockTestRunner {
);
const keys = Object.keys(execution);
for (let i = 0; i < keys.length; i++) {
if (keys[i].toLowerCase() == 'node14') {
// Prefer node 14 and return immediately.
return 14;
if (keys[i].toLowerCase() == 'node16') {
// Prefer node 16 and return immediately.
return 16;
} else if (keys[i].toLowerCase() == 'node10') {
// Prefer node 10 and return immediately.
return 10;
Expand All @@ -200,8 +197,8 @@ export class MockTestRunner {
}

if (!nodeVersionFound) {
console.warn('Unable to determine execution type from task.json, defaulting to use Node 10');
return 10;
console.warn('Unable to determine execution type from task.json, defaulting to use Node 16');
return 16;
}

return 6;
Expand Down
45 changes: 10 additions & 35 deletions node/package-lock.json

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

8 changes: 4 additions & 4 deletions node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "azure-pipelines-task-lib",
"version": "3.4.0",
"version": "4.1.0",
"description": "Azure Pipelines Task SDK",
"main": "./task.js",
"typings": "./task.d.ts",
Expand Down Expand Up @@ -37,13 +37,13 @@
},
"devDependencies": {
"@types/minimatch": "3.0.3",
"@types/mocha": "^5.2.7",
"@types/mocha": "^9.1.1",
"@types/mockery": "^1.4.29",
"@types/node": "^10.17.0",
"@types/node": "^16.11.39",
"@types/q": "^1.5.4",
"@types/semver": "^7.3.4",
"@types/shelljs": "^0.8.8",
"mocha": "9.2.2",
"mocha": "^9.2.2",
"typescript": "^4.0.0"
}
}
Loading