forked from hyperledger/fabric-chaincode-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultiarch.sh
More file actions
executable file
·81 lines (70 loc) · 2.11 KB
/
multiarch.sh
File metadata and controls
executable file
·81 lines (70 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/sh
#
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
usage() {
echo "Usage: $0 <username> <password>"
echo "<username> and <password> credentials for the repository"
echo "ENV:"
echo " NS=$NS"
echo " VERSION=$VERSION"
echo " TWO_DIGIT_VERSION=$TWO_DIGIT_VERSION"
exit 1
}
missing() {
echo "Error: some image(s) missing from registry"
echo "ENV:"
echo " NS=$NS"
echo " VERSION=$VERSION"
echo " TWO_DIGIT_VERSION=$TWO_DIGIT_VERSION"
exit 1
}
failed() {
echo "Error: multiarch manifest push failed"
echo "ENV:"
echo " NS=$NS"
echo " VERSION=$VERSION"
echo " TWO_DIGIT_VERSION=$TWO_DIGIT_VERSION"
exit 1
}
USER=${1:-nobody}
PASSWORD=${2:-nohow}
NS=${NS:-hyperledger}
VERSION=${BASE_VERSION:-1.3.0}
TWO_DIGIT_VERSION=${TWO_DIGIT_VERSION:-1.3}
if [ "$#" -ne 2 ]; then
usage
fi
# verify that manifest-tool is installed and found on PATH
which manifest-tool
if [ "$?" -ne 0 ]; then
echo "manifest-tool not installed or not found on PATH"
exit 1
fi
IMAGES="fabric-javaenv"
# check that all images have been published
for image in ${IMAGES}; do
docker pull ${NS}/${image}:amd64-${VERSION} || missing
done
# push the multiarch manifest and tag with just $VERSION and 'latest'
for image in ${IMAGES}; do
manifest-tool --username ${USER} --password ${PASSWORD} push from-args\
--platforms linux/amd64 --template "${NS}/${image}:ARCH-${VERSION}"\
--target "${NS}/${image}:${VERSION}"
# manifest-tool --username ${USER} --password ${PASSWORD} push from-args\
# --platforms linux/amd64 --template "${NS}/${image}:ARCH-${VERSION}"\
# --target "${NS}/${image}:latest"
manifest-tool --username ${USER} --password ${PASSWORD} push from-args\
--platforms linux/amd64 --template "${NS}/${image}:ARCH-${VERSION}"\
--target "${NS}/${image}:${TWO_DIGIT_VERSION}"
done
# test that manifest is working as expected
for image in ${IMAGES}; do
docker pull ${NS}/${image}:${VERSION} || failed
docker pull ${NS}/${image}:${TWO_DIGIT_VERSION} || failed
# docker pull ${NS}/${image}:latest || failed
done
echo "Successfully pushed multiarch manifest"
exit 0