11# Copyright IBM Corp. All Rights Reserved.
22#
33# SPDX-License-Identifier: Apache-2.0
4- #
4+ #
55# fabric-chaincode-node azure pipeline configuration.
6- #
6+ #
77name : RELEASE-$(Date:yyyyMMdd)$(Rev:.rrr)
88
99# Daily build for final quality
@@ -33,20 +33,20 @@ trigger:
3333# These are custom defined variables, the pipeline one is currently used for the build scripts
3434# to know to produce tests results in XML format for Azure to consume, for developers
3535# this isn't set so command line output is given
36- #
36+ #
3737# Chaincode_Node_Vars is the protected group of keys for publishing
3838variables :
3939 - group : Chaincode_Node_Vars
4040 - name : component
4141 value : fabric-chaincode-node
4242 - name : pipeline
43- value : ci
43+ value : ci
4444
4545# Build on Ubuntu
4646pool :
4747 vmImage : ' ubuntu-latest'
4848
49- #
49+ #
5050# The stages and jobs, potential for rationalization and optimization
5151# Keeping it simple and explict whilst we gain experience
5252stages :
@@ -68,13 +68,13 @@ stages:
6868 steps :
6969 - task : NodeTool@0
7070 inputs :
71- versionSpec : ' 10.x'
71+ versionSpec : ' 10.x'
7272 - script : |
7373 set -ev
7474 node common/scripts/install-run-rush.js install
7575 displayName: 'Setup the rush environment'
7676 - script : |
77- set -ev
77+ set -ev
7878 node common/scripts/install-run-rush.js rebuild
7979 displayName: 'Full rebuild'
8080
@@ -89,7 +89,7 @@ stages:
8989 inputs :
9090 codeCoverageTool : ' cobertura'
9191 summaryFileLocation : ' **/cobertura-coverage.xml'
92- artifactName : ' Unit Test Coverage'
92+ artifactName : ' Unit Test Coverage'
9393 # CopyFiles can follow symlinks hence be careful with node_modules
9494 - task : CopyFiles@2
9595 condition : or(succeeded(), failed()) # publish either way
@@ -98,12 +98,12 @@ stages:
9898 **/*.build*.log
9999 !**/node_modules/**
100100 targetFolder : $(Build.ArtifactStagingDirectory)/logs
101- - task : PublishBuildArtifacts@1
101+ - task : PublishBuildArtifacts@1
102102 condition : or(succeeded(), failed()) # publish either way
103103 inputs :
104104 pathToPublish : $(Build.ArtifactStagingDirectory)/logs
105105 artifactName : ' Build logs'
106- - task : PublishBuildArtifacts@1
106+ - task : PublishBuildArtifacts@1
107107 condition : or(succeeded(), failed()) # publish either way
108108 inputs :
109109 pathToPublish : docs/apidocs/_out
@@ -114,7 +114,7 @@ stages:
114114 set -ev
115115 node common/scripts/install-run-rush.js publish --include-all --pack --release-folder $(Build.ArtifactStagingDirectory)/tgz --publish
116116 docker image save hyperledger/fabric-nodeenv | gzip > $(Build.ArtifactStagingDirectory)/fabric-nodeenv.tar.gz
117- displayName: 'Package tgz and docker image'
117+ displayName: 'Package tgz and docker image'
118118 - task : PublishBuildArtifacts@1
119119 inputs :
120120 pathToPublish : $(Build.ArtifactStagingDirectory)/tgz
@@ -123,22 +123,22 @@ stages:
123123 inputs :
124124 pathToPublish : $(Build.ArtifactStagingDirectory)/fabric-nodeenv.tar.gz
125125 artifactName : nodeenv-docker-image
126-
126+
127127 # Run the FV tests but using the built material
128128 - job : fvt
129129 displayName : ' FV Tests'
130130 dependsOn : main
131- steps :
131+ steps :
132132 - task : NodeTool@0
133133 inputs :
134- versionSpec : ' 10.x'
134+ versionSpec : ' 10.x'
135135 - task : DownloadPipelineArtifact@2
136136 inputs :
137137 artifact : nodeenv-docker-image
138138 path : $(Build.SourcesDirectory)/build
139139 - task : DownloadPipelineArtifact@2
140140 inputs :
141- artifact : node-tgz
141+ artifact : node-tgz
142142 path : $(Build.SourcesDirectory)/build
143143 - script : |
144144 set -ev
@@ -147,15 +147,15 @@ stages:
147147 docker images
148148 node common/scripts/install-run-rush.js install
149149 node common/scripts/install-run-rush.js update # should the tests need 'building' this will need to go here
150- displayName: 'Get the latest master docker images'
150+ displayName: 'Get the latest master docker images'
151151 - script : |
152152 set -ev
153153 node common/scripts/install-run-rush.js start-fabric
154154 node common/scripts/install-run-rush.js start-verdaccio # script will check for the ci variable and use built images
155155 docker images | grep hyperledger && docker ps -a
156156 node common/scripts/install-run-rush.js test:fv
157157 node common/scripts/install-run-rush.js test:e2e
158- displayName: 'FV Tests'
158+ displayName: 'FV Tests'
159159
160160 - task : PublishTestResults@2
161161 condition : or(succeeded(), failed()) # publish either way
@@ -170,16 +170,16 @@ stages:
170170 **/*.build*.log
171171 !**/node_modules/**
172172 targetFolder : $(Build.ArtifactStagingDirectory)/testlogs
173- - task : PublishBuildArtifacts@1
173+ - task : PublishBuildArtifacts@1
174174 condition : or(succeeded(), failed()) # publish either way
175175 inputs :
176176 pathToPublish : $(Build.ArtifactStagingDirectory)/testlogs
177- artifactName : ' Test logs'
177+ artifactName : ' Test logs'
178178 - task : PublishBuildArtifacts@1
179179 condition : or(succeeded(), failed()) # publish either way
180180 inputs :
181181 pathToPublish : tools/toolchain/network/docker-compose/logs/docker.log
182- artifactName : nodeenv-docker-image
182+ artifactName : nodeenv-docker-image
183183
184184 # Job to handle the auditing of the code
185185 # NPM audit is run on a 'fake' installation of the libraries
@@ -191,19 +191,19 @@ stages:
191191 steps :
192192 - task : NodeTool@0
193193 inputs :
194- versionSpec : ' 10.x'
194+ versionSpec : ' 10.x'
195195 - task : DownloadPipelineArtifact@2
196196 inputs :
197- artifact : node-tgz
197+ artifact : node-tgz
198198 path : $(Build.SourcesDirectory)/build
199- - script : |
199+ - script : |
200200 node common/scripts/install-run-rush.js install
201201 node common/scripts/install-run-rush.js start-verdaccio # script will check for the ci variable and use built images
202202 mkdir -p $(Build.SourcesDirectory)/audit && cd $(Build.SourcesDirectory)/audit && npm init -y
203203 npm install --registry http://localhost:4873 fabric-shim fabric-shim-crypto fabric-shim-api fabric-contract-api --save
204204 npm audit
205205 displayName: 'Run npm audit'
206-
206+
207207 # Publish the snapshot images etc.
208208 # Original source of these is https://github.com/hyperledger/ci-management/blob/master/jjb/fabric-chaincode-java/shell/include-raw-publish-docker-jar.sh
209209 - job : snapshot_publish
@@ -214,21 +214,12 @@ stages:
214214 inputs :
215215 artifact : nodeenv-docker-image
216216 path : $(Build.SourcesDirectory)/build
217- - script : |
218- docker image load --input build/fabric-nodeenv.tar.gz # gets the build image of nodeenv
219- docker images
220- # Publish docker images to nexus repository
221- docker login ${DOCKER_REGISTRY_URL} --username=${DOCKER_REGISTRY_USERNAME} --password=${DOCKER_REGISTRY_PASSWORD}
222- echo "Logged in to docker registry"
223- # tag javaenv image to $PUSH_VERSION
224- docker tag hyperledger/fabric-javaenv ${DOCKER_REGISTRY_URL}/fabric-javaenv:amd64-${MAPPED_VERSION}
225- # push javaenv to nexus repository
226- docker push ${DOCKER_REGISTRY_URL}/fabric-javaenv:amd64-${MAPPED_VERSION}
227- env:
228- DOCKER_REGISTRY_USERNAME: vsts
229- DOCKER_REGISTRY_PASSWORD: $(GITHUB_PAT)
230- DOCKER_REGISTRY_URL: docker.pkg.github.com/hyperledger/fabric-chaincode-java
217+ - script : ./ci/scripts/publish_docker.sh
218+ env :
231219 MAPPED_VERSION : $(PUSH_VERSION)
220+ NEXUS_USERNAME : $(nexus-user)
221+ NEXUS_PASSWORD : $(nexus-password)
222+ NEXUS_URL : nexus3.hyperledger.org:10003/hyperledger
232223 - script : |
233224 node common/scripts/install-run-rush.js install
234225 cd ${BUILD_SOURCEBRANCH}/docs/apidocs
@@ -273,7 +264,7 @@ stages:
273264 echo "Setup .npmrc"
274265 echo "Use pipeline secret to login"
275266 echo "publish"
276- - job : jsdoc_publish
267+ - job : jsdoc_publish
277268 steps :
278269 - script : |
279270 set -ev
0 commit comments