mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-21 17:15:10 +00:00
[FAB-17952] Fix test-network to use the latest version of fabric-ca (#195)
To get rid of hard-coded versioning and use the latest version of fabric-ca in test-network, this patch modifies the existence check logic of the fabric-ca-client binary in the same way as peer and orderer. Also, this patch updates addOrg3.sh to use cai <ca_imagetag> option. Signed-off-by: Tatsuya Sato <Tatsuya.Sato@hal.hitachi.com>
This commit is contained in:
parent
87a2bc7afd
commit
808f035088
2 changed files with 40 additions and 28 deletions
|
|
@ -30,6 +30,7 @@ function printHelp () {
|
||||||
echo " -d <delay> - delay duration in seconds (defaults to 3)"
|
echo " -d <delay> - delay duration in seconds (defaults to 3)"
|
||||||
echo " -s <dbtype> - the database backend to use: goleveldb (default) or couchdb"
|
echo " -s <dbtype> - the database backend to use: goleveldb (default) or couchdb"
|
||||||
echo " -i <imagetag> - the tag to be used to launch the network (defaults to \"latest\")"
|
echo " -i <imagetag> - the tag to be used to launch the network (defaults to \"latest\")"
|
||||||
|
echo " -cai <ca_imagetag> - the image tag to be used for CA (defaults to \"${CA_IMAGETAG}\")"
|
||||||
echo " -verbose - verbose mode"
|
echo " -verbose - verbose mode"
|
||||||
echo
|
echo
|
||||||
echo "Typically, one would first generate the required certificates and "
|
echo "Typically, one would first generate the required certificates and "
|
||||||
|
|
@ -84,17 +85,12 @@ function generateOrg3() {
|
||||||
if [ "$CRYPTO" == "Certificate Authorities" ]; then
|
if [ "$CRYPTO" == "Certificate Authorities" ]; then
|
||||||
|
|
||||||
fabric-ca-client version > /dev/null 2>&1
|
fabric-ca-client version > /dev/null 2>&1
|
||||||
if [ $? -ne 0 ]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
echo "Fabric CA client not found locally, downloading..."
|
echo "ERROR! fabric-ca-client binary not found.."
|
||||||
cd ../..
|
echo
|
||||||
curl -s -L "https://github.com/hyperledger/fabric-ca/releases/download/v1.4.4/hyperledger-fabric-ca-${OS_ARCH}-1.4.4.tar.gz" | tar xz || rc=$?
|
echo "Follow the instructions in the Fabric docs to install the Fabric Binaries:"
|
||||||
if [ -n "$rc" ]; then
|
echo "https://hyperledger-fabric.readthedocs.io/en/latest/install.html"
|
||||||
echo "==> There was an error downloading the binary file."
|
exit 1
|
||||||
echo "fabric-ca-client binary is not available to download"
|
|
||||||
else
|
|
||||||
echo "==> Done."
|
|
||||||
cd test-network/addOrg3/
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
|
@ -102,14 +98,14 @@ function generateOrg3() {
|
||||||
echo "##### Generate certificates using Fabric CA's ############"
|
echo "##### Generate certificates using Fabric CA's ############"
|
||||||
echo "##########################################################"
|
echo "##########################################################"
|
||||||
|
|
||||||
IMAGE_TAG=$IMAGETAG docker-compose -f $COMPOSE_FILE_CA_ORG3 up -d 2>&1
|
IMAGE_TAG=${CA_IMAGETAG} docker-compose -f $COMPOSE_FILE_CA_ORG3 up -d 2>&1
|
||||||
|
|
||||||
. fabric-ca/registerEnroll.sh
|
. fabric-ca/registerEnroll.sh
|
||||||
|
|
||||||
sleep 10
|
sleep 10
|
||||||
|
|
||||||
echo "##########################################################"
|
echo "##########################################################"
|
||||||
echo "############ Create Org1 Identities ######################"
|
echo "############ Create Org3 Identities ######################"
|
||||||
echo "##########################################################"
|
echo "##########################################################"
|
||||||
|
|
||||||
createOrg3
|
createOrg3
|
||||||
|
|
@ -233,6 +229,8 @@ COMPOSE_FILE_ORG3=docker/docker-compose-org3.yaml
|
||||||
COMPOSE_FILE_CA_ORG3=docker/docker-compose-ca-org3.yaml
|
COMPOSE_FILE_CA_ORG3=docker/docker-compose-ca-org3.yaml
|
||||||
# default image tag
|
# default image tag
|
||||||
IMAGETAG="latest"
|
IMAGETAG="latest"
|
||||||
|
# default ca image tag
|
||||||
|
CA_IMAGETAG="latest"
|
||||||
# database
|
# database
|
||||||
DATABASE="leveldb"
|
DATABASE="leveldb"
|
||||||
|
|
||||||
|
|
@ -279,6 +277,10 @@ while [[ $# -ge 1 ]] ; do
|
||||||
IMAGETAG=$(go env GOARCH)"-""$2"
|
IMAGETAG=$(go env GOARCH)"-""$2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
-cai )
|
||||||
|
CA_IMAGETAG="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
-verbose )
|
-verbose )
|
||||||
VERBOSE=true
|
VERBOSE=true
|
||||||
shift
|
shift
|
||||||
|
|
|
||||||
|
|
@ -125,6 +125,30 @@ function checkPrereqs() {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
## Check for fabric-ca
|
||||||
|
if [ "$CRYPTO" == "Certificate Authorities" ]; then
|
||||||
|
|
||||||
|
fabric-ca-client version > /dev/null 2>&1
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo "ERROR! fabric-ca-client binary not found.."
|
||||||
|
echo
|
||||||
|
echo "Follow the instructions in the Fabric docs to install the Fabric Binaries:"
|
||||||
|
echo "https://hyperledger-fabric.readthedocs.io/en/latest/install.html"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
CA_LOCAL_VERSION=$(fabric-ca-client version | sed -ne 's/ Version: //p')
|
||||||
|
CA_DOCKER_IMAGE_VERSION=$(docker run --rm hyperledger/fabric-ca:$CA_IMAGETAG fabric-ca-client version | sed -ne 's/ Version: //p' | head -1)
|
||||||
|
echo "CA_LOCAL_VERSION=$CA_LOCAL_VERSION"
|
||||||
|
echo "CA_DOCKER_IMAGE_VERSION=$CA_DOCKER_IMAGE_VERSION"
|
||||||
|
|
||||||
|
if [ "$CA_LOCAL_VERSION" != "$CA_DOCKER_IMAGE_VERSION" ]; then
|
||||||
|
echo "=================== WARNING ======================"
|
||||||
|
echo " Local fabric-ca binaries and docker images are "
|
||||||
|
echo " out of sync. This may cause problems. "
|
||||||
|
echo "=================================================="
|
||||||
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -216,20 +240,6 @@ function createOrgs() {
|
||||||
# Create crypto material using Fabric CAs
|
# Create crypto material using Fabric CAs
|
||||||
if [ "$CRYPTO" == "Certificate Authorities" ]; then
|
if [ "$CRYPTO" == "Certificate Authorities" ]; then
|
||||||
|
|
||||||
fabric-ca-client version > /dev/null 2>&1
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Fabric CA client not found locally, downloading..."
|
|
||||||
cd ..
|
|
||||||
curl -s -L "https://github.com/hyperledger/fabric-ca/releases/download/v${CA_IMAGETAG}/hyperledger-fabric-ca-${OS_ARCH}-${CA_IMAGETAG}.tar.gz" | tar xz
|
|
||||||
if [ -n "$rc" ]; then
|
|
||||||
echo "==> There was an error downloading the binary file."
|
|
||||||
echo "fabric-ca-client binary is not available to download"
|
|
||||||
else
|
|
||||||
echo "==> Done."
|
|
||||||
cd test-network
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "##########################################################"
|
echo "##########################################################"
|
||||||
echo "##### Generate certificates using Fabric CA's ############"
|
echo "##### Generate certificates using Fabric CA's ############"
|
||||||
|
|
@ -439,7 +449,7 @@ VERSION=1
|
||||||
# default image tag
|
# default image tag
|
||||||
IMAGETAG="latest"
|
IMAGETAG="latest"
|
||||||
# default ca image tag
|
# default ca image tag
|
||||||
CA_IMAGETAG="1.4.6"
|
CA_IMAGETAG="latest"
|
||||||
# default database
|
# default database
|
||||||
DATABASE="leveldb"
|
DATABASE="leveldb"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue