4
4
#
5
5
# SPDX-License-Identifier: Apache-2.0
6
6
#
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.
7
12
8
13
usage () {
9
14
echo " Usage: $0 <username> <password>"
10
15
echo " <username> and <password> credentials for the repository"
11
16
echo " ENV:"
12
- echo " NS=$NS "
17
+ echo " NS_PULL=$NS_PULL "
18
+ echo " NS_PUSH=$NS_PUSH "
13
19
echo " VERSION=$VERSION "
14
20
echo " TWO_DIGIT_VERSION=$TWO_DIGIT_VERSION "
15
21
exit 1
@@ -18,7 +24,8 @@ usage() {
18
24
missing () {
19
25
echo " Error: some image(s) missing from registry"
20
26
echo " ENV:"
21
- echo " NS=$NS "
27
+ echo " NS_PULL=$NS_PULL "
28
+ echo " NS_PUSH=$NS_PUSH "
22
29
echo " VERSION=$VERSION "
23
30
echo " TWO_DIGIT_VERSION=$TWO_DIGIT_VERSION "
24
31
exit 1
@@ -27,15 +34,17 @@ missing() {
27
34
failed () {
28
35
echo " Error: multiarch manifest push failed"
29
36
echo " ENV:"
30
- echo " NS=$NS "
37
+ echo " NS_PULL=$NS_PULL "
38
+ echo " NS_PUSH=$NS_PUSH "
31
39
echo " VERSION=$VERSION "
32
40
echo " TWO_DIGIT_VERSION=$TWO_DIGIT_VERSION "
33
41
exit 1
34
42
}
35
43
36
44
USER=${1:- nobody}
37
45
PASSWORD=${2:- nohow}
38
- NS=${NS:- hyperledger}
46
+ NS_PULL=${NS_PULL:- hyperledger}
47
+ NS_PUSH=${NS_PUSH:- hyperledger}
39
48
VERSION=${BASE_VERSION:- 1.3.0}
40
49
TWO_DIGIT_VERSION=${TWO_DIGIT_VERSION:- 1.3}
41
50
@@ -54,28 +63,28 @@ IMAGES="fabric-baseos fabric-peer fabric-orderer fabric-ccenv fabric-tools"
54
63
55
64
# check that all images have been published
56
65
for image in ${IMAGES} ; do
57
- docker pull ${NS } /${image} :amd64-${VERSION} || missing
58
- docker pull ${NS } /${image} :s390x-${VERSION} || missing
66
+ docker pull ${NS_PULL } /${image} :amd64-${VERSION} || missing
67
+ docker pull ${NS_PULL } /${image} :s390x-${VERSION} || missing
59
68
done
60
69
61
70
# push the multiarch manifest and tag with just $VERSION and 'latest'
62
71
for image in ${IMAGES} ; do
63
72
manifest-tool --username ${USER} --password ${PASSWORD} push from-args\
64
- --platforms linux/amd64,linux/s390x --template " ${NS } /${image} :ARCH-${VERSION} " \
65
- --target " ${NS } /${image} :${VERSION} "
73
+ --platforms linux/amd64,linux/s390x --template " ${NS_PULL } /${image} :ARCH-${VERSION} " \
74
+ --target " ${NS_PUSH } /${image} :${VERSION} "
66
75
manifest-tool --username ${USER} --password ${PASSWORD} push from-args\
67
- --platforms linux/amd64,linux/s390x --template " ${NS } /${image} :ARCH-${VERSION} " \
68
- --target " ${NS } /${image} :latest"
76
+ --platforms linux/amd64,linux/s390x --template " ${NS_PULL } /${image} :ARCH-${VERSION} " \
77
+ --target " ${NS_PUSH } /${image} :latest"
69
78
manifest-tool --username ${USER} --password ${PASSWORD} push from-args\
70
- --platforms linux/amd64,linux/s390x --template " ${NS } /${image} :ARCH-${VERSION} " \
71
- --target " ${NS } /${image} :${TWO_DIGIT_VERSION} "
79
+ --platforms linux/amd64,linux/s390x --template " ${NS_PULL } /${image} :ARCH-${VERSION} " \
80
+ --target " ${NS_PUSH } /${image} :${TWO_DIGIT_VERSION} "
72
81
done
73
82
74
83
# test that manifest is working as expected
75
84
for image in ${IMAGES} ; do
76
- docker pull ${NS } /${image} :${VERSION} || failed
77
- docker pull ${NS } /${image} :${TWO_DIGIT_VERSION} || failed
78
- docker pull ${NS } /${image} :latest || failed
85
+ docker pull ${NS_PULL } /${image} :${VERSION} || failed
86
+ docker pull ${NS_PULL } /${image} :${TWO_DIGIT_VERSION} || failed
87
+ docker pull ${NS_PULL } /${image} :latest || failed
79
88
done
80
89
81
90
echo " Successfully pushed multiarch manifest"
0 commit comments