forked from apache/incubator-retired-edgent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
122 lines (104 loc) · 4.65 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
#!groovy
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
node('ubuntu') {
currentBuild.result = "SUCCESS"
echo 'Building Branch: ' + env.BRANCH_NAME
// Setup the required environment variables.
def mvnHome = "${tool 'Maven 3 (latest)'}"
env.JAVA_HOME="${tool 'JDK 1.8 (latest)'}"
env.PATH="${env.JAVA_HOME}/bin:${env.PATH}"
// Make sure the feature branches don't change the SNAPSHOTS in Nexus.
def mavenGoal = "install"
def mavenLocalRepo = ""
if(env.BRANCH_NAME == 'develop') {
mavenGoal = "sonar:sonar deploy"
} else {
mavenLocalRepo = "-Dmaven.repo.local=${env.WORKSPACE}/.repository"
}
def mavenFailureMode = "" // consider "--fail-at-end"? Odd ordering side effects?
try {
/*stage ('Cleanup') {
echo 'Cleaning up the workspace'
deleteDir()
}*/
stage ('Checkout') {
echo 'Checking out branch ' + env.BRANCH_NAME
checkout scm
}
stage ('Clean') {
echo 'Cleaning Edgent'
sh "${mvnHome}/bin/mvn ${mavenLocalRepo} -Pplatform-android,platform-java7,distribution clean"
}
stage ('Build Edgent') {
echo 'Building Edgent'
sh "${mvnHome}/bin/mvn ${mavenFailureMode} ${mavenLocalRepo} -Pplatform-android,platform-java7,distribution,toolchain -Djava8.home=${env.JAVA_HOME} -Dedgent.build.ci=true ${mavenGoal}"
}
stage ('Build Site') {
if(env.BRANCH_NAME == 'develop') {
echo 'Building Site'
sh "${mvnHome}/bin/mvn ${mavenLocalRepo} site site:stage"
} else {
echo 'Building Site (skipped for non develop branch)'
}
}
/* ========================== TODO figure out what to do with samples now in a separate repo
stage ('Build Samples') {
echo 'Building samples'
sh "cd samples; ${mvnHome}/bin/mvn ${mavenFailureMode} ${mavenLocalRepo} clean package"
sh "cd samples/topology; ./run-sample.sh HelloEdgent"
sh "cd samples; ${mvnHome}/bin/mvn ${mavenFailureMode} ${mavenLocalRepo} -Pplatform-java7 clean package"
sh "cd samples/topology; ./run-sample.sh HelloEdgent"
}
stage ('Build Templates') {
echo 'Building templates'
sh "cd samples/template; ${mvnHome}/bin/mvn ${mavenFailureMode} ${mavenLocalRepo} clean package; ./app-run.sh"
sh "cd samples/template; ${mvnHome}/bin/mvn ${mavenFailureMode} ${mavenLocalRepo} -Pplatform-java7 clean package; ./app-run.sh"
sh "cd samples/template; ${mvnHome}/bin/mvn ${mavenFailureMode} ${mavenLocalRepo} -Pplatform-android clean package; ./app-run.sh"
}
========================== */
/* There seems to be a problem with this (Here the output of the build log):
Verifying get-edgent-jars
[Pipeline] sh
[edgent-pipeline_develop-JN4DHO6BQV4SCTGBDJEOL4ZIC6T36DGONHH3VGS4DCDBO6UXH4MA] Running shell script
+ cd samples/get-edgent-jars-project
+ ./get-edgent-jars.sh
./get-edgent-jars.sh: 111: [: java8: unexpected operator
./get-edgent-jars.sh: 118: ./get-edgent-jars.sh: Syntax error: "(" unexpected
*/
/*stage ('Verify get-engent-jars') {
if(env.BRANCH_NAME == 'develop') {
echo 'Verifying get-edgent-jars'
sh "cd samples/get-edgent-jars-project; ./get-edgent-jars.sh"
} else {
echo 'Verifying get-edgent-jars (skipped for non develop branch)'
}
}*/
}
catch (err) {
currentBuild.result = "FAILURE"
/* mail body: "project build error is here: ${env.BUILD_URL}" ,
from: '[email protected]',
replyTo: '[email protected]',
subject: 'Autobuild for Branch ' env.BRANCH_NAME
to: '[email protected]'
*/
throw err
}
}