Skip to content

Commit

Permalink
FAB-12617 Update pipeline scripts
Browse files Browse the repository at this point in the history
Change-Id: I2c421d6e60086e504ae25000f7397c7021540299
Signed-off-by: rameshthoomu <[email protected]>
  • Loading branch information
rameshthoomu committed Oct 26, 2018
1 parent 1973f7b commit 5e99372
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 16 deletions.
19 changes: 16 additions & 3 deletions Jenkinsfile.x
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ node ('hyp-x') { // trigger build on x86_64 node
def ROOTDIR = pwd() // workspace dir (/w/workspace/<job_name>
env.NODE_VER = "8.11.3"
env.GO_VER = "1.11.1"
env.STABLE_TAG = "1.4.0-stable"
env.PROJECT_DIR = "gopath/src/github.com/hyperledger"
env.GOPATH = "$WORKSPACE/gopath"
env.PATH = "$GOPATH/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:~/npm/bin:/home/jenkins/.nvm/versions/node/v${NODE_VER}/bin:$PATH"
Expand Down Expand Up @@ -59,21 +60,23 @@ node ('hyp-x') { // trigger build on x86_64 node
}
catch (err) {
failure_stage = "Pull couchdb docker image"
currentBuild.result = 'FAILURE'
throw err
}
}
}

// Pull Docker Images
// Pull fabric,fabric-ca and Javaenv
stage("Pull Docker images") {
wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'xterm']) {
try {
dir("${ROOTDIR}/$PROJECT_DIR/fabric-sdk-node/scripts/Jenkins_Scripts") {
sh './CI_Script.sh --pull_Fabric_Images'
sh './CI_Script.sh --pull_Docker_Images'
}
}
catch (err) {
failure_stage = "Pull docker images"
currentBuild.result = 'FAILURE'
throw err
}
}
Expand All @@ -89,6 +92,7 @@ node ('hyp-x') { // trigger build on x86_64 node
}
catch (err) {
failure_stage = "sdk_E2e_Tests"
currentBuild.result = 'FAILURE'
throw err
}
}
Expand All @@ -111,7 +115,12 @@ if (env.GERRIT_EVENT_TYPE == "change-merged") {
} finally { // Code for coverage report
junit '**/cobertura-coverage.xml'
step([$class: 'CoberturaPublisher', autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: '**/cobertura-coverage.xml', failUnhealthy: false, failUnstable: false, maxNumberOfBuilds: 0, onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false])
archiveArtifacts artifacts: '**/*.log'
archiveArtifacts allowEmptyArchive: true, artifacts: '**/*.log'
if (env.GERRIT_EVENT_TYPE == 'change-merged') {
if (currentBuild.result == 'FAILURE') { // Other values: SUCCESS, UNSTABLE
rocketSend channel: 'jenkins-robot', message: "Build Notification - STATUS: ${currentBuild.result} - BRANCH: ${env.GERRIT_BRANCH} - PROJECT: ${env.PROJECT} - (<${env.BUILD_URL}|Open>)"
}
}
} // finally block end here
} // timestamps end here
} // node block end here
Expand All @@ -120,15 +129,18 @@ def unstableNpm() {
def ROOTDIR = pwd()
// Publish unstable npm modules after successful merge
stage("Publish Unstable npm modules") {
wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'xterm']) {
try {
dir("${ROOTDIR}/$PROJECT_DIR/fabric-sdk-node/scripts/Jenkins_Scripts") {
sh './CI_Script.sh --publish_Unstable'
}
}
catch (err) {
failure_stage = "publish_Unstable"
currentBuild.result = 'FAILURE'
throw err
}
}
}
}

Expand All @@ -143,6 +155,7 @@ def ROOTDIR = pwd()
}
catch (err) {
failure_stage = "publish_Api_Docs"
currentBuild.result = 'FAILURE'
throw err
}
}
Expand Down
23 changes: 15 additions & 8 deletions Jenkinsfile.z
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ node('hyp-z') {
def ROOTDIR = pwd() // workspace dir (/w/workspace/<job_name>
env.NODE_VER = "8.11.3"
env.GO_VER = "1.11.1"
env.STABLE_TAG = "1.4.0-stable"
env.PROJECT_DIR = "gopath/src/github.com/hyperledger"
env.NODE_VER = "8.11.3"
env.GO_VER = "1.11.1"
env.GOPATH = "$WORKSPACE/gopath"
env.PATH = "$GOPATH/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:~/npm/bin:/home/jenkins/.nvm/versions/node/v${NODE_VER}/bin:$PATH"
env.GOROOT = "/opt/go/go${GO_VER}.linux.s390x"
Expand All @@ -33,6 +32,7 @@ node('hyp-z') {
}
catch (err) {
failure_stage = "Fetch patchset"
currentBuild.result = 'FAILURE'
throw err
}
}
Expand All @@ -47,6 +47,7 @@ node('hyp-z') {
}
catch (err) {
failure_stage = "Clean Environment - Get Env Info"
currentBuild.result = 'FAILURE'
throw err
}
}
Expand All @@ -60,21 +61,23 @@ node('hyp-z') {
}
catch (err) {
failure_stage = "Pull couchdb docker image"
currentBuild.result = 'FAILURE'
throw err
}
}
}

// Pull Docker Images
// Pull fabric, fabric-ca and Javaenv Docker Images
stage("Pull Docker images") {
wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'xterm']) {
try {
dir("${ROOTDIR}/$PROJECT_DIR/fabric-sdk-node/scripts/Jenkins_Scripts") {
sh './CI_Script.sh --pull_Fabric_Images'
sh './CI_Script.sh --pull_Docker_Images'
}
}
catch (err) {
failure_stage = "Pull docker images"
currentBuild.result = 'FAILURE'
throw err
}
}
Expand All @@ -90,14 +93,18 @@ node('hyp-z') {
}
catch (err) {
failure_stage = "sdk_E2e_Tests"
currentBuild.result = 'FAILURE'
throw err
}
}
}
} finally { // Code for coverage report
junit '**/cobertura-coverage.xml'
step([$class: 'CoberturaPublisher', autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: '**/cobertura-coverage.xml', failUnhealthy: false, failUnstable: false, maxNumberOfBuilds: 0, onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false])
archiveArtifacts artifacts: '**/*.log'
} finally { // log artifacts
archiveArtifacts allowEmptyArchive: true, artifacts: '**/*.log'
if (env.GERRIT_EVENT_TYPE == 'change-merged') {
if (currentBuild.result == 'FAILURE') { // Other values: SUCCESS, UNSTABLE
rocketSend channel: 'jenkins-robot', message: "Build Notification - STATUS: ${currentBuild.result} - BRANCH: ${env.GERRIT_BRANCH} - PROJECT: ${env.PROJECT} - (<${env.BUILD_URL}|Open>)"
}
}
} // finally block end here
} // timestamps end here
} // node block end here
9 changes: 4 additions & 5 deletions scripts/Jenkins_Scripts/CI_Script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

export BASE_FOLDER=$WORKSPACE/gopath/src/github.com/hyperledger
# Modify this when change the image tag
export STABLE_TAG=1.4.0-stable
export NEXUS_URL=nexus3.hyperledger.org:10001
export ORG_NAME="hyperledger/fabric"

Expand Down Expand Up @@ -37,8 +36,8 @@ Parse_Arguments() {
--env_Info)
env_Info
;;
--pull_Fabric_Images)
pull_Fabric_Images
--pull_Docker_Images)
pull_Docker_Images
;;
--clean_Environment)
clean_Environment
Expand Down Expand Up @@ -132,7 +131,7 @@ pull_Thirdparty_Images() {
echo
docker pull $ORG_NAME-$IMAGES:$BASE_IMAGE_TAG > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e "\033[31m FAILED to download docker images" "\033[0m"
echo -e "\033[31m FAILED to pull docker images" "\033[0m"
exit 1
fi
docker tag $ORG_NAME-$IMAGES:$BASE_IMAGE_TAG $ORG_NAME-$IMAGES
Expand All @@ -147,7 +146,7 @@ pull_Docker_Images() {
echo
docker pull $NEXUS_URL/$ORG_NAME-$IMAGES:$STABLE_TAG > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e "\033[31m FAILED to download docker images" "\033[0m"
echo -e "\033[31m FAILED to pull docker images" "\033[0m"
exit 1
fi
docker tag $NEXUS_URL/$ORG_NAME-$IMAGES:$STABLE_TAG $ORG_NAME-$IMAGES
Expand Down

0 comments on commit 5e99372

Please sign in to comment.