fabric-samples/scripts/Jenkins_Scripts/byfn_eyfn.sh
rameshthoomu e95210e9bc FAB-10074 CI Script for pipeline project type
This patch supports Jenkins CI pipeline project type for master branch.

Script will pull docker images (1.2.0-stable) and binaries from Nexus
and run byfn and eyfn tests. The pipeline script supports only master
branch and release branches supports regular freestyle flow.

Change-Id: I85938f66b588b2e37a2a12d4941672632d52c8dd
Signed-off-by: rameshthoomu <rameshbabu.thoomu@gmail.com>
2018-06-11 12:36:12 -04:00

63 lines
2.4 KiB
Bash
Executable file

#!/bin/bash
#
# Copyright IBM Corp All Rights Reserved
#
# SPDX-License-Identifier: Apache-2.0
#
ARCH=$(dpkg --print-architecture)
echo "-----------> ARCH" $ARCH
MARCH=$(uname -s|tr '[:upper:]' '[:lower:]')
echo "-----------> MARCH" $MARCH
MVN_METADATA=$(echo "https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric-stable/maven-metadata.xml")
curl -L "$MVN_METADATA" > maven-metadata.xml
RELEASE_TAG=$(cat maven-metadata.xml | grep release)
COMMIT=$(echo $RELEASE_TAG | awk -F - '{ print $4 }' | cut -d "<" -f1)
VERSION=1.2.0
echo "-----------> BASE_VERSION = $VERSION"
cd $BASE_FOLDER/fabric-samples || exit
curl https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric-stable/$MARCH-$ARCH.$VERSION-stable-$COMMIT/hyperledger-fabric-stable-$MARCH-$ARCH.$VERSION-stable-$COMMIT.tar.gz | tar xz
cd first-network || exit
export PATH=gopath/src/github.com/hyperledger/fabric-samples/bin:$PATH
err_Check() {
if [ $1 != 0 ]; then
echo "Error: -----------> $2 test case failed"
exit 1
fi
}
echo "############## BYFN,EYFN DEFAULT CHANNEL TEST ###################"
echo "#################################################################"
echo y | ./byfn.sh -m down
echo y | ./byfn.sh -m up -t 60
err_Check $? default-channel
echo y | ./eyfn.sh -m up -t 60
err_Check $? default-channel
echo y | ./eyfn.sh -m down
echo
echo "############### BYFN,EYFN CUSTOM CHANNEL WITH COUCHDB TEST ##############"
echo "#########################################################################"
echo y | ./byfn.sh -m up -c custom-channel-couchdb -s couchdb -t 60
err_check $? custom-channel-couch couchdb
echo y | ./eyfn.sh -m up -c custom-channel-couchdb -s couchdb -t 60
err_check $? custom-channel-couch
echo y | ./eyfn.sh -m down
echo
echo "############### BYFN,EYFN WITH NODE Chaincode. TEST ################"
echo "####################################################################"
echo y | ./byfn.sh -m up -l node -t 60
err_check $? default-channel-node
echo y | ./eyfn.sh -m up -l node -t 60
err_check $? default-channel-node
echo y | ./eyfn.sh -m down
echo "############### FABRIC-CA SAMPLES TEST ########################"
echo "###############################################################"
cd $WORKSPACE/gopath/src/github.com/hyperledger/fabric-samples/fabric-ca
./start.sh
err_Check $? fabric-ca
./stop.sh