mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-22 17:45:10 +00:00
Update CI For Asset Transfer
Pushes the scripting logic into a standalone script and adds tests for the applications which by side-effect also test the invoke and query functions on the chaincode. Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
This commit is contained in:
parent
4c3fe17310
commit
e6184563ad
7 changed files with 159 additions and 23 deletions
|
|
@ -68,10 +68,68 @@ jobs:
|
||||||
- template: templates/install-deps.yml
|
- template: templates/install-deps.yml
|
||||||
- template: templates/fabcar/azure-pipelines-typescript.yml
|
- template: templates/fabcar/azure-pipelines-typescript.yml
|
||||||
|
|
||||||
- job: TestNetwork
|
- job: TestNetworkBasic
|
||||||
displayName: Test Network
|
displayName: Test Network
|
||||||
pool:
|
pool:
|
||||||
vmImage: ubuntu-18.04
|
vmImage: ubuntu-18.04
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
Basic-Go:
|
||||||
|
CHAINCODE_NAME: basic
|
||||||
|
CHAINCODE_LANGUAGE: go
|
||||||
|
Basic-Javascript:
|
||||||
|
CHAINCODE_NAME: basic
|
||||||
|
CHAINCODE_LANGUAGE: javascript
|
||||||
|
Basic-Typescript:
|
||||||
|
CHAINCODE_NAME: basic
|
||||||
|
CHAINCODE_LANGUAGE: typescript
|
||||||
steps:
|
steps:
|
||||||
- template: templates/install-deps.yml
|
- template: templates/install-deps.yml
|
||||||
- template: templates/test-network/azure-pipelines.yml
|
- script: ../ci/scripts/run-test-network-basic.sh
|
||||||
|
workingDirectory: test-network
|
||||||
|
displayName: Run Test Network Basic Chaincode
|
||||||
|
|
||||||
|
- job: TestNetworkLedger
|
||||||
|
displayName: Test Network
|
||||||
|
pool:
|
||||||
|
vmImage: ubuntu-18.04
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
Ledger-Go:
|
||||||
|
CHAINCODE_NAME: ledger
|
||||||
|
CHAINCODE_LANGUAGE: go
|
||||||
|
steps:
|
||||||
|
- template: templates/install-deps.yml
|
||||||
|
- script: ../ci/scripts/run-test-network-ledger.sh
|
||||||
|
workingDirectory: test-network
|
||||||
|
displayName: Run Test Network Ledger Chaincode
|
||||||
|
|
||||||
|
- job: TestNetworkPrivate
|
||||||
|
displayName: Test Network
|
||||||
|
pool:
|
||||||
|
vmImage: ubuntu-18.04
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
Private-Go:
|
||||||
|
CHAINCODE_NAME: private
|
||||||
|
CHAINCODE_LANGUAGE: go
|
||||||
|
steps:
|
||||||
|
- template: templates/install-deps.yml
|
||||||
|
- script: ../ci/scripts/run-test-network-private.sh
|
||||||
|
workingDirectory: test-network
|
||||||
|
displayName: Run Test Network Private Chaincode
|
||||||
|
|
||||||
|
- job: TestNetworkSecured
|
||||||
|
displayName: Test Network
|
||||||
|
pool:
|
||||||
|
vmImage: ubuntu-18.04
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
Secured-Go:
|
||||||
|
CHAINCODE_NAME: secured
|
||||||
|
CHAINCODE_LANGUAGE: go
|
||||||
|
steps:
|
||||||
|
- template: templates/install-deps.yml
|
||||||
|
- script: ../ci/scripts/run-test-network-secured.sh
|
||||||
|
workingDirectory: test-network
|
||||||
|
displayName: Run Test Network Secured Chaincode
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# FABRIC_VERSION is set in ci/azure-pipelines.yml
|
FABRIC_VERSION=${FABRIC_VERSION:-2.2}
|
||||||
STABLE_TAG=amd64-${FABRIC_VERSION}-stable
|
STABLE_TAG=amd64-${FABRIC_VERSION}-stable
|
||||||
|
|
||||||
for image in baseos peer orderer ca tools orderer ccenv javaenv nodeenv; do
|
for image in baseos peer orderer ca tools orderer ccenv javaenv nodeenv tools; do
|
||||||
docker pull -q hyperledger-fabric.jfrog.io/fabric-${image}:${STABLE_TAG}
|
docker pull -q "hyperledger-fabric.jfrog.io/fabric-${image}:${STABLE_TAG}"
|
||||||
docker tag hyperledger-fabric.jfrog.io/fabric-${image}:${STABLE_TAG} hyperledger/fabric-${image}
|
docker tag "hyperledger-fabric.jfrog.io/fabric-${image}:${STABLE_TAG}" hyperledger/fabric-${image}
|
||||||
docker tag hyperledger-fabric.jfrog.io/fabric-${image}:${STABLE_TAG} hyperledger/fabric-${image}:${FABRIC_VERSION}
|
docker tag "hyperledger-fabric.jfrog.io/fabric-${image}:${STABLE_TAG}" "hyperledger/fabric-${image}:${FABRIC_VERSION}"
|
||||||
docker rmi -f hyperledger-fabric.jfrog.io/fabric-${image}:${STABLE_TAG}
|
docker rmi -f "hyperledger-fabric.jfrog.io/fabric-${image}:${STABLE_TAG}"
|
||||||
done
|
done
|
||||||
|
|
||||||
docker pull -q hyperledger/fabric-couchdb
|
docker pull -q couchdb:3.1
|
||||||
docker images | grep hyperledger
|
docker images | grep hyperledger
|
||||||
|
|
|
||||||
29
ci/scripts/run-test-network-basic.sh
Executable file
29
ci/scripts/run-test-network-basic.sh
Executable file
|
|
@ -0,0 +1,29 @@
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
FABRIC_VERSION=${FABRIC_VERSION:-2.2}
|
||||||
|
CHAINCODE_LANGUAGE=${CHAINCODE_LANGUAGE:-go}
|
||||||
|
CHAINCODE_NAME=${CHAINCODE_NAME:-basic}
|
||||||
|
|
||||||
|
function print() {
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
NC='\033[0m'
|
||||||
|
echo
|
||||||
|
echo -e "${GREEN}${1}${NC}"
|
||||||
|
}
|
||||||
|
|
||||||
|
print "Creating network"
|
||||||
|
./network.sh up createChannel -ca -s couchdb -i "${FABRIC_VERSION}"
|
||||||
|
print "Deploying ${CHAINCODE_NAME} chaincode"
|
||||||
|
./network.sh deployCC -ccn "${CHAINCODE_NAME}" -ccv 1 -ccs 1 -ccl "${CHAINCODE_LANGUAGE}"
|
||||||
|
|
||||||
|
|
||||||
|
# Run Javascript application
|
||||||
|
print "Initializing Javascript application"
|
||||||
|
pushd ../asset-transfer-basic/application-javascript
|
||||||
|
npm install
|
||||||
|
print "Executing app.js"
|
||||||
|
node app.js
|
||||||
|
popd
|
||||||
|
|
||||||
|
print "Stopping network"
|
||||||
|
./network.sh down
|
||||||
21
ci/scripts/run-test-network-ledger.sh
Executable file
21
ci/scripts/run-test-network-ledger.sh
Executable file
|
|
@ -0,0 +1,21 @@
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
FABRIC_VERSION=${FABRIC_VERSION:-2.2}
|
||||||
|
CHAINCODE_LANGUAGE=${CHAINCODE_LANGUAGE:-go}
|
||||||
|
CHAINCODE_NAME=${CHAINCODE_NAME:-ledger}
|
||||||
|
|
||||||
|
function print() {
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
NC='\033[0m'
|
||||||
|
echo
|
||||||
|
echo -e "${GREEN}${1}${NC}"
|
||||||
|
}
|
||||||
|
|
||||||
|
print "Creating network"
|
||||||
|
./network.sh up createChannel -ca -s couchdb -i "${FABRIC_VERSION}"
|
||||||
|
|
||||||
|
print "Deploying ${CHAINCODE_NAME} chaincode"
|
||||||
|
./network.sh deployCC -ccn "${CHAINCODE_NAME}" -ccv 1 -ccs 1 -ccl "${CHAINCODE_LANGUAGE}"
|
||||||
|
|
||||||
|
print "Stopping network"
|
||||||
|
./network.sh down
|
||||||
21
ci/scripts/run-test-network-private.sh
Executable file
21
ci/scripts/run-test-network-private.sh
Executable file
|
|
@ -0,0 +1,21 @@
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
FABRIC_VERSION=${FABRIC_VERSION:-2.2}
|
||||||
|
CHAINCODE_LANGUAGE=${CHAINCODE_LANGUAGE:-go}
|
||||||
|
CHAINCODE_NAME=${CHAINCODE_NAME:-private}
|
||||||
|
|
||||||
|
function print() {
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
NC='\033[0m'
|
||||||
|
echo
|
||||||
|
echo -e "${GREEN}${1}${NC}"
|
||||||
|
}
|
||||||
|
|
||||||
|
print "Creating network"
|
||||||
|
./network.sh up createChannel -ca -s couchdb -i "${FABRIC_VERSION}"
|
||||||
|
|
||||||
|
print "Deploying ${CHAINCODE_NAME} chaincode"
|
||||||
|
./network.sh deployCC -ccn "${CHAINCODE_NAME}" -ccv 1 -ccs 1 -ccl "${CHAINCODE_LANGUAGE}"
|
||||||
|
|
||||||
|
print "Stopping network"
|
||||||
|
./network.sh down
|
||||||
21
ci/scripts/run-test-network-secured.sh
Executable file
21
ci/scripts/run-test-network-secured.sh
Executable file
|
|
@ -0,0 +1,21 @@
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
FABRIC_VERSION=${FABRIC_VERSION:-2.2}
|
||||||
|
CHAINCODE_LANGUAGE=${CHAINCODE_LANGUAGE:-go}
|
||||||
|
CHAINCODE_NAME=${CHAINCODE_NAME:-secured}
|
||||||
|
|
||||||
|
function print() {
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
NC='\033[0m'
|
||||||
|
echo
|
||||||
|
echo -e "${GREEN}${1}${NC}"
|
||||||
|
}
|
||||||
|
|
||||||
|
print "Creating network"
|
||||||
|
./network.sh up createChannel -ca -s couchdb -i "${FABRIC_VERSION}"
|
||||||
|
|
||||||
|
print "Deploying ${CHAINCODE_NAME} chaincode"
|
||||||
|
./network.sh deployCC -ccn "${CHAINCODE_NAME}" -ccv 1 -ccs 1 -ccl "${CHAINCODE_LANGUAGE}"
|
||||||
|
|
||||||
|
print "Stopping network"
|
||||||
|
./network.sh down
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
#
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- script: |
|
|
||||||
./network.sh up createChannel -s couchdb -i ${FABRIC_VERSION} # FABRIC_VERSION is set in ci/azure-pipelines.yml
|
|
||||||
./network.sh deployCC -ccn basic -ccv 1 -ccl javascript -cci initLedger
|
|
||||||
./network.sh deployCC -ccn basic -ccv 2 -ccl golang -cci initLedger
|
|
||||||
./network.sh deployCC -ccn basic -ccv 3 -ccl typescript -cci initLedger
|
|
||||||
./network.sh deployCC -ccn secure -ccv 1 -ccl golang
|
|
||||||
./network.sh down
|
|
||||||
workingDirectory: test-network
|
|
||||||
displayName: Start Test Network
|
|
||||||
Loading…
Reference in a new issue