Skip to content
This repository has been archived by the owner on Dec 2, 2021. It is now read-only.

Commit

Permalink
FAB-12326 Update CI script to install nodejs
Browse files Browse the repository at this point in the history
Add function to install nodejs in Jenkins pipeline before
run the integration tests. Also, update the nvm version to
0.33.11

Change-Id: I8c4ec541dbd7e1ab1addee9f9de7adec7329749a
Signed-off-by: rameshthoomu <rameshbabu.thoomu@gmail.com>
  • Loading branch information
rameshthoomu committed Oct 12, 2018
1 parent 7ce40d3 commit 0846767
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
node ('hyp-x') { // trigger build on x86_64 node
def ROOTDIR = pwd() // workspace dir (/w/workspace/<job_name>
env.PROJECT_DIR = "gopath/src/github.com/hyperledger"
env.NODE_VER = "8.11.3"
env.GO_VER = "1.10.4"
env.GOPATH = "$WORKSPACE/gopath"
env.JAVA_HOME = "/usr/lib/jvm/java-1.8.0-openjdk-amd64"
env.PATH = "$GOPATH/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:~/npm/bin:/home/jenkins/.nvm/versions/node/v6.9.5/bin:/home/jenkins/.nvm/versions/node/v8.9.4/bin:$PATH"
env.GOROOT = "/opt/go/go1.10.linux.amd64"
env.PATH = "$GOPATH/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:~/npm/bin:/home/jenkins/.nvm/versions/node/${NODE_VER}/bin:$PATH"
env.GOROOT = "/opt/go/go${GO_VER}.linux.amd64"
env.PATH = "$GOROOT/bin:$PATH"

def failure_stage = "none"
Expand Down Expand Up @@ -78,8 +80,11 @@ node ('hyp-x') { // trigger build on x86_64 node
// Run integration tests (e2e tests)
stage("Integration-Tests") {
try {
dir("${ROOTDIR}/$PROJECT_DIR/fabric-chaincode-evm") {
dir("${ROOTDIR}/$PROJECT_DIR/fabric-chaincode-evm/scripts/jenkins_scripts") {
sh '''
echo "-------> Install NodeJs"
./CI_Script.sh --install_Node
cd ../..
echo "-------> Run integration-tests"
make integration-test
'''
Expand Down
23 changes: 23 additions & 0 deletions scripts/jenkins_scripts/CI_Script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Parse_Arguments() {
--clean_Environment)
clean_Environment
;;
--install_Node)
install_Node
;;
esac
shift
done
Expand Down Expand Up @@ -66,6 +69,26 @@ clearContainers
removeUnwantedImages
}

install_Node() {

# Install nvm to install multi node versions
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
# shellcheck source=/dev/null
export NVM_DIR="$HOME/.nvm"
# shellcheck source=/dev/null
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm

echo "------> Install NodeJS"
# This also depends on the fabric-baseimage. Make sure you modify there as well.
echo "------> Use $NODE_VER for >=release-1.1 branches"
nvm install $NODE_VER || true
# use nodejs version
nvm use --delete-prefix v$NODE_VER --silent

echo "npm version ------> $(npm -v)"
echo "node version ------> $(node -v)"
}

env_Info() {
# This function prints system info

Expand Down

0 comments on commit 0846767

Please sign in to comment.