Get package id

pull/135/head
Baohua Yang 2019-04-01 20:54:04 +08:00
parent 9950de8a5e
commit 0f8cf5a092
3 changed files with 29 additions and 11 deletions

View File

@ -6,8 +6,10 @@
# support advanced bash grammar
SHELL:=/bin/bash
# mode of the network: solo, kafka, couchdb, event, dev
HLF_MODE ?= solo
# mode of the network: solo, kafka
HLF_MODE ?= raft
# mode of db: golevel, couchdb
DB_MODE ?= golevel
NETWORK_INIT_WAIT ?= 2 # time to wait the fabric network finish initialization
@ -55,7 +57,7 @@ ready: # create/join channel, install/instantiate cc
make update_anchors
make cc_test
make cc_test # test_cc_install test_cc_instantiate test_cc_invoke_query
make test_lscc # test lscc operations
make test_qscc # test qscc operations

View File

@ -31,7 +31,7 @@ services:
network_mode: ${NETWORK}
# Default config can be found at https://github.com/hyperledger/fabric/blob/master/orderer/common/localconfig/config.go
environment:
- FABRIC_LOGGING_SPEC=DEBUG # default: INFO
- FABRIC_LOGGING_SPEC=INFO # default: INFO
- FABRIC_LOGGING_FORMAT="%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}"
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 # default: 127.0.0.1
- ORDERER_GENERAL_GENESISMETHOD=file # default: provisional
@ -101,7 +101,7 @@ services:
network_mode: ${NETWORK}
tty: true
environment:
- FABRIC_LOGGING_SPEC=DEBUG
- FABRIC_LOGGING_SPEC=INFO
- FABRIC_LOGGING_FORMAT=%{color}[%{id:03x} %{time:01-02 15:04:05.00 MST}] [%{module}] %{shortfunc} -> %{level:.4s}%{color:reset} %{message}
- CORE_PEER_TLS_ENABLED=true # to enable TLS, change to true
- ORDERER_CA=/etc/hyperledger/fabric/crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/msp/tlscacerts/tlsca.example.com-cert.pem

View File

@ -360,6 +360,7 @@ channelUpdate() {
}
# Install chaincode on specified peer node
# In v2.x it will package, install and approve
# chaincodeInstall peer cc_name version path
chaincodeInstall () {
local org=$1
@ -371,14 +372,29 @@ chaincodeInstall () {
echo "=== Install Chaincode on org ${org}/peer ${peer} === "
echo "name=${name}, version=${version}, path=${path}"
setEnvs $org $peer
peer chaincode install \
-n ${name} \
-v $version \
-p ${path} \
>&log.txt
echo "packaging chaincode"
peer lifecycle chaincode package ${name}.tar.gz \
--path ${path} \
--lang golang \
--label ${name}_${version}
echo "installing chaincode"
peer lifecycle chaincode install ${name}.tar.gz >&log.txt
echo "querying installed chaincode"
peer lifecycle chaincode queryinstalled >&query.log
package_id=$(grep -o "${name}_${version}:[a-z0-9]*" query.log|cut -d ":" -f 2)
echo "package id=${package_id}"
# v1.x action
#peer chaincode install \
# -n ${name} \
# -v $version \
# -p ${path} \
# >&log.txt
rc=$?
[ $rc -ne 0 ] && cat log.txt
verifyResult $rc "Chaincode installation on remote org ${org}/peer$peer has Failed"
verifyResult $rc "Chaincode installation on remote org ${org}/peer$peer has Failed"
echo "=== Chaincode is installed on remote peer$peer === "
}