-
Notifications
You must be signed in to change notification settings - Fork 90
/
Jenkinsfile
154 lines (142 loc) · 5.81 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/usr/bin/env groovy
node {
parameters
{
string(name: 'BRANCH_PASSED_OVER', defaultValue: '${env.BRANCH_NAME}', description: 'pass branch value')
}
stage('Pull changes') {
properties([[$class: 'CopyArtifactPermissionProperty', projectNames: '*']])
sh '''
if [ -d .git ]; then
git clean -dfx
fi;
'''
checkout scm
sh '''
rm -rf B_L072Z_LRWAN1
rm -rf NUCLEO_L073RZ
rm -rf EZR32LG_WSTK6200A
rm -rf cortus_fpga
mkdir B_L072Z_LRWAN1
mkdir NUCLEO_L073RZ
mkdir EZR32LG_WSTK6200A
mkdir cortus_fpga
'''
}
stage('Build B_L072Z_LRWAN1 platform') {
dir('B_L072Z_LRWAN1') {
sh 'mkdir build'
dir('build') {
try {
sh '''
platform="B_L072Z_LRWAN1"
toolchain_file="../../stack/cmake/toolchains/gcc-arm-embedded.cmake"
toolchain_dir="/opt/gcc-arm-none-eabi-7-2017-q4-major"
cmake ../../stack/ -DAPP_GATEWAY=y -DAPP_MODEM=y -DAPP_SENSOR_PUSH=y -DPLATFORM=$platform -DTOOLCHAIN_DIR=$toolchain_dir -DCMAKE_TOOLCHAIN_FILE=$toolchain_file
make
'''
setBuildStatus("B_L072Z_LRWAN1","Build","SUCCESS")
echo 'B_L072Z_LRWAN1 success '
}
catch (exc)
{
setBuildStatus("B_L072Z_LRWAN1","Build","FAILURE")
echo 'B_L072Z_LRWAN1 failed'
currentBuild.result = 'FAILURE'
}
}
}
}
stage('Build NUCLEO_L073RZ platform') {
dir('NUCLEO_L073RZ') {
sh 'mkdir build'
dir('build') {
try {
sh '''
platform="NUCLEO_L073RZ"
toolchain_file="../../stack/cmake/toolchains/gcc-arm-embedded.cmake"
toolchain_dir="/opt/gcc-arm-none-eabi-7-2017-q4-major"
cmake ../../stack/ -DAPP_GATEWAY=y -DAPP_MODEM=y -DAPP_SENSOR_PUSH=y -DPLATFORM=$platform -DTOOLCHAIN_DIR=$toolchain_dir -DCMAKE_TOOLCHAIN_FILE=$toolchain_file
make
'''
setBuildStatus("NUCLEO_L073RZ","Build","SUCCESS")
echo 'NUCLEO_L073RZ success '
}
catch (exc)
{
setBuildStatus("NUCLEO_L073RZ","Build","FAILURE")
echo 'NUCLEO_L073RZ failed'
currentBuild.result = 'FAILURE'
}
}
}
}
// stage('Build EZR32LG_WSTK6200A platform') {
// dir('EZR32LG_WSTK6200A') {
// sh 'mkdir build'
// dir('build') {
// try {
// sh '''
// platform="EZR32LG_WSTK6200A"
// toolchain_file="../../stack/cmake/toolchains/gcc-arm-embedded.cmake"
// toolchain_dir="/opt/gcc-arm-none-eabi-7-2017-q4-major"
// cmake ../../stack/ -DAPP_GATEWAY=y -DAPP_MODEM=y -DAPP_SENSOR_PUSH=y -DPLATFORM=$platform -DTOOLCHAIN_DIR=$toolchain_dir -DCMAKE_TOOLCHAIN_FILE=$toolchain_file
// make
// '''
// setBuildStatus("EZR32LG_WSTK6200A","Build","SUCCESS")
// echo 'EZR32LG_WSTK6200A success'
// }
// catch (exc)
// {
// setBuildStatus("EZR32LG_WSTK6200A","Build","FAILURE")
// echo 'EZR32LG_WSTK6200A failed'
// currentBuild.result = 'FAILURE'
// }
// }
// }
// }
stage('Build cortus_fpga platform') {
dir('cortus_fpga') {
sh 'mkdir build'
dir('build') {
try{
sh '''
platform="cortus_fpga"
toolchain_dir="/opt/cortus"
toolchain_file="../../stack/cmake/toolchains/aps-gcc.cmake"
cmake ../../stack/ -DAPP_GATEWAY=y -DAPP_MODEM=y -DAPP_SENSOR_PUSH=y -DPLATFORM=$platform -DTOOLCHAIN_DIR=$toolchain_dir -DCMAKE_TOOLCHAIN_FILE=$toolchain_file
make
'''
setBuildStatus("cortus_fpga","Build","SUCCESS")
echo 'cortus_fpga success'
}
catch (exc)
{
setBuildStatus("cortus_fpga","Build","FAILURE")
echo 'cortus_fpga failed'
currentBuild.result = 'FAILURE'
}
}
}
}
// stage ('Save Artifacts'){
// archiveArtifacts '**'
// }
// stage ('Flash B_L072Z_LRWAN1'){
// build job: 'FlashRPI_P_B_L072Z_LRWAN1_param', wait: false, parameters: [string(name: 'PASS_BRANCH_NAME', value: env.BRANCH_NAME)]
// }
}
def setBuildStatus(String context,String message, String state) {
step([
$class: "GitHubCommitStatusSetter",
reposSource: [$class: "ManuallyEnteredRepositorySource", url: 'https://github.com/MOSAIC-LoPoW/dash7-ap-open-source-stack'],
contextSource: [$class: "ManuallyEnteredCommitContextSource", context: context],
errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", result: "UNSTABLE"]],
statusResultSource: [ $class: "ConditionalStatusResultSource", results: [[$class: "AnyBuildResult", message: message, state: state]] ]
]);
def color = "danger"
if(state == 'SUCCESS')
color = "good"
def msg = "Build ${context} ${state} (${env.BUILD_NUMBER})"
slackSend(color: color, message: msg)
}