-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FAB-10294 script to publish multiarch manifest
Change-Id: I5fd2ebb60be5b62d34bd24b6b73e4299ccf376f3 Signed-off-by: Christopher Ferris <chrisfer@us.ibm.com>
- Loading branch information
1 parent
bfb4b0f
commit e01cf5b
Showing
1 changed file
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/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" | ||
exit 1 | ||
} | ||
|
||
missing() { | ||
echo "Error: some image(s) missing from registry" | ||
echo "ENV:" | ||
echo " NS=$NS" | ||
echo " VERSION=$VERSION" | ||
exit 1 | ||
} | ||
|
||
failed() { | ||
echo "Error: multiarch manifest push failed" | ||
echo "ENV:" | ||
echo " NS=$NS" | ||
echo " VERSION=$VERSION" | ||
exit 1 | ||
} | ||
|
||
USER=${1:-nobody} | ||
PASSWORD=${2:-nohow} | ||
NS=${NS:-hyperledger} | ||
VERSION=${BASE_VERSION:-1.1.0} | ||
|
||
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-peer fabric-orderer fabric-ccenv fabric-tools" | ||
|
||
# check that all images have been published | ||
for image in ${IMAGES}; do | ||
docker pull ${NS}/${image}:amd64-${VERSION} || missing | ||
docker pull ${NS}/${image}:s390x-${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,linux/s390x --template "${NS}/${image}:ARCH-${VERSION}"\ | ||
--target "${NS}/${image}:${VERSION}" | ||
manifest-tool --username ${USER} --password ${PASSWORD} push from-args\ | ||
--platforms linux/amd64,linux/s390x --template "${NS}/${image}:ARCH-${VERSION}"\ | ||
--target "${NS}/${image}:latest" | ||
done | ||
|
||
# test that manifest is working as expected | ||
for image in ${IMAGES}; do | ||
docker pull ${NS}/${image}:${VERSION} || failed | ||
docker pull ${NS}/${image}:latest || failed | ||
done | ||
|
||
echo "Successfully pushed multiarch manifest" | ||
exit 0 |