Skip to content

Commit

Permalink
[FABN-1481] Remove node 8 support and add node 12 (#123)
Browse files Browse the repository at this point in the history
- Run node 10 and 12 sequentially
- Fix some strings in the tests
- Update package package.jsons
- Fixed typos

Signed-off-by: heatherlp <[email protected]>
  • Loading branch information
heatherlp authored Feb 12, 2020
1 parent 25de487 commit 135a248
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 48 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ This project publishes the following npm packages:

## Build and Test
To build and test, the following pre-requisites must be installed first:
* node runtime LTS version 10
* Node.js, version 10 is supported from 10.15.3 and higher
* Node.js, version 12 is supported from 12.13.1 and higher
* npm tool version 6 or higher
* docker (only required for running integration tests, see below)

Expand Down
107 changes: 70 additions & 37 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

# Pipeline-level keywords belong here
trigger:
- master

Expand All @@ -15,43 +16,75 @@ variables:
- name: SOFTHSM2_CONF
value: "$(Build.Repository.LocalPath)/test/fixtures/hsm/softhsm2.conf"

steps:
- task: NodeTool@0
inputs:
versionSpec: '12.x'
displayName: 'Install Node.js'
# A Pipeline contains one or more stages
# A stage is a related collection of jobs. By default stages run sequentially
# A job is a collection of steps run by an agent or server

- script: |
sudo apt-get install softhsm2
softhsm2-util --init-token --slot 0 --label "My token 1" --pin 98765432 --so-pin 98765432
displayName: 'Install SoftHSM'
stages:
- stage: SetupRunTests
displayName: Setup and Run Tests
jobs:
- job: SetupRunTests
displayName: Install Node.js and run tests on
strategy:
matrix:
Node10:
versionSpec: '10.x'
Node12:
versionSpec: '12.x'
steps:
- task: NodeTool@0
inputs:
versionSpec: "$(versionSpec)"
displayName: Install Node.js
- script: |
sudo apt-get install softhsm2
softhsm2-util --init-token --slot 0 --label "My token 1" --pin 98765432 --so-pin 98765432
displayName: Install SoftHSM
- script: npm install
displayName: npm install
- script: npm run retrieveImages
displayName: 'Pull Docker images'
- script: npm run installAndGenerateCerts
displayName: 'Generate credentials'
- script: npm test
displayName: 'Run tests'

- script: npm install
displayName: 'npm install'
- stage: Publish
displayName: Publish Packages and Docs
jobs:
- job: PublishPackages
displayName: Publish npm packages
condition: and(succeeded(), eq(variables['Build.Reason'], 'IndividualCI'))
steps:
- task: NodeTool@0
inputs:
versionSpec: '12.x'
displayName: Install Node.js
- script: npm install
displayName: npm install
- script: scripts/ci_scripts/azurePublishNpmPackages.sh
displayName: Publish packages
env:
NPM_TOKEN: "$(NPM)"
PROJECT_DIR: "$(Build.Repository.LocalPath)"

- script: npm run retrieveImages
displayName: 'Pull Docker images'

- script: npm run installAndGenerateCerts
displayName: 'Generate credentials'

- script: npm test
displayName: 'Run tests'

- script: scripts/ci_scripts/azurePublishNpmPackages.sh
condition: and(succeeded(), eq(variables['Build.Reason'], 'IndividualCI'))
displayName: 'Publish npm packages'
env:
NPM_TOKEN: $(NPM)
PROJECT_DIR: "$(Build.Repository.LocalPath)"

- script: scripts/ci_scripts/azurePublishApiDocs.sh
condition: and(succeeded(), eq(variables['Build.Reason'], 'IndividualCI'))
displayName: 'Publish API documentation'
env:
GITHUB_USER: 'Hyperledger Bot'
GITHUB_EMAIL: '[email protected]'
PUBLISH_URL: "https://$(GITHUB-PAT)@github.com/hyperledger/fabric-sdk-node.git"
PROJECT_DIR: "$(Build.Repository.LocalPath)"
STAGING_DIR: "$(Build.StagingDirectory)/gh-pages"
SOURCE_BRANCH: "$(Build.SourceBranchName)"
- job: PublishDocs
displayName: Publish API documentation
condition: and(succeeded(), eq(variables['Build.Reason'], 'IndividualCI'))
steps:
- task: NodeTool@0
inputs:
versionSpec: '12.x'
displayName: Install Node.js
- script: npm install
displayName: npm install
- script: scripts/ci_scripts/azurePublishApiDocs.sh
displayName: Publish API docs
env:
GITHUB_USER: 'Hyperledger Bot'
GITHUB_EMAIL: '[email protected]'
PUBLISH_URL: "https://$(GITHUB-PAT)@github.com/hyperledger/fabric-sdk-node.git"
PROJECT_DIR: "$(Build.Repository.LocalPath)"
STAGING_DIR: "$(Build.StagingDirectory)/gh-pages"
SOURCE_BRANCH: "$(Build.SourceBranchName)"
4 changes: 2 additions & 2 deletions fabric-ca-client/lib/FabricCAServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ const FabricCAServices = class extends BaseClient {
csr = privateKey.generateCSR('CN=' + req.enrollmentID);
logger.debug('successfully generated csr');
} catch (err) {
throw new Error(util.format('Failed to generate CSR for enrollmemnt due to error [%s]', err));
throw new Error(util.format('Failed to generate CSR for enrollment due to error [%s]', err));
}
}

Expand Down Expand Up @@ -313,7 +313,7 @@ const FabricCAServices = class extends BaseClient {
);

} catch (err) {
return reject(new Error(util.format('Failed to generate CSR for enrollmemnt due to error [%s]', err)));
return reject(new Error(util.format('Failed to generate CSR for enrollment due to error [%s]', err)));
}
},
(err) => {
Expand Down
4 changes: 2 additions & 2 deletions fabric-ca-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"url": "https://github.com/hyperledger/fabric-sdk-node"
},
"engines": {
"node": "^8.9.0 || ^10.15.3 || ^12.13.1",
"npm": "^5.5.1 || ^6.4.1"
"node": "^10.15.3 || ^12.13.1",
"npm": "^6.4.1"
},
"types": "./types/index.d.ts",
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions fabric-ca-client/test/FabricCAServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ describe('FabricCAServices', () => {
attr_reqs: atts
};

await service.enroll(req).should.be.rejectedWith(/Failed to generate CSR for enrollmemnt due to error.* CSR error/);
await service.enroll(req).should.be.rejectedWith(/Failed to generate CSR for enrollment due to error.* CSR error/);
});

it('should reject in generate key failure', async () => {
Expand Down Expand Up @@ -498,7 +498,7 @@ describe('FabricCAServices', () => {
cryptoPrimitives.generateKey.resolves(keyStub);

const atts = [{name: 'penguin'}, {name: 'power'}];
await service.reenroll(user, atts).should.be.rejectedWith(/Failed to generate CSR for enrollmemnt due to error.* CSR Error/);
await service.reenroll(user, atts).should.be.rejectedWith(/Failed to generate CSR for enrollment due to error.* CSR Error/);
});

it('should rejected if reenroll fails', async () => {
Expand Down
4 changes: 2 additions & 2 deletions fabric-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"test": "nyc mocha --exclude 'test/data/**/*.js' --recursive -t 10000"
},
"engines": {
"node": "^8.9.0 || ^10.15.3 || ^12.13.1",
"npm": "^5.5.1 || ^6.4.1"
"node": "^10.15.3 || ^12.13.1",
"npm": "^6.4.1"
},
"types": "./types/index.d.ts",
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions fabric-network/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"test": "nyc mocha --recursive -t 10000"
},
"engines": {
"node": "^8.9.0 || ^10.15.3 || ^12.13.1",
"npm": "^5.5.1 || ^6.4.1"
"node": "^10.15.3 || ^12.13.1",
"npm": "^6.4.1"
},
"types": "./types/index.d.ts",
"dependencies": {
Expand Down

0 comments on commit 135a248

Please sign in to comment.