-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
97 lines (91 loc) · 3.12 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// Copyright IBM Corp All Rights Reserved
//
// SPDX-License-Identifier: Apache-2.0
//
// Pipeline script for fabric-samples
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"
def failure_stage = "none"
// delete working directory
deleteDir()
stage("Fetch Patchset") { // fetch gerrit refspec on latest commit
try {
dir("${ROOTDIR}"){
sh '''
[ -e gopath/src/github.com/hyperledger/fabric-samples ] || mkdir -p $PROJECT_DIR
cd $PROJECT_DIR
git clone git://cloud.hyperledger.org/mirror/fabric-samples && cd fabric-samples
git fetch origin "$GERRIT_REFSPEC" && git checkout FETCH_HEAD
'''
}
}
catch (err) {
failure_stage = "Fetch patchset"
throw err
}
}
// clean environment and get env data
stage("Clean Environment - Get Env Info") {
try {
dir("${ROOTDIR}/$PROJECT_DIR/fabric-samples/scripts/Jenkins_Scripts") {
sh './CI_Script.sh --clean_Environment --env_Info'
}
}
catch (err) {
failure_stage = "Clean Environment - Get Env Info"
throw err
}
}
// Pull Fabric Images
stage("Pull third_party images") {
try {
dir("${ROOTDIR}/$PROJECT_DIR/fabric-samples/scripts/Jenkins_Scripts") {
sh './CI_Script.sh --pull_Thirdparty_Images'
}
}
catch (err) {
failure_stage = "Pull third_party docker images"
throw err
}
}
// Pull Fabric Images
stage("Pull fabric images") {
try {
dir("${ROOTDIR}/$PROJECT_DIR/fabric-samples/scripts/Jenkins_Scripts") {
sh './CI_Script.sh --pull_Fabric_Images'
}
}
catch (err) {
failure_stage = "Pull fabric docker images"
throw err
}
}
// Pull Fabric-ca
stage("Pull fabric-ca images") {
try {
dir("${ROOTDIR}/$PROJECT_DIR/fabric-samples/scripts/Jenkins_Scripts") {
sh './CI_Script.sh --pull_Fabric_CA_Image'
}
}
catch (err) {
failure_stage = "Pull fabric-ca docker image"
throw err
}
}
// Run byfn, eyfn tests (default, custom channel, couchdb, nodejs chaincode, fabric-ca samples)
stage("Run byfn_eyfn Tests") {
try {
dir("${ROOTDIR}/$PROJECT_DIR/fabric-samples/scripts/Jenkins_Scripts") {
sh './CI_Script.sh --byfn_eyfn_Tests'
}
}
catch (err) {
failure_stage = "byfn_eyfn_Tests"
throw err
}
}
stage("Archive Build artifacts") {
archiveArtifacts artifacts: '**/*.log'
}
}