mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 15:35:09 +00:00
[FAB-14486] Extend BYFN to opt skip chaincode deploy
Add a new "-n" option to byfn.sh that optionally skips the deployment of the abstore chaincode. When BYFN is used as a network for other samples, we don't really want the default chaincode deployed. Change-Id: I6b4043a5c0bcedbeec431cc4a860a3b12da8d8f6 Signed-off-by: Simon Stone <sstone1@uk.ibm.com>
This commit is contained in:
parent
3a1d29ce93
commit
8271a472f8
3 changed files with 39 additions and 22 deletions
|
|
@ -35,7 +35,7 @@ export VERBOSE=false
|
|||
# Print the usage message
|
||||
function printHelp() {
|
||||
echo "Usage: "
|
||||
echo " byfn.sh <mode> [-c <channel name>] [-t <timeout>] [-d <delay>] [-f <docker-compose-file>] [-s <dbtype>] [-l <language>] [-o <consensus-type>] [-i <imagetag>] [-a] [-v]"
|
||||
echo " byfn.sh <mode> [-c <channel name>] [-t <timeout>] [-d <delay>] [-f <docker-compose-file>] [-s <dbtype>] [-l <language>] [-o <consensus-type>] [-i <imagetag>] [-a] [-n] [-v]"
|
||||
echo " <mode> - one of 'up', 'down', 'restart', 'generate' or 'upgrade'"
|
||||
echo " - 'up' - bring up the network with docker-compose up"
|
||||
echo " - 'down' - clear the network with docker-compose down"
|
||||
|
|
@ -51,6 +51,7 @@ function printHelp() {
|
|||
echo " -o <consensus-type> - the consensus-type of the ordering service: solo (default), kafka, or etcdraft"
|
||||
echo " -i <imagetag> - the tag to be used to launch the network (defaults to \"latest\")"
|
||||
echo " -a - launch certificate authorities (no certificate authorities are launched by default)"
|
||||
echo " -n - do not deploy chaincode (abstore chaincode is deployed by default)"
|
||||
echo " -v - verbose mode"
|
||||
echo " byfn.sh -h (print this message)"
|
||||
echo
|
||||
|
|
@ -530,7 +531,7 @@ else
|
|||
exit 1
|
||||
fi
|
||||
|
||||
while getopts "h?c:t:d:f:s:l:i:o:av" opt; do
|
||||
while getopts "h?c:t:d:f:s:l:i:o:anv" opt; do
|
||||
case "$opt" in
|
||||
h | \?)
|
||||
printHelp
|
||||
|
|
@ -563,6 +564,9 @@ while getopts "h?c:t:d:f:s:l:i:o:av" opt; do
|
|||
a)
|
||||
CERTIFICATE_AUTHORITIES=true
|
||||
;;
|
||||
n)
|
||||
NO_CHAINCODE=true
|
||||
;;
|
||||
v)
|
||||
VERBOSE=true
|
||||
;;
|
||||
|
|
|
|||
|
|
@ -14,11 +14,13 @@ DELAY="$2"
|
|||
LANGUAGE="$3"
|
||||
TIMEOUT="$4"
|
||||
VERBOSE="$5"
|
||||
NO_CHAINCODE="$6"
|
||||
: ${CHANNEL_NAME:="mychannel"}
|
||||
: ${DELAY:="3"}
|
||||
: ${LANGUAGE:="golang"}
|
||||
: ${TIMEOUT:="10"}
|
||||
: ${VERBOSE:="false"}
|
||||
: ${NO_CHAINCODE:="false"}
|
||||
LANGUAGE=`echo "$LANGUAGE" | tr [:upper:] [:lower:]`
|
||||
COUNTER=1
|
||||
MAX_RETRY=10
|
||||
|
|
@ -82,31 +84,35 @@ updateAnchorPeers 0 1
|
|||
echo "Updating anchor peers for org2..."
|
||||
updateAnchorPeers 0 2
|
||||
|
||||
## Install chaincode on peer0.org1 and peer0.org2
|
||||
echo "Installing chaincode on peer0.org1..."
|
||||
installChaincode 0 1
|
||||
echo "Install chaincode on peer0.org2..."
|
||||
installChaincode 0 2
|
||||
if [ "${NO_CHAINCODE}" != "true" ]; then
|
||||
|
||||
# Instantiate chaincode on peer0.org2
|
||||
echo "Instantiating chaincode on peer0.org2..."
|
||||
instantiateChaincode 0 2
|
||||
## Install chaincode on peer0.org1 and peer0.org2
|
||||
echo "Installing chaincode on peer0.org1..."
|
||||
installChaincode 0 1
|
||||
echo "Install chaincode on peer0.org2..."
|
||||
installChaincode 0 2
|
||||
|
||||
# Query chaincode on peer0.org1
|
||||
echo "Querying chaincode on peer0.org1..."
|
||||
chaincodeQuery 0 1 100
|
||||
# Instantiate chaincode on peer0.org2
|
||||
echo "Instantiating chaincode on peer0.org2..."
|
||||
instantiateChaincode 0 2
|
||||
|
||||
# Invoke chaincode on peer0.org1 and peer0.org2
|
||||
echo "Sending invoke transaction on peer0.org1 peer0.org2..."
|
||||
chaincodeInvoke 0 1 0 2
|
||||
# Query chaincode on peer0.org1
|
||||
echo "Querying chaincode on peer0.org1..."
|
||||
chaincodeQuery 0 1 100
|
||||
|
||||
## Install chaincode on peer1.org2
|
||||
echo "Installing chaincode on peer1.org2..."
|
||||
installChaincode 1 2
|
||||
# Invoke chaincode on peer0.org1 and peer0.org2
|
||||
echo "Sending invoke transaction on peer0.org1 peer0.org2..."
|
||||
chaincodeInvoke 0 1 0 2
|
||||
|
||||
## Install chaincode on peer1.org2
|
||||
echo "Installing chaincode on peer1.org2..."
|
||||
installChaincode 1 2
|
||||
|
||||
# Query on chaincode on peer1.org2, check if the result is 90
|
||||
echo "Querying chaincode on peer1.org2..."
|
||||
chaincodeQuery 1 2 90
|
||||
# Query on chaincode on peer1.org2, check if the result is 90
|
||||
echo "Querying chaincode on peer1.org2..."
|
||||
chaincodeQuery 1 2 90
|
||||
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "========= All GOOD, BYFN execution completed =========== "
|
||||
|
|
|
|||
|
|
@ -87,4 +87,11 @@ echo "##################################################"
|
|||
echo y | ./byfn.sh -m up -a
|
||||
copy_logs $? default-channel-ca
|
||||
echo y | ./byfn.sh -m down -a
|
||||
echo
|
||||
|
||||
echo "############### BYFN WITH NO CHAINCODE TEST ################"
|
||||
echo "############################################################"
|
||||
echo y | ./byfn.sh -m up -n
|
||||
copy_logs $? default-channel-ca
|
||||
echo y | ./byfn.sh -m down -n
|
||||
echo
|
||||
Loading…
Reference in a new issue