44#
55# SPDX-License-Identifier: Apache-2.0
66#
7+ # This script publishes the fabric docker images to hyperledger dockerhub and nexus3 repositories.
8+ # when publishing the images to dockerhub the values for NS_PULL & NS_PUSH variables set to default values.
9+ # when publishing the images to nexus3 repository the values for NS_PULL & NS_PUSH variables set like below
10+ # NS_PULL=nexus3.hyperledger.org:10001/hyperledger & NS_PUSH=nexus3.hyperledger.org:10002/hyperledger
11+ # since nexus has separate port numbers to pull and push the images to nexus3.
712
813usage () {
914 echo " Usage: $0 <username> <password>"
1015 echo " <username> and <password> credentials for the repository"
1116 echo " ENV:"
12- echo " NS=$NS "
17+ echo " NS_PULL=$NS_PULL "
18+ echo " NS_PUSH=$NS_PUSH "
1319 echo " VERSION=$VERSION "
1420 echo " TWO_DIGIT_VERSION=$TWO_DIGIT_VERSION "
1521 exit 1
@@ -18,7 +24,8 @@ usage() {
1824missing () {
1925 echo " Error: some image(s) missing from registry"
2026 echo " ENV:"
21- echo " NS=$NS "
27+ echo " NS_PULL=$NS_PULL "
28+ echo " NS_PUSH=$NS_PUSH "
2229 echo " VERSION=$VERSION "
2330 echo " TWO_DIGIT_VERSION=$TWO_DIGIT_VERSION "
2431 exit 1
@@ -27,17 +34,19 @@ missing() {
2734failed () {
2835 echo " Error: multiarch manifest push failed"
2936 echo " ENV:"
30- echo " NS=$NS "
37+ echo " NS_PULL=$NS_PULL "
38+ echo " NS_PUSH=$NS_PUSH "
3139 echo " VERSION=$VERSION "
3240 echo " TWO_DIGIT_VERSION=$TWO_DIGIT_VERSION "
3341 exit 1
3442}
3543
3644USER=${1:- nobody}
3745PASSWORD=${2:- nohow}
38- NS=${NS:- hyperledger}
39- VERSION=${BASE_VERSION:- 1.3.0}
40- TWO_DIGIT_VERSION=${TWO_DIGIT_VERSION:- 1.3}
46+ NS_PULL=${NS_PULL:- hyperledger}
47+ NS_PUSH=${NS_PUSH:- hyperledger}
48+ VERSION=${BASE_VERSION:- 1.4.1}
49+ TWO_DIGIT_VERSION=${TWO_DIGIT_VERSION:- 1.4}
4150
4251if [ " $# " -ne 2 ]; then
4352 usage
@@ -54,27 +63,27 @@ IMAGES="fabric-javaenv"
5463
5564# check that all images have been published
5665for image in ${IMAGES} ; do
57- docker pull ${NS } /${image} :amd64-${VERSION} || missing
66+ docker pull ${NS_PULL } /${image} :amd64-${VERSION} || missing
5867done
5968
60- # push the multiarch manifest and tag with just $VERSION and ' latest'
69+ # push the multiarch manifest and tag with $VERSION,$TWO_DIGIT_VERSION and latest tag
6170for image in ${IMAGES} ; do
6271 manifest-tool --username ${USER} --password ${PASSWORD} push from-args\
63- --platforms linux/amd64 --template " ${NS } /${image} :ARCH-${VERSION} " \
64- --target " ${NS } /${image} :${VERSION} "
72+ --platforms linux/amd64 --template " ${NS_PULL } /${image} :ARCH-${VERSION} " \
73+ --target " ${NS_PUSH } /${image} :${VERSION} "
6574 manifest-tool --username ${USER} --password ${PASSWORD} push from-args\
66- --platforms linux/amd64 --template " ${NS } /${image} :ARCH-${VERSION} " \
67- --target " ${NS } /${image} :latest"
75+ --platforms linux/amd64 --template " ${NS_PULL } /${image} :ARCH-${VERSION} " \
76+ --target " ${NS_PUSH } /${image} :latest"
6877 manifest-tool --username ${USER} --password ${PASSWORD} push from-args\
69- --platforms linux/amd64 --template " ${NS } /${image} :ARCH-${VERSION} " \
70- --target " ${NS } /${image} :${TWO_DIGIT_VERSION} "
78+ --platforms linux/amd64 --template " ${NS_PULL } /${image} :ARCH-${VERSION} " \
79+ --target " ${NS_PUSH } /${image} :${TWO_DIGIT_VERSION} "
7180done
7281
7382# test that manifest is working as expected
7483for image in ${IMAGES} ; do
75- docker pull ${NS } /${image} :${VERSION} || failed
76- docker pull ${NS } /${image} :${TWO_DIGIT_VERSION} || failed
77- docker pull ${NS } /${image} :latest || failed
84+ docker pull ${NS_PULL } /${image} :${VERSION} || failed
85+ docker pull ${NS_PULL } /${image} :${TWO_DIGIT_VERSION} || failed
86+ docker pull ${NS_PULL } /${image} :latest || failed
7887done
7988
8089echo " Successfully pushed multiarch manifest"
0 commit comments