Skip to content

Commit 35dab2d

Browse files
FABCI-107 Update multiarch script
In the existing script, NS (NameSpace) won't workfor both hyperledger and Nexus. When you publish images to Nexus, NS uses two ports to pull and push. So the NS won't work to publish multicarch images to nexus. This patch add a new variable to publish images to nexus repository. example: NS_PULL=nexus3.hyperledger.org:10001/hyperledger NS_PUSH=nexus3.hyperledger.org:10002/hyperledger ./multiarch.sh <user> <password> Change-Id: I5137df6eef98aec231f1e16971cde02096d1a889 Signed-off-by: vijaypunugubati <vijaypunugubati@gmail.com>
1 parent 6bb1863 commit 35dab2d

File tree

1 file changed

+24
-15
lines changed

1 file changed

+24
-15
lines changed

scripts/multiarch.sh

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,18 @@
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

813
usage() {
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() {
1824
missing() {
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,15 +34,17 @@ missing() {
2734
failed() {
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

3644
USER=${1:-nobody}
3745
PASSWORD=${2:-nohow}
38-
NS=${NS:-hyperledger}
46+
NS_PULL=${NS_PULL:-hyperledger}
47+
NS_PUSH=${NS_PUSH:-hyperledger}
3948
VERSION=${BASE_VERSION:-1.3.0}
4049
TWO_DIGIT_VERSION=${TWO_DIGIT_VERSION:-1.3}
4150

@@ -54,28 +63,28 @@ IMAGES="fabric-baseos fabric-peer fabric-orderer fabric-ccenv fabric-tools"
5463

5564
# check that all images have been published
5665
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
5968
done
6069

6170
# push the multiarch manifest and tag with just $VERSION and 'latest'
6271
for image in ${IMAGES}; do
6372
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}"
6675
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"
6978
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}"
7281
done
7382

7483
# test that manifest is working as expected
7584
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
7988
done
8089

8190
echo "Successfully pushed multiarch manifest"

0 commit comments

Comments
 (0)