Skip to content

Commit

Permalink
[FAB-16711] Update azure pipeline
Browse files Browse the repository at this point in the history
Merge npm publish changes from release-1.4 and delete unused Jenkins scripts

Signed-off-by: James Taylor <jamest@uk.ibm.com>
  • Loading branch information
jt-nti authored and mbwhite committed Dec 6, 2019
1 parent ff93c73 commit 8961457
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 393 deletions.
85 changes: 38 additions & 47 deletions ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# fabric-chaincode-node azure pipeline configuration.
#
name: RELEASE-$(Date:yyyyMMdd)$(Rev:.rrr)
name: $(SourceBranchName)-$(Date:yyyyMMdd)$(Rev:.rrr)

# Daily build for final quality
# cf https://crontab.guru/#0_23_*_*_*
Expand All @@ -17,14 +17,13 @@ schedules:
always: true


# Trigger on the master and the release-1.4 branches only
# Stndard Pull Request and Merge builds
# Trigger on the master branch
# Standard Pull Request and Merge builds
# Any git tag will also trigger a build that should do publishing
trigger:
branches:
include:
- 'master'
- 'release-1.4'
tags:
include:
- '*'
Expand All @@ -41,6 +40,8 @@ variables:
value: fabric-chaincode-node
- name: pipeline
value: ci
- name: node_version_spec
value: '12.x'

# Build on Ubuntu
pool:
Expand All @@ -51,24 +52,20 @@ pool:
# Keeping it simple and explict whilst we gain experience
stages:

# output some basic information for reference
# Not for use every time, but this can be useful template to keep
# - stage: info
# jobs:
# - job: env_info
# steps:
# - script: |
# env | sort

# Primary stage of building, linting and unit tests
- stage: Build_and_Test
jobs:
# output some basic information for reference
- job: displayenv
steps:
- script: |
env | sort
- job: main
displayName: 'Build, lint, UT'
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
versionSpec: $(node_version_spec)
- script: |
set -ev
node common/scripts/install-run-rush.js install
Expand Down Expand Up @@ -131,7 +128,7 @@ stages:
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
versionSpec: $(node_version_spec)
- task: DownloadPipelineArtifact@2
inputs:
artifact: nodeenv-docker-image
Expand Down Expand Up @@ -191,7 +188,7 @@ stages:
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
versionSpec: $(node_version_spec)
- task: DownloadPipelineArtifact@2
inputs:
artifact: node-tgz
Expand All @@ -204,8 +201,7 @@ stages:
npm audit
displayName: 'Run npm audit'
# Publish the snapshot images etc.
# Original source of these is https://github.com/hyperledger/ci-management/blob/master/jjb/fabric-chaincode-java/shell/include-raw-publish-docker-jar.sh
# Publish the snapshot images
- job: snapshot_publish
condition: and(succeeded(),eq(variables['Build.Reason'], 'IndividualCI'))
dependsOn: fvt
Expand All @@ -219,50 +215,45 @@ stages:
NEXUS_USERNAME: $(nexus-user)
NEXUS_PASSWORD: $(nexus-password)
NEXUS_URL: nexus3.hyperledger.org:10003/hyperledger
- script: |
node common/scripts/install-run-rush.js install
cd ${BUILD_SOURCEBRANCH}/docs/apidocs
CHAINCODE_NODE_COMMIT=$(git rev-parse --short HEAD)
echo "---------> CHAINCODE_NODE_COMMIT:" $CHAINCODE_NODE_COMMIT
TARGET_REPO=$CHAINCODE_NODE_USERNAME.github.io.git
git config --global user.email "fabric.shim@gmail.com"
git config --global user.name "fabric-shim"
git clone https://github.com/$CHAINCODE_NODE_USERNAME/$TARGET_REPO
# build docs
DOCS_ROOT=$CHAINCODE_NODE_USERNAME.github.io gulp -f docs.js docs
cd $CHAINCODE_NODE_USERNAME.github.io
git add .
git commit -m "CHAINCODE_NODE commit - $CHAINCODE_NODE_COMMIT"
git config remote.gh-pages.url https://$CHAINCODE_NODE_USERNAME:$CHAINCODE_NODE_PASSWORD@github.com/$CHAINCODE_NODE_USERNAME/$TARGET_REPO
# Push API docs to Target repository
git push gh-pages master
env:
CHAINCODE_NODE_USERNAME: fabric-shim
displayName: 'docker push to nexus'

# Publish a new version, triggered by a git tag
- stage: Publish_tag
dependsOn: Build_and_Test
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags'))
jobs:
- job: update_version
steps:
- script: |
set -ev
env | sort
echo "Update the version number"
VERSION=$(jq '.version' $(Build.SourcesDirectory)/package.json | sed -r "s/\"([0-9]?[0-9]\.[0-9]?[0-9]\.[0-9]?[0-9]).*/\1/")
echo Version is :${VERSION}:
echo "Make sure release notes are present"
echo "Make sure change history is present"
- job: npm_publish
displayName: 'npm publish'
steps:
- task: NodeTool@0
inputs:
versionSpec: $(node_version_spec)
- download: current
artifact: node-tgz
- script: |
set -ev
echo "Setup .npmrc"
echo "Use pipeline secret to login"
echo "publish"
touch $(Agent.TempDirectory)/.npmrc
echo '##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$(Agent.TempDirectory)/.npmrc'
displayName: 'create user .npmrc file'
- script: |
npm config set registry https://registry.npmjs.org/
npm config ls
displayName: 'set npmjs registry'
- task: npmAuthenticate@0
inputs:
workingFile: '$(Agent.TempDirectory)/.npmrc'
customEndpoint: 'fabric-chainode-node-npm'
- script: |
find $(Pipeline.Workspace)/node-tgz/ -maxdepth 1 -type f -name 'fabric-*.tgz' -exec npm publish {} --tag latest \;
displayName: 'npm publish'
- job: jsdoc_publish
steps:
- script: |
Expand Down
2 changes: 1 addition & 1 deletion rush.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
* Specify a SemVer range to ensure developers use a Node.js version that is appropriate
* for your repo.
*/
"nodeSupportedVersionRange": ">=10.13.0 <11.0.0",
"nodeSupportedVersionRange": ">=10.13.0 <12.14.0",
/**
* Odd-numbered major versions of Node.js are experimental. Even-numbered releases
* spend six months in a stabilization period before the first Long Term Support (LTS) version.
Expand Down
Loading

0 comments on commit 8961457

Please sign in to comment.