Skip to content

Commit

Permalink
update with review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Yuan <yy19902439@126.com>
  • Loading branch information
SamYuan1990 committed Apr 2, 2024
1 parent 97bab7d commit c4ad7d9
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
5 changes: 5 additions & 0 deletions test-network/scripts/configUpdate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
#

# import utils
# 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/envVar.sh

Expand Down
5 changes: 5 additions & 0 deletions test-network/scripts/envVar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
# 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

Expand Down
7 changes: 6 additions & 1 deletion test-network/scripts/org3-scripts/joinChannel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ COUNTER=1
MAX_RETRY=5

# import environment variables
# 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
export test_network_home=..
. ${test_network_home}/scripts/envVar.sh

Expand All @@ -48,7 +53,7 @@ joinChannel() {

setAnchorPeer() {
ORG=$1
scripts/setAnchorPeer.sh $ORG $CHANNEL_NAME
${test_network_home}/scripts/setAnchorPeer.sh $ORG $CHANNEL_NAME
}

setGlobalsCLI 3
Expand Down
7 changes: 6 additions & 1 deletion test-network/scripts/org3-scripts/updateChannelConfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ MAX_RETRY=5


# 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
export test_network_home=..
. ${test_network_home}/scripts/configUpdate.sh

Expand All @@ -33,7 +38,7 @@ fetchChannelConfig 1 ${CHANNEL_NAME} config.json

# Modify the configuration to append the new org
set -x
jq -s '.[0] * {"channel_group":{"groups":{"Application":{"groups": {"Org3MSP":.[1]}}}}}' config.json ../organizations/peerOrganizations/org3.example.com/org3.json > modified_config.json
jq -s '.[0] * {"channel_group":{"groups":{"Application":{"groups": {"Org3MSP":.[1]}}}}}' config.json ${test_network_home}/organizations/peerOrganizations/org3.example.com/org3.json > modified_config.json
{ set +x; } 2>/dev/null

# Compute a config update, based on the differences between config.json and modified_config.json, write it as a transaction to org3_update_in_envelope.pb
Expand Down
8 changes: 7 additions & 1 deletion test-network/scripts/setAnchorPeer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
#

# import utils
. scripts/configUpdate.sh
# 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/configUpdate.sh


# NOTE: this must be run in a CLI container since it requires jq and configtxlator
Expand Down

0 comments on commit c4ad7d9

Please sign in to comment.