mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 15:35:09 +00:00
Organize and Standardize ci Directory Content (#152)
This change organizes the `ci` directory into common-sense subfolders and standardizes pipelines naming schemes. Also removes the dead Jenkins code in the `./scripts` directory Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
This commit is contained in:
parent
aa409637b4
commit
c572c51d3a
19 changed files with 127 additions and 425 deletions
|
|
@ -7,94 +7,71 @@ trigger:
|
|||
- release-1.4
|
||||
|
||||
variables:
|
||||
NODE_VER: '12.x'
|
||||
PATH: $(Agent.BuildDirectory)/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin
|
||||
FABRIC_VERSION: 2.0
|
||||
NODE_VER: 12.x
|
||||
PATH: $(Build.Repository.LocalPath)/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin
|
||||
|
||||
jobs:
|
||||
- job: fabcar_go
|
||||
- job: CommercialPaper_Go
|
||||
displayName: Commercial Paper (Go)
|
||||
pool:
|
||||
vmImage: ubuntu-18.04
|
||||
steps:
|
||||
- template: templates/install-deps.yml
|
||||
- template: templates/commercial-paper/azure-pipelines-go.yml
|
||||
|
||||
- job: CommercialPaper_Java
|
||||
displayName: Commercial Paper (Java)
|
||||
pool:
|
||||
vmImage: ubuntu-18.04
|
||||
steps:
|
||||
- template: templates/install-deps.yml
|
||||
- template: templates/commercial-paper/azure-pipelines-java.yml
|
||||
|
||||
- job: CommercialPaper_JavaScript
|
||||
displayName: Commercial Paper (JavaScript)
|
||||
pool:
|
||||
vmImage: ubuntu-18.04
|
||||
steps:
|
||||
- template: templates/install-deps.yml
|
||||
- template: templates/commercial-paper/azure-pipelines-javascript.yml
|
||||
|
||||
- job: FabCar_Go
|
||||
displayName: FabCar (Go)
|
||||
pool:
|
||||
vmImage: ubuntu-18.04
|
||||
dependsOn: []
|
||||
timeoutInMinutes: 60
|
||||
steps:
|
||||
- template: install-deps.yml
|
||||
- template: install-fabric.yml
|
||||
- template: fabcar-go.yml
|
||||
- template: templates/install-deps.yml
|
||||
- template: templates/fabcar/azure-pipelines-go.yml
|
||||
|
||||
- job: test_network
|
||||
displayName: Start the test network
|
||||
pool:
|
||||
vmImage: ubuntu-18.04
|
||||
dependsOn: []
|
||||
timeoutInMinutes: 60
|
||||
steps:
|
||||
- template: install-deps.yml
|
||||
- template: install-fabric.yml
|
||||
- template: testnetwork.yml
|
||||
|
||||
- job: fabcar_java
|
||||
- job: FabCar_Java
|
||||
displayName: FabCar (Java)
|
||||
pool:
|
||||
vmImage: ubuntu-18.04
|
||||
dependsOn: []
|
||||
timeoutInMinutes: 60
|
||||
steps:
|
||||
- template: install-deps.yml
|
||||
- template: install-fabric.yml
|
||||
- template: fabcar-java.yml
|
||||
- template: templates/install-deps.yml
|
||||
- template: templates/fabcar/azure-pipelines-java.yml
|
||||
|
||||
- job: fabcar_javascript
|
||||
- job: FabCar_JavaScript
|
||||
displayName: FabCar (JavaScript)
|
||||
pool:
|
||||
vmImage: ubuntu-18.04
|
||||
dependsOn: []
|
||||
timeoutInMinutes: 60
|
||||
steps:
|
||||
- template: install-deps.yml
|
||||
- template: install-fabric.yml
|
||||
- template: fabcar-javascript.yml
|
||||
- template: templates/install-deps.yml
|
||||
- template: templates/fabcar/azure-pipelines-javascript.yml
|
||||
|
||||
- job: fabcar_typescript
|
||||
- job: Fabcar_TypeScript
|
||||
displayName: FabCar (TypeScript)
|
||||
pool:
|
||||
vmImage: ubuntu-18.04
|
||||
dependsOn: []
|
||||
timeoutInMinutes: 60
|
||||
steps:
|
||||
- template: install-deps.yml
|
||||
- template: install-fabric.yml
|
||||
- template: fabcar-typescript.yml
|
||||
- template: templates/install-deps.yml
|
||||
- template: templates/fabcar/azure-pipelines-typescript.yml
|
||||
|
||||
- job: commercialpaper_javascript
|
||||
displayName: CommercialPaper (JavaScript)
|
||||
- job: TestNetwork
|
||||
displayName: Test Network
|
||||
pool:
|
||||
vmImage: ubuntu-18.04
|
||||
dependsOn: []
|
||||
timeoutInMinutes: 60
|
||||
steps:
|
||||
- template: install-deps.yml
|
||||
- template: install-fabric.yml
|
||||
- template: commercialpaper-javascript.yml
|
||||
|
||||
- job: commercialpaper_java
|
||||
displayName: CommercialPaper (Java)
|
||||
pool:
|
||||
vmImage: ubuntu-18.04
|
||||
dependsOn: []
|
||||
timeoutInMinutes: 60
|
||||
steps:
|
||||
- template: install-deps.yml
|
||||
- template: install-fabric.yml
|
||||
- template: commercialpaper-java.yml
|
||||
|
||||
- job: commercialpaper_go
|
||||
displayName: CommercialPaper (Go)
|
||||
pool:
|
||||
vmImage: ubuntu-18.04
|
||||
dependsOn: []
|
||||
timeoutInMinutes: 60
|
||||
steps:
|
||||
- template: install-deps.yml
|
||||
- template: install-fabric.yml
|
||||
- template: commercialpaper-go.yml
|
||||
- template: templates/install-deps.yml
|
||||
- template: templates/test-network/azure-pipelines.yml
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
set -o pipefail
|
||||
|
||||
echo "======== PULL DOCKER IMAGES ========"
|
||||
##########################################################
|
||||
REPO_URL=hyperledger-fabric.jfrog.io
|
||||
ORG_NAME="fabric"
|
||||
|
||||
VERSION=2.1
|
||||
ARCH="amd64"
|
||||
: ${STABLE_VERSION:=$VERSION-stable}
|
||||
STABLE_TAG=$ARCH-$STABLE_VERSION
|
||||
MASTER_TAG=$ARCH-stable
|
||||
|
||||
echo "---------> STABLE_VERSION:" $STABLE_VERSION
|
||||
|
||||
dockerTag() {
|
||||
for IMAGES in baseos peer orderer ca tools orderer ccenv javaenv nodeenv; do
|
||||
echo "Images: $IMAGES"
|
||||
echo
|
||||
docker pull $REPO_URL/$ORG_NAME-$IMAGES:$STABLE_TAG
|
||||
if [ $? != 0 ]; then
|
||||
echo "FAILED: Docker Pull Failed on $IMAGES"
|
||||
exit 1
|
||||
fi
|
||||
docker tag $REPO_URL/$ORG_NAME-$IMAGES:$STABLE_TAG hyperledger/$ORG_NAME-$IMAGES
|
||||
docker tag $REPO_URL/$ORG_NAME-$IMAGES:$STABLE_TAG hyperledger/$ORG_NAME-$IMAGES:latest
|
||||
docker tag $REPO_URL/$ORG_NAME-$IMAGES:$STABLE_TAG hyperledger/$ORG_NAME-$IMAGES:$ARCH-$VERSION-stable
|
||||
docker tag $REPO_URL/$ORG_NAME-$IMAGES:$STABLE_TAG hyperledger/$ORG_NAME-$IMAGES:$ARCH-stable
|
||||
docker tag $REPO_URL/$ORG_NAME-$IMAGES:$STABLE_TAG hyperledger/$ORG_NAME-$IMAGES:$VERSION
|
||||
|
||||
echo "Deleting docker images: $IMAGES"
|
||||
docker rmi -f $REPO_URL/$ORG_NAME-$IMAGES:$STABLE_TAG
|
||||
done
|
||||
}
|
||||
|
||||
dockerTag
|
||||
|
||||
echo
|
||||
docker images
|
||||
echo
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
steps:
|
||||
- script: sudo sh -c "curl https://raw.githubusercontent.com/kadwanev/retry/master/retry -o /usr/local/bin/retry && chmod +x /usr/local/bin/retry"
|
||||
displayName: Install retry CLI
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: $(NODE_VER)
|
||||
displayName: 'Install Node.js'
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
set -eo pipefail
|
||||
curl -L --retry 5 --retry-delay 3 https://hyperledger.jfrog.io/hyperledger/fabric-binaries/hyperledger-fabric-linux-amd64-latest.tar.gz | tar xz
|
||||
displayName: Download Fabric CLI
|
||||
- script: |
|
||||
set -eo pipefail
|
||||
curl -L --retry 5 --retry-delay 3 https://hyperledger.jfrog.io/hyperledger/fabric-binaries/hyperledger-fabric-ca-linux-amd64-latest.tar.gz | tar xz
|
||||
displayName: Download Fabric CA CLI
|
||||
- script: bash ci/getDockerImages.sh
|
||||
displayName: Pull Fabric Docker images
|
||||
15
ci/scripts/pullFabricImages.sh
Executable file
15
ci/scripts/pullFabricImages.sh
Executable file
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash -e
|
||||
set -euo pipefail
|
||||
|
||||
# FABRIC_VERSION is set in ci/azure-pipelines.yml
|
||||
STABLE_TAG=amd64-${FABRIC_VERSION}-stable
|
||||
|
||||
for image in baseos peer orderer ca tools orderer ccenv javaenv nodeenv; do
|
||||
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}:${FABRIC_VERSION}
|
||||
docker rmi -f hyperledger-fabric.jfrog.io/fabric-${image}:${STABLE_TAG}
|
||||
done
|
||||
|
||||
docker pull -q hyperledger/fabric-couchdb
|
||||
docker images | grep hyperledger
|
||||
|
|
@ -5,32 +5,26 @@
|
|||
steps:
|
||||
- script: go test ./...
|
||||
workingDirectory: commercial-paper/organization/magnetocorp/contract-go
|
||||
displayName: Go unit test magnetocorp
|
||||
displayName: Unit Test MagnetoCorp Chaincode
|
||||
- script: go test ./...
|
||||
workingDirectory: commercial-paper/organization/digibank/contract-go
|
||||
displayName: Go unit test digibank
|
||||
displayName: Unit Test DigiBank Chaincode
|
||||
|
||||
- script: |
|
||||
go mod vendor
|
||||
- script: go mod vendor
|
||||
workingDirectory: commercial-paper/organization/magnetocorp/contract-go
|
||||
- script: |
|
||||
go mod vendor
|
||||
displayName: Vendor MagnetoCorp Dependencies
|
||||
- script: go mod vendor
|
||||
workingDirectory: commercial-paper/organization/digibank/contract-go
|
||||
displayName: Vendor DigiBank Dependencies
|
||||
|
||||
- script: |
|
||||
echo $PATH
|
||||
ls -l /usr/local/bin/peer
|
||||
sudo tar xzvf /tmp/hyperledger-fabric-linux-amd64-latest.tar.gz -C ..
|
||||
./network.sh down
|
||||
./network.sh up createChannel -s couchdb -i 2.0.0
|
||||
./network.sh up createChannel -s couchdb -i ${FABRIC_VERSION} # FABRIC_VERSION is set in ci/azure-pipelines.yml
|
||||
|
||||
# Copy the connection profiles so they are in the correct organizations.
|
||||
cp "./organizations/peerOrganizations/org1.example.com/connection-org1.yaml" "../commercial-paper/organization/digibank/gateway/"
|
||||
cp "./organizations/peerOrganizations/org2.example.com/connection-org2.yaml" "../commercial-paper/organization/magnetocorp/gateway/"
|
||||
workingDirectory: test-network
|
||||
displayName: Start Fabric
|
||||
env:
|
||||
FABRIC_CFG_PATH: /usr/local/config
|
||||
- script: |
|
||||
source <(./magnetocorp.sh)
|
||||
peer lifecycle chaincode package cp.tar.gz --lang java --path ./contract-java --label cp_0
|
||||
|
|
@ -50,9 +44,7 @@ steps:
|
|||
|
||||
peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name papercontract -v 0 --sequence 1
|
||||
workingDirectory: commercial-paper/organization/magnetocorp
|
||||
displayName: Setup Commercial Paper contract
|
||||
env:
|
||||
FABRIC_CFG_PATH: /usr/local/config
|
||||
displayName: Setup Commercial Paper Contract
|
||||
- script: |
|
||||
source <(./digibank.sh)
|
||||
peer lifecycle chaincode package cp.tar.gz --lang java --path ./contract-java --label cp_0
|
||||
|
|
@ -81,29 +73,25 @@ steps:
|
|||
--tls --cafile $ORDERER_CA --waitForEvent
|
||||
|
||||
workingDirectory: commercial-paper/organization/digibank
|
||||
displayName: Setup Commercial Paper contract
|
||||
env:
|
||||
FABRIC_CFG_PATH: /usr/local/config
|
||||
|
||||
|
||||
displayName: Setup Commercial Paper Contract
|
||||
|
||||
- script: retry -- npm install
|
||||
workingDirectory: commercial-paper/organization/magnetocorp/application
|
||||
displayName: Install Magnetocorp application
|
||||
displayName: Install Magnetocorp Application
|
||||
- script: |
|
||||
set -ex
|
||||
node addToWallet.js
|
||||
node issue.js
|
||||
workingDirectory: commercial-paper/organization/magnetocorp/application
|
||||
displayName: Magnetocorp issue paper
|
||||
displayName: MagnetoCorp Issue Paper
|
||||
|
||||
- script: retry -- npm install
|
||||
workingDirectory: commercial-paper/organization/digibank/application
|
||||
displayName: Install Digibank application
|
||||
displayName: Install DigiBank Application
|
||||
- script: |
|
||||
set -ex
|
||||
node addToWallet.js
|
||||
node buy.js
|
||||
node redeem.js
|
||||
workingDirectory: commercial-paper/organization/digibank/application
|
||||
displayName: Digibank issue paper
|
||||
displayName: Digibank Issue Paper
|
||||
|
|
@ -6,26 +6,20 @@ steps:
|
|||
- script: |
|
||||
./gradlew build
|
||||
workingDirectory: commercial-paper/organization/digibank/contract-java
|
||||
displayName: Build Java Contract
|
||||
displayName: Build DigiBank Java Contract
|
||||
- script: |
|
||||
./gradlew build
|
||||
workingDirectory: commercial-paper/organization/magnetocorp/contract-java
|
||||
displayName: Build Java Contract
|
||||
displayName: Build MagnetoCorp Java Contract
|
||||
|
||||
- script: |
|
||||
echo $PATH
|
||||
ls -l /usr/local/bin/peer
|
||||
sudo tar xzvf /tmp/hyperledger-fabric-linux-amd64-latest.tar.gz -C ..
|
||||
./network.sh down
|
||||
./network.sh up createChannel -s couchdb -i 2.0.0
|
||||
./network.sh up createChannel -s couchdb -i ${FABRIC_VERSION} # FABRIC_VERSION is set in ci/azure-pipelines.yml
|
||||
|
||||
# Copy the connection profiles so they are in the correct organizations.
|
||||
cp "./organizations/peerOrganizations/org1.example.com/connection-org1.yaml" "../commercial-paper/organization/digibank/gateway/"
|
||||
cp "./organizations/peerOrganizations/org2.example.com/connection-org2.yaml" "../commercial-paper/organization/magnetocorp/gateway/"
|
||||
workingDirectory: test-network
|
||||
displayName: Start Fabric
|
||||
env:
|
||||
FABRIC_CFG_PATH: /usr/local/config
|
||||
- script: |
|
||||
source <(./magnetocorp.sh)
|
||||
peer lifecycle chaincode package cp.tar.gz --lang java --path ./contract-java --label cp_0
|
||||
|
|
@ -45,9 +39,7 @@ steps:
|
|||
|
||||
peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name papercontract -v 0 --sequence 1
|
||||
workingDirectory: commercial-paper/organization/magnetocorp
|
||||
displayName: Setup Commercial Paper contract
|
||||
env:
|
||||
FABRIC_CFG_PATH: /usr/local/config
|
||||
displayName: Setup Commercial Paper Contract
|
||||
- script: |
|
||||
source <(./digibank.sh)
|
||||
peer lifecycle chaincode package cp.tar.gz --lang java --path ./contract-java --label cp_0
|
||||
|
|
@ -76,28 +68,25 @@ steps:
|
|||
--tls --cafile $ORDERER_CA --waitForEvent
|
||||
|
||||
workingDirectory: commercial-paper/organization/digibank
|
||||
displayName: Setup Commercial Paper contract
|
||||
env:
|
||||
FABRIC_CFG_PATH: /usr/local/config
|
||||
|
||||
displayName: Setup Commercial Paper Contract
|
||||
|
||||
- script: retry -- npm install
|
||||
workingDirectory: commercial-paper/organization/magnetocorp/application
|
||||
displayName: Install Magnetocorp application
|
||||
displayName: Install MagnetoCorp Application
|
||||
- script: |
|
||||
set -ex
|
||||
node addToWallet.js
|
||||
node issue.js
|
||||
workingDirectory: commercial-paper/organization/magnetocorp/application
|
||||
displayName: Magnetocorp issue paper
|
||||
displayName: MagnetoCorp Issue Paper
|
||||
|
||||
- script: retry -- npm install
|
||||
workingDirectory: commercial-paper/organization/digibank/application
|
||||
displayName: Install Digibank application
|
||||
displayName: Install DigiBank Application
|
||||
- script: |
|
||||
set -ex
|
||||
node addToWallet.js
|
||||
node buy.js
|
||||
node redeem.js
|
||||
workingDirectory: commercial-paper/organization/digibank/application
|
||||
displayName: Digibank issue paper
|
||||
displayName: DigiBank Issue Paper
|
||||
|
|
@ -4,19 +4,13 @@
|
|||
|
||||
steps:
|
||||
- script: |
|
||||
echo $PATH
|
||||
ls -l /usr/local/bin/peer
|
||||
sudo tar xzvf /tmp/hyperledger-fabric-linux-amd64-latest.tar.gz -C ..
|
||||
./network.sh down
|
||||
./network.sh up createChannel -s couchdb -i 2.0.0
|
||||
./network.sh up createChannel -s couchdb -i ${FABRIC_VERSION} # FABRIC_VERSION is set in ci/azure-pipelines.yml
|
||||
|
||||
# Copy the connection profiles so they are in the correct organizations.
|
||||
cp "./organizations/peerOrganizations/org1.example.com/connection-org1.yaml" "../commercial-paper/organization/digibank/gateway/"
|
||||
cp "./organizations/peerOrganizations/org2.example.com/connection-org2.yaml" "../commercial-paper/organization/magnetocorp/gateway/"
|
||||
workingDirectory: test-network
|
||||
displayName: Start Fabric
|
||||
env:
|
||||
FABRIC_CFG_PATH: /usr/local/config
|
||||
- script: |
|
||||
source <(./magnetocorp.sh)
|
||||
peer lifecycle chaincode package cp.tar.gz --lang node --path ./contract --label cp_0
|
||||
|
|
@ -36,9 +30,7 @@ steps:
|
|||
|
||||
peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name papercontract -v 0 --sequence 1
|
||||
workingDirectory: commercial-paper/organization/magnetocorp
|
||||
displayName: Setup Commercial Paper contract
|
||||
env:
|
||||
FABRIC_CFG_PATH: /usr/local/config
|
||||
displayName: Setup Commercial Paper Contract
|
||||
- script: |
|
||||
source <(./digibank.sh)
|
||||
peer lifecycle chaincode package cp.tar.gz --lang node --path ./contract --label cp_0
|
||||
|
|
@ -67,26 +59,24 @@ steps:
|
|||
--tls --cafile $ORDERER_CA --waitForEvent
|
||||
|
||||
workingDirectory: commercial-paper/organization/digibank
|
||||
displayName: Setup Commercial Paper contract
|
||||
env:
|
||||
FABRIC_CFG_PATH: /usr/local/config
|
||||
displayName: Setup Commercial Paper Contract
|
||||
- script: retry -- npm install
|
||||
workingDirectory: commercial-paper/organization/magnetocorp/application
|
||||
displayName: Install Magnetocorp application
|
||||
displayName: Install MagnetoCorp Application
|
||||
- script: |
|
||||
set -ex
|
||||
node addToWallet.js
|
||||
node issue.js
|
||||
workingDirectory: commercial-paper/organization/magnetocorp/application
|
||||
displayName: Magnetocorp issue paper
|
||||
displayName: MagnetoCorp Issue Paper
|
||||
|
||||
- script: retry -- npm install
|
||||
workingDirectory: commercial-paper/organization/digibank/application
|
||||
displayName: Install Digibank application
|
||||
displayName: Install DigiBank Application
|
||||
- script: |
|
||||
set -ex
|
||||
node addToWallet.js
|
||||
node buy.js
|
||||
node redeem.js
|
||||
workingDirectory: commercial-paper/organization/digibank/application
|
||||
displayName: Digibank issue paper
|
||||
displayName: DigiBank Issue Paper
|
||||
|
|
@ -3,6 +3,6 @@
|
|||
#
|
||||
|
||||
steps:
|
||||
- script: bash startFabric.sh go
|
||||
- script: ./startFabric.sh go
|
||||
workingDirectory: fabcar
|
||||
displayName: Start Fabric
|
||||
|
|
@ -3,12 +3,12 @@
|
|||
#
|
||||
|
||||
steps:
|
||||
- script: bash startFabric.sh java
|
||||
- script: ./startFabric.sh java
|
||||
workingDirectory: fabcar
|
||||
displayName: Start Fabric
|
||||
- script: retry -- mvn dependency:go-offline
|
||||
workingDirectory: fabcar/java
|
||||
displayName: Install FabCar application dependencies
|
||||
displayName: Install FabCar Application Dependencies
|
||||
- script: mvn test
|
||||
workingDirectory: fabcar/java
|
||||
displayName: Run FabCar application
|
||||
displayName: Run FabCar Application
|
||||
|
|
@ -3,14 +3,14 @@
|
|||
#
|
||||
|
||||
steps:
|
||||
- script: bash startFabric.sh javascript
|
||||
- script: ./startFabric.sh javascript
|
||||
workingDirectory: fabcar
|
||||
displayName: Start Fabric
|
||||
- script: |
|
||||
retry -- npm install
|
||||
npm ls
|
||||
workingDirectory: fabcar/javascript
|
||||
displayName: Install FabCar application dependencies
|
||||
displayName: Install FabCar Application Dependencies
|
||||
- script: |
|
||||
set -ex
|
||||
node enrollAdmin
|
||||
|
|
@ -18,4 +18,4 @@ steps:
|
|||
node invoke
|
||||
node query
|
||||
workingDirectory: fabcar/javascript
|
||||
displayName: Run FabCar application
|
||||
displayName: Run FabCar Application
|
||||
|
|
@ -3,12 +3,12 @@
|
|||
#
|
||||
|
||||
steps:
|
||||
- script: bash startFabric.sh typescript
|
||||
- script: ./startFabric.sh typescript
|
||||
workingDirectory: fabcar
|
||||
displayName: Start Fabric
|
||||
- script: retry -- npm install
|
||||
workingDirectory: fabcar/typescript
|
||||
displayName: Install FabCar application dependencies
|
||||
displayName: Install FabCar Application Dependencies
|
||||
- script: npm run build
|
||||
workingDirectory: fabcar/typescript
|
||||
displayName: Build FabCar application
|
||||
|
|
@ -19,4 +19,4 @@ steps:
|
|||
node dist/invoke
|
||||
node dist/query
|
||||
workingDirectory: fabcar/typescript
|
||||
displayName: Run FabCar application
|
||||
displayName: Run FabCar Application
|
||||
17
ci/templates/install-deps.yml
Normal file
17
ci/templates/install-deps.yml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: $(NODE_VER)
|
||||
displayName: Install Node.js
|
||||
- script: curl -L --retry 5 --retry-delay 3 https://hyperledger.jfrog.io/hyperledger/fabric-binaries/hyperledger-fabric-linux-amd64-${FABRIC_VERSION}-stable.tar.gz | tar xz
|
||||
displayName: Download Fabric CLI
|
||||
- script: curl -L --retry 5 --retry-delay 3 https://hyperledger.jfrog.io/hyperledger/fabric-binaries/hyperledger-fabric-ca-linux-amd64-${FABRIC_VERSION}-stable.tar.gz | tar xz
|
||||
displayName: Download Fabric CA CLI
|
||||
- script: curl https://raw.githubusercontent.com/kadwanev/retry/master/retry -o ./bin/retry && chmod +x ./bin/retry
|
||||
displayName: Install retry CLI
|
||||
- script: ./ci/scripts/pullFabricImages.sh
|
||||
displayName: Pull Fabric Docker Imagess
|
||||
11
ci/templates/test-network/azure-pipelines.yml
Normal file
11
ci/templates/test-network/azure-pipelines.yml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#
|
||||
# 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 -l javascript
|
||||
./network.sh down
|
||||
workingDirectory: test-network
|
||||
displayName: Start Test Network
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
sudo tar xzvf /tmp/hyperledger-fabric-linux-amd64-latest.tar.gz -C ..
|
||||
./network.sh down
|
||||
./network.sh up createChannel -s couchdb -i 2.0.0
|
||||
./network.sh deployCC -l javascript
|
||||
|
||||
workingDirectory: test-network
|
||||
displayName: Start up test network
|
||||
env:
|
||||
FABRIC_CFG_PATH: /usr/local/config
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Copyright IBM Corp All Rights Reserved
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# docker container list
|
||||
CONTAINER_LIST=(peer0.org1 peer1.org1 peer0.org2 peer1.org2 peer0.org3 peer1.org3 orderer)
|
||||
COUCHDB_CONTAINER_LIST=(couchdb0 couchdb1 couchdb2 couchdb3 couchdb4 couchdb5)
|
||||
|
||||
cd $WORKSPACE/$BASE_DIR/first-network
|
||||
# export path
|
||||
export PATH=$WORKSPACE/$BASE_DIR/bin:$PATH
|
||||
|
||||
logs() {
|
||||
# Create Logs directory
|
||||
mkdir -p $WORKSPACE/Docker_Container_Logs
|
||||
for CONTAINER in ${CONTAINER_LIST[*]}; do
|
||||
docker logs $CONTAINER.example.com >& $WORKSPACE/Docker_Container_Logs/$CONTAINER-$1.log
|
||||
echo
|
||||
done
|
||||
}
|
||||
|
||||
if [ ! -z $2 ]; then
|
||||
for CONTAINER in ${COUCHDB_CONTAINER_LIST[*]}; do
|
||||
docker logs $CONTAINER >& $WORKSPACE/Docker_Container_Logs/$CONTAINER-$1.log
|
||||
echo
|
||||
done
|
||||
fi
|
||||
|
||||
copy_logs() {
|
||||
# Call logs function
|
||||
logs $2 $3
|
||||
if [ $1 != 0 ]; then
|
||||
echo -e "\033[31m $2 test case is FAILED" "\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
echo " ################ "
|
||||
echo -e "\033[1m DEFAULT CHANNEL\033[0m"
|
||||
echo " # ############## "
|
||||
set -x
|
||||
echo y | ./byfn.sh -m down
|
||||
echo y | ./byfn.sh -m up -t 60
|
||||
copy_logs $? default-channel
|
||||
echo y | ./eyfn.sh -m up -t 60
|
||||
copy_logs $? default-channel
|
||||
echo y | ./eyfn.sh -m down
|
||||
set +x
|
||||
echo
|
||||
|
||||
echo " ############################ "
|
||||
echo -e "\033[1mCUSTOM CHANNEL - COUCHDB\033[0m"
|
||||
echo " # ########################## "
|
||||
set -x
|
||||
echo y | ./byfn.sh -m up -c custom-channel-couchdb -s couchdb -t 75 -d 15
|
||||
copy_logs $? custom-channel-couch couchdb
|
||||
echo y | ./eyfn.sh -m up -c custom-channel-couchdb -s couchdb -t 75 -d 15
|
||||
copy_logs $? custom-channel-couch
|
||||
echo y | ./eyfn.sh -m down
|
||||
set +x
|
||||
echo
|
||||
|
||||
echo " #################################### "
|
||||
echo -e "\033[1m JAVASCRIPT CHAINCODE\033[0m"
|
||||
echo " # ################################## "
|
||||
set -x
|
||||
echo y | ./byfn.sh -m up -l javascript -t 60
|
||||
copy_logs $? default-channel-javascript
|
||||
echo y | ./eyfn.sh -m up -l javascript -t 60
|
||||
copy_logs $? default-channel-javascript
|
||||
echo y | ./eyfn.sh -m down
|
||||
set +x
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
#
|
||||
# Copyright IBM Corp All Rights Reserved
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# exit on first error
|
||||
|
||||
Parse_Arguments() {
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
--byfn_eyfn_Tests)
|
||||
byfn_eyfn_Tests
|
||||
;;
|
||||
--fabcar_Tests)
|
||||
fabcar_Tests
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
# run byfn,eyfn tests
|
||||
byfn_eyfn_Tests() {
|
||||
|
||||
echo
|
||||
echo " ____ __ __ _____ _ _ _____ __ __ _____ _ _ "
|
||||
echo " | __ ) \ \ / / | ___| | \ | | | ____| \ \ / / | ___| | \ | | "
|
||||
echo " | _ \ \ V / | |_ | \| | _____ | _| \ V / | |_ | \| | "
|
||||
echo " | |_) | | | | _| | |\ | |_____| | |___ | | | _| | |\ | "
|
||||
echo " |____/ |_| |_| |_| \_| |_____| |_| |_| |_| \_| "
|
||||
|
||||
./byfn_eyfn.sh
|
||||
}
|
||||
# run fabcar tests
|
||||
fabcar_Tests() {
|
||||
|
||||
echo " #############################"
|
||||
echo "npm version ------> $(npm -v)"
|
||||
echo "node version ------> $(node -v)"
|
||||
echo " #############################"
|
||||
|
||||
echo
|
||||
echo " _____ _ ____ ____ _ ____ "
|
||||
echo " | ___| / \ | __ ) / ___| / \ | _ \ "
|
||||
echo " | |_ / _ \ | _ \ | | / _ \ | |_) | "
|
||||
echo " | _| / ___ \ | |_) | | |___ / ___ \ | _ < "
|
||||
echo " |_| /_/ \_\ |____/ \____| /_/ \_\ |_| \_\ "
|
||||
|
||||
./fabcar.sh
|
||||
}
|
||||
|
||||
Parse_Arguments $@
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
logs() {
|
||||
LOG_DIRECTORY=$WORKSPACE/fabcar/$1
|
||||
mkdir -p ${LOG_DIRECTORY}
|
||||
CONTAINER_LIST=$(docker ps -a --format '{{.Names}}')
|
||||
for CONTAINER in ${CONTAINER_LIST}; do
|
||||
docker logs ${CONTAINER} > ${LOG_DIRECTORY}/${CONTAINER}.log 2>&1
|
||||
done
|
||||
}
|
||||
|
||||
copy_logs() {
|
||||
|
||||
# Call logs function
|
||||
logs $2 $3
|
||||
|
||||
if [ $1 != 0 ]; then
|
||||
echo -e "\033[31m $2 test case is FAILED" "\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
cd $WORKSPACE/$BASE_DIR/fabcar || exit
|
||||
export PATH=gopath/src/github.com/hyperledger/fabric-samples/bin:$PATH
|
||||
|
||||
LANGUAGES="go java javascript typescript"
|
||||
for LANGUAGE in ${LANGUAGES}; do
|
||||
echo -e "\033[1m ${LANGUAGE} Test\033[0m"
|
||||
echo -e "\033[32m starting fabcar test (${LANGUAGE})" "\033[0m"
|
||||
# Start Fabric, and deploy the smart contract
|
||||
./startFabric.sh ${LANGUAGE}
|
||||
copy_logs $? fabcar-${LANGUAGE}
|
||||
# If an application exists for this language, test it
|
||||
if [ -d ${LANGUAGE} ]; then
|
||||
pushd ${LANGUAGE}
|
||||
if [ ${LANGUAGE} = "javascript" -o ${LANGUAGE} = "typescript" ]; then
|
||||
if [ ${LANGUAGE} = "javascript" ]; then
|
||||
COMMAND=node
|
||||
PREFIX=
|
||||
SUFFIX=.js
|
||||
npm install
|
||||
elif [ ${LANGUAGE} = "typescript" ]; then
|
||||
COMMAND=node
|
||||
PREFIX=dist/
|
||||
SUFFIX=.js
|
||||
npm install
|
||||
npm run build
|
||||
fi
|
||||
${COMMAND} ${PREFIX}enrollAdmin${SUFFIX}
|
||||
copy_logs $? fabcar-${LANGUAGE}-enrollAdmin
|
||||
${COMMAND} ${PREFIX}registerUser${SUFFIX}
|
||||
copy_logs $? fabcar-${LANGUAGE}-registerUser
|
||||
${COMMAND} ${PREFIX}query${SUFFIX}
|
||||
copy_logs $? fabcar-${LANGUAGE}-query
|
||||
${COMMAND} ${PREFIX}invoke${SUFFIX}
|
||||
copy_logs $? fabcar-${LANGUAGE}-invoke
|
||||
elif [ ${LANGUAGE} = "java" ]; then
|
||||
mvn test
|
||||
copy_logs $? fabcar-${LANGUAGE}
|
||||
else
|
||||
echo -e "\033[31m do not know how to handle ${LANGUAGE}" "\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
popd
|
||||
fi
|
||||
docker ps -aq | xargs docker rm -f
|
||||
docker rmi -f $(docker images -aq dev-*)
|
||||
docker volume prune -f
|
||||
docker network prune -f
|
||||
echo -e "\033[32m finished fabcar test (${LANGUAGE})" "\033[0m"
|
||||
done
|
||||
|
|
@ -497,7 +497,7 @@ while [[ $# -ge 1 ]] ; do
|
|||
shift
|
||||
;;
|
||||
-i )
|
||||
IMAGETAG=$(go env GOARCH)"-""$2"
|
||||
IMAGETAG="$2"
|
||||
shift
|
||||
;;
|
||||
-verbose )
|
||||
|
|
|
|||
Loading…
Reference in a new issue