11# Copyright IBM Corp. All Rights Reserved.
22#
33# SPDX-License-Identifier: Apache-2.0
4- #
4+ #
55# fabric-chaincode-java azure pipeline configuration.
6- #
6+ #
77name : $(SourceBranchName)-$(Date:yyyyMMdd)$(Rev:.rrr)
88
99# Daily build for final quality
1010# cf https://crontab.guru/#0_23_*_*_*
1111schedules :
1212 - cron : " 0 23 * * *"
13- displayName : ' Chaincode Java Nightly Driver'
13+ displayName : " Chaincode Java Nightly Driver"
1414 branches :
1515 include :
1616 - master
1717 - release-1.4
1818 always : true
1919
20-
20+ # Trigger on master, release-1.4 and git tags
2121trigger :
2222 branches :
2323 include :
24- - ' master'
25- - ' release-1.4'
24+ - " master"
25+ - " release-1.4"
2626 tags :
2727 include :
28- - ' * '
28+ - " * "
2929
3030# These are custom defined variables, the pipeline one is currently used for the build scripts
3131# to know to produce tests results in XML format for Azure to consume, for developers
3232# this isn't set so command line output is given
33- #
33+ #
3434# These are custom defined variables, the pipeline one is currently used for the build scripts
3535# to know to produce tests results in XML format for Azure to consume, for developers
3636# this isn't set so command line output is given
37- #
37+ #
3838# Chaincode_Java_Creds is the protected group of keys for publishing
3939variables :
4040 - group : Chaincode_Java_Creds
41+ - group : GitHubRegistry
4142 - name : component
4243 value : fabric-chaincode-java
4344 - name : pipeline
44- value : ci
45+ value : ci
4546 - name : NEXUS_REPO_URL
4647 value : nexus3.hyperledger.org:10003
4748 - name : PUSH_VERSION
48- value : stable
49+ value : stable
4950
5051pool :
51- vmImage : ' ubuntu-latest'
52+ vmImage : " ubuntu-latest"
5253
53- #
54+ #
5455# The stages and jobs, potential for rationalization and optimization
5556# Keeping it simple and explict whilst we gain experience
5657stages :
5758 - stage : Build_and_test
5859 jobs :
59- - job : main
60+ - job : main
6061 steps :
6162 - script : env
6263 - task : Gradle@2
6364 inputs :
64- workingDirectory : ' '
65- gradleWrapperFile : ' gradlew'
66- gradleOptions : ' -Xmx3072m'
67- javaHomeOption : ' JDKVersion'
68- jdkVersionOption : ' 1.8'
69- jdkArchitectureOption : ' x64'
65+ workingDirectory : " "
66+ gradleWrapperFile : " gradlew"
67+ gradleOptions : " -Xmx3072m"
68+ javaHomeOption : " JDKVersion"
69+ jdkVersionOption : " 1.8"
70+ jdkArchitectureOption : " x64"
7071 publishJUnitResults : true
71- testResultsFiles : ' $(System.DefaultWorkingDirectory)/**/TEST-*.xml'
72- tasks : ' build'
72+ testResultsFiles : " $(System.DefaultWorkingDirectory)/**/TEST-*.xml"
73+ tasks : " build"
7374 - task : PublishCodeCoverageResults@1
74- inputs :
75- summaryFileLocation : ' $(System.DefaultWorkingDirectory)/**/fabric-chaincode-shim/build/reports/jacoco/test/jacocoTestReport.xml'
75+ inputs :
76+ summaryFileLocation : " $(System.DefaultWorkingDirectory)/**/fabric-chaincode-shim/build/reports/jacoco/test/jacocoTestReport.xml"
7677
77- # Publish to Nexus the snapshot images etc.
78- # Original source of these is https://github.com/hyperledger/ci-management/blob/master/jjb/fabric-chaincode-java/shell/include-raw-publish-docker-jar.sh
78+ # Publish to Nexus the snapshot images etc.
79+ # Original source of these is https://github.com/hyperledger/ci-management/blob/master/jjb/fabric-chaincode-java/shell/include-raw-publish-docker-jar.sh
7980 - job : snapshot_nexus
8081 condition : and(succeeded(),eq(variables['Build.Reason'], 'IndividualCI'))
8182 steps :
8283 - script : |
8384 # Publish docker images to nexus repository
84- docker login $(NEXUS_REPO_URL) --username=$env.NEXUS_HUB_USERNAME --password=$env.NEXUS_HUB_PASSWORD
85+ docker login $env.DOCKER_REGISTRY_URL --username=$env.DOCKER_REGISTRY_USERNAME --password=$env.DOCKER_REGISTRY_PASSWORD
8586 # tag javaenv image to $PUSH_VERSION
86- docker tag hyperledger/fabric-javaenv $(NEXUS_REPO_URL)/hyperledger /fabric-javaenv:amd64-$(PUSH_VERSION)
87+ docker tag hyperledger/fabric-javaenv $env.DOCKER_REGISTRY_URL /fabric-javaenv:amd64-$(PUSH_VERSION)
8788 # push javaenv to nexus repository
88- docker push $(NEXUS_REPO_URL)/hyperledger/fabric-javaenv:amd64-$(PUSH_VERSION)
89- env:
90- NEXUS_HUB_USERNAME: $(nexus-user)
91- NEXUS_HUB_PASSWORD: $(nexus-password)
89+ docker push $env.DOCKER_REGISTRY_URL/fabric-javaenv:amd64-$(PUSH_VERSION)
90+ env:
91+ DOCKER_REGISTRY_USERNAME: $(GITHUB_REGISTRY_USER)
92+ DOCKER_REGISTRY_PASSWORD: $(GITHUB_REGISTRY_PWD_TOKEN)
93+ DOCKER_REGISTRY_URL: docker.pkg.github.com/hyperledger/fabric-chaincode-java
9294 - script : |
9395 ./gradlew publishToMavenLocal
94- # As the next script is more complex and uses loops, run this descretely in a sh file
95- - task : Bash@3
96- inputs :
97- targetType : ' filePath'
98- filePath : ' /ci/publish_jar_nexus.sh'
99- env :
100- PUSH_VERSION : $(PUSH_VERSION)
96+ # - task: Bash@3
97+ # inputs:
98+ # targetType: 'filePath'
99+ # filePath: '/ci/publish_jar_nexus.sh'
100+ # env:
101+ # - PUSH_VERSION: $(PUSH_VERSION)
101102
102- # Publishing step for git tags
103+ # As the next script is more complex and uses loops, run this descretely in a sh file
104+ # Publishing step for git tags
103105 - stage : Publish_tag
104106 condition : and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags'))
105107 jobs :
@@ -116,8 +118,8 @@ stages:
116118 echo "Setup .npmrc"
117119 echo "Use pipeline secret to login"
118120 echo "publish"
119- - job : jsdoc_publish
121+ - job : jsdoc_publish
120122 steps :
121123 - script : |
122124 echo "checkout docs branch"
123- echo "checking"
125+ echo "checking"
0 commit comments