Skip to content

Commit 5a11c6e

Browse files
mbwhitejt-nti
authored andcommitted
Push the snapshot docker images to nexus
Change-Id: Ifa1d1297f0c0051d9ec7ff788611a1ce44b9e098 Signed-off-by: Matthew B. White <[email protected]>
1 parent 4eff463 commit 5a11c6e

File tree

2 files changed

+58
-1
lines changed

2 files changed

+58
-1
lines changed

ci/azure-pipelines.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# fabric-chaincode-java azure pipeline configuration.
66
#
7-
name: RELEASE-$(Date:yyyyMMdd)$(Rev:.rrr)
7+
name: $(BUILD_SOURCEBRANCHNAME)-$(Date:yyyyMMdd)$(Rev:.rrr)
88

99
# Daily build for final quality
1010
# cf https://crontab.guru/#0_23_*_*_*
@@ -42,6 +42,10 @@ variables:
4242
value: fabric-chaincode-java
4343
- name: pipeline
4444
value: ci
45+
- name: NEXUS_REPO_URL
46+
value: nexus3.hyperledger.org:10002
47+
- name: PUSH_VERSION
48+
value: stable
4549

4650
pool:
4751
vmImage: 'ubuntu-latest'
@@ -69,6 +73,26 @@ stages:
6973
- task: PublishCodeCoverageResults@1
7074
inputs:
7175
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/fabric-chaincode-shim/build/reports/jacoco/test/jacocoTestReport.xml'
76+
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
79+
- job: snapshot_nexus
80+
condition: and(succeeded(),eq(variables['Build.Reason'], 'IndividualCI'))
81+
steps:
82+
- script: |
83+
# Publish docker images to nexus repository
84+
docker login nexus3.hyperledger.org:10001 --username=$(NEXUS_HUB_USERNAME) --password=$(NEXUS_HUB_PASSWORD)
85+
# tag javaenv image to $PUSH_VERSION
86+
docker tag hyperledger/fabric-javaenv $(NEXUS_REPO_URL)/hyperledger/fabric-javaenv:amd64-$(PUSH_VERSION)
87+
# push javaenv to nexus repository
88+
docker push $(NEXUS_REPO_URL)/hyperledger/fabric-javaenv:amd64-$(PUSH_VERSION)
89+
- script: |
90+
./gradlew publishToMavenLocal
91+
#
92+
export PUSH_VERSION=$(PUSH_VERSION)
93+
#
94+
./ci/publish_jar_nexus.sh
95+
7296
- stage: Publish_tag
7397
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags'))
7498
jobs:

ci/publish_jar_nexus.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
6+
# Exit on first error, print all commands.
7+
set -e
8+
set -o pipefail
9+
WORKSPACE="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
10+
11+
function abort {
12+
echo "!! Exiting shell script"
13+
echo "!!" "$1"
14+
exit -1
15+
}
16+
17+
for binary in shim protos; do
18+
echo "Pushing fabric-chaincode-$binary.$PUSH_VERSION.jar to maven releases.."
19+
cp $WORKSPACE/fabric-chaincode-$binary/build/libs/fabric-chaincode-$binary-$PUSH_VERSION.jar $WORKSPACE/fabric-chaincode-$binary/build/libs/fabric-chaincode-$binary.$PUSH_VERSION.jar
20+
mwn org.apache.maven.plugins:maven-deploy-plugin:deploy-file \
21+
-DupdateReleaseInfo=true \
22+
-Dfile=$WORKSPACE/fabric-chaincode-$binary/build/libs/fabric-chaincode-$binary.$PUSH_VERSION.jar \
23+
-DpomFile=$WORKSPACE/fabric-chaincode-$binary/build/publications/"$binary"Jar/pom-default.xml \
24+
-DrepositoryId=hyperledger-releases \
25+
-Durl=https://nexus.hyperledger.org/content/repositories/releases/ \
26+
-DgroupId=org.hyperledger.fabric-chaincode-java \
27+
-Dversion=$PUSH_VERSION \
28+
-DartifactId=fabric-chaincode-$binary \
29+
-DgeneratePom=false \
30+
-DuniqueVersion=false \
31+
-Dpackaging=jar \
32+
-gs $GLOBAL_SETTINGS_FILE -s $SETTINGS_FILE
33+
done

0 commit comments

Comments
 (0)