-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor test-network post-decoupling fabric-tools image
This patch aims to refactor the test-network in several aspects, following the decoupling of the fabric-tools image from fabric-samples. - Rename 'test_network_home' env var to 'TEST_NETWORK_HOME' - Dedicate the intermediate artifacts related to configtx to channel-artifacts - Refer to core.yaml in fabric-samples/config, similar to org1 and 2, instead of adding a new core file. - Remove unnecessary functions and commentss for CLI container - Other minor modifications Signed-off-by: Tatsuya Sato <[email protected]>
- Loading branch information
Showing
7 changed files
with
65 additions
and
85 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
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
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
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 |
---|---|---|
|
@@ -8,19 +8,20 @@ | |
# This is a collection of bash functions used by different scripts | ||
|
||
# imports | ||
# test network home var targets to test network folder | ||
# the reason we use a var here is considering with org3 specific folder | ||
# when invoking this for org3 as test-network/scripts/org3-scripts | ||
# the value is changed from default as $PWD(test-network) | ||
# to .. as relative path to make the import works | ||
test_network_home=${test_network_home:-${PWD}} | ||
. ${test_network_home}/scripts/utils.sh | ||
# test network home var targets to test-network folder | ||
# the reason we use a var here is to accommodate scenarios | ||
# where execution occurs from folders outside of default as $PWD, such as the test-network/addOrg3 folder. | ||
# For setting environment variables, simple relative paths like ".." could lead to unintended references | ||
# due to how they interact with FABRIC_CFG_PATH. It's advised to specify paths more explicitly, | ||
# such as using "../${PWD}", to ensure that Fabric's environment variables are pointing to the correct paths. | ||
TEST_NETWORK_HOME=${TEST_NETWORK_HOME:-${PWD}} | ||
. ${TEST_NETWORK_HOME}/scripts/utils.sh | ||
|
||
export CORE_PEER_TLS_ENABLED=true | ||
export ORDERER_CA=${test_network_home}/organizations/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem | ||
export PEER0_ORG1_CA=${test_network_home}/organizations/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem | ||
export PEER0_ORG2_CA=${test_network_home}/organizations/peerOrganizations/org2.example.com/tlsca/tlsca.org2.example.com-cert.pem | ||
export PEER0_ORG3_CA=${test_network_home}/organizations/peerOrganizations/org3.example.com/tlsca/tlsca.org3.example.com-cert.pem | ||
export ORDERER_CA=${TEST_NETWORK_HOME}/organizations/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem | ||
export PEER0_ORG1_CA=${TEST_NETWORK_HOME}/organizations/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem | ||
export PEER0_ORG2_CA=${TEST_NETWORK_HOME}/organizations/peerOrganizations/org2.example.com/tlsca/tlsca.org2.example.com-cert.pem | ||
export PEER0_ORG3_CA=${TEST_NETWORK_HOME}/organizations/peerOrganizations/org3.example.com/tlsca/tlsca.org3.example.com-cert.pem | ||
|
||
# Set environment variables for the peer org | ||
setGlobals() { | ||
|
@@ -34,17 +35,17 @@ setGlobals() { | |
if [ $USING_ORG -eq 1 ]; then | ||
export CORE_PEER_LOCALMSPID="Org1MSP" | ||
export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG1_CA | ||
export CORE_PEER_MSPCONFIGPATH=${test_network_home}/organizations/peerOrganizations/org1.example.com/users/[email protected]/msp | ||
export CORE_PEER_MSPCONFIGPATH=${TEST_NETWORK_HOME}/organizations/peerOrganizations/org1.example.com/users/[email protected]/msp | ||
export CORE_PEER_ADDRESS=localhost:7051 | ||
elif [ $USING_ORG -eq 2 ]; then | ||
export CORE_PEER_LOCALMSPID="Org2MSP" | ||
export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG2_CA | ||
export CORE_PEER_MSPCONFIGPATH=${test_network_home}/organizations/peerOrganizations/org2.example.com/users/[email protected]/msp | ||
export CORE_PEER_MSPCONFIGPATH=${TEST_NETWORK_HOME}/organizations/peerOrganizations/org2.example.com/users/[email protected]/msp | ||
export CORE_PEER_ADDRESS=localhost:9051 | ||
elif [ $USING_ORG -eq 3 ]; then | ||
export CORE_PEER_LOCALMSPID="Org3MSP" | ||
export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG3_CA | ||
export CORE_PEER_MSPCONFIGPATH=${test_network_home}/organizations/peerOrganizations/org3.example.com/users/[email protected]/msp | ||
export CORE_PEER_MSPCONFIGPATH=${TEST_NETWORK_HOME}/organizations/peerOrganizations/org3.example.com/users/[email protected]/msp | ||
export CORE_PEER_ADDRESS=localhost:11051 | ||
else | ||
errorln "ORG Unknown" | ||
|
@@ -55,27 +56,6 @@ setGlobals() { | |
fi | ||
} | ||
|
||
# Set environment variables for use in the CLI container | ||
setGlobalsCLI() { | ||
setGlobals $1 | ||
|
||
local USING_ORG="" | ||
if [ -z "$OVERRIDE_ORG" ]; then | ||
USING_ORG=$1 | ||
else | ||
USING_ORG="${OVERRIDE_ORG}" | ||
fi | ||
if [ $USING_ORG -eq 1 ]; then | ||
export CORE_PEER_ADDRESS=peer0.org1.example.com:7051 | ||
elif [ $USING_ORG -eq 2 ]; then | ||
export CORE_PEER_ADDRESS=peer0.org2.example.com:9051 | ||
elif [ $USING_ORG -eq 3 ]; then | ||
export CORE_PEER_ADDRESS=peer0.org3.example.com:11051 | ||
else | ||
errorln "ORG Unknown" | ||
fi | ||
} | ||
|
||
# parsePeerConnectionParameters $@ | ||
# Helper function that sets the peer connection parameters for a chaincode | ||
# operation | ||
|
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
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
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