@@ -75,13 +75,34 @@ stages:
7575 - task : PublishCodeCoverageResults@1
7676 inputs :
7777 summaryFileLocation : " $(System.DefaultWorkingDirectory)/**/fabric-chaincode-shim/build/reports/jacoco/test/jacocoTestReport.xml"
78+ # Copy the built artifacts to the staging directory, tgz, and the docker image
79+ - script : |
80+ set -ev
81+ ./gradlew publishToMavenLocal
82+ tar -zcvf localmaven.tgz ${HOME}/.m2/repository/org/hyperledger
83+ docker image save hyperledger/fabric-javaenv | gzip > $(Build.ArtifactStagingDirectory)/fabric-javaenv.tar.gz
84+ displayName: 'Package tgz and docker image'
85+ - task : PublishBuildArtifacts@1
86+ inputs :
87+ pathToPublish : localmaven.tgz
88+ artifactName : java-tgz
89+ - task : PublishBuildArtifacts@1
90+ inputs :
91+ pathToPublish : $(Build.ArtifactStagingDirectory)/fabric-javaenv.tar.gz
92+ artifactName : javaenv-docker-image
7893
79- # Publish to Nexus the snapshot images etc.
94+ # Publish the snapshot images etc.
8095 # Original source of these is https://github.com/hyperledger/ci-management/blob/master/jjb/fabric-chaincode-java/shell/include-raw-publish-docker-jar.sh
81- - job : snapshot_nexus
96+ - job : snapshot_publish
8297 condition : and(succeeded(),eq(variables['Build.Reason'], 'IndividualCI'))
8398 steps :
99+ - task : DownloadPipelineArtifact@2
100+ inputs :
101+ artifact : java-docker-image
102+ path : $(Build.SourcesDirectory)/build
84103 - script : |
104+ docker image load --input build/java-nodeenv.tar.gz # gets the build image of nodeenv
105+ docker images
85106 # Publish docker images to nexus repository
86107 docker login ${DOCKER_REGISTRY_URL} --username=${DOCKER_REGISTRY_USERNAME} --password=${DOCKER_REGISTRY_PASSWORD}
87108 echo "Logged in to docker registry"
@@ -94,14 +115,6 @@ stages:
94115 DOCKER_REGISTRY_PASSWORD: $(GITHUB_REGISTRY_PWD_TOKEN)
95116 DOCKER_REGISTRY_URL: docker.pkg.github.com/hyperledger/fabric-chaincode-java
96117 MAPPED_VERSION: $(PUSH_VERSION)
97- - script : |
98- ./gradlew publishToMavenLocal
99- # - task: Bash@3
100- # inputs:
101- # targetType: 'filePath'
102- # filePath: '/ci/publish_jar_nexus.sh'
103- # env:
104- # - PUSH_VERSION: $(PUSH_VERSION)
105118
106119 # As the next script is more complex and uses loops, run this descretely in a sh file
107120 # Publishing step for git tags
0 commit comments