-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
166 lines (153 loc) · 4.63 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
155
156
157
158
159
160
161
162
163
164
165
166
#!groovy
pipeline {
// agent defines where the pipeline will run.
agent {
label "${params.LABEL}"
}
environment {
NODE = "${env.NODE_NAME}"
GUILOCK = "ibex_gui_${NODE}"
}
triggers {
pollSCM('H/2 * * * *')
}
// The options directive is for configuration that applies to the whole job.
options {
buildDiscarder(logRotator(numToKeepStr:'10'))
disableConcurrentBuilds()
timestamps()
skipDefaultCheckout(true)
office365ConnectorWebhooks([[
name: "Office 365",
notifyBackToNormal: true,
startNotification: false,
notifyFailure: true,
notifySuccess: false,
notifyNotBuilt: false,
notifyAborted: false,
notifyRepeatedFailure: true,
notifyUnstable: true,
url: "${env.MSTEAMS_URL}"
]]
)
}
stages {
stage("Checkout") {
steps {
timeout(time: 2, unit: 'HOURS') {
retry(5) {
echo "Branch: ${env.BRANCH_NAME}"
checkout scm
}
}
}
}
stage("Dependencies") {
steps {
echo "Installing local genie python"
timeout(time: 1, unit: 'HOURS') {
bat """
call update_genie_python.bat ${env.WORKSPACE}\\Python3
if %errorlevel% neq 0 exit /b %errorlevel%
"""
}
}
}
stage("Build") {
steps {
script {
// env.BRANCH_NAME is only supplied to multi-branch pipeline jobs
if (env.BRANCH_NAME == null) {
env.BRANCH_NAME = ""
}
env.GIT_BRANCH = scm.branches[0].name
env.GIT_COMMIT = bat(returnStdout: true, script: '@git rev-parse HEAD').trim()
echo "git commit: ${env.GIT_COMMIT}"
echo "git branch: ${env.BRANCH_NAME} (${env.GIT_BRANCH})"
if (env.BRANCH_NAME.startsWith("Release")) {
env.IS_RELEASE = "YES"
env.IS_DEPLOY = "NO"
env.IS_E4 = "YES"
}
else if (env.GIT_BRANCH == "refs/heads/master_E3_maint") {
env.IS_RELEASE = "NO"
env.IS_DEPLOY = "YES"
env.IS_E4 = "NO"
}
else if (env.GIT_BRANCH == "refs/heads/master") {
env.IS_RELEASE = "NO"
env.IS_DEPLOY = "YES"
env.IS_E4 = "YES"
}
else {
env.IS_RELEASE = "NO"
env.IS_DEPLOY = "NO"
env.IS_E4 = "YES"
}
}
lock(resource: GUILOCK, inversePrecedence: false) {
timeout(time: 240, unit: 'MINUTES') {
bat """
cd build
set GIT_COMMIT=${env.GIT_COMMIT}
set GIT_BRANCH=${env.BRANCH_NAME}
set RELEASE=${env.IS_RELEASE}
set DEPLOY=${env.IS_DEPLOY}
jenkins_build.bat
"""
}
}
}
}
stage("OPI Checker") {
steps {
bat """
set PYTHON3=${env.WORKSPACE}\\Python3\\python.exe
set PYTHON_HOME=${env.WORKSPACE}\\Python3
%PYTHON3% .\\base\\uk.ac.stfc.isis.ibex.opis\\check_opi_format.py -strict -directory .\\base\\uk.ac.stfc.isis.ibex.opis
"""
}
}
stage("Checkstyle") {
steps {
archiveCheckstyleResults()
}
}
stage("Doxygen") {
steps {
bat '''
"C:\\Program Files\\doxygen\\bin\\doxygen.exe" build\\ibex_gui_doxy.config
'''
}
}
}
post {
always {
archiveArtifacts artifacts: 'build/*.log', caseSensitive: false
junit '**/surefire-reports/TEST-*.xml,**/test-reports/TEST-*.xml'
logParser ([
projectRulePath: 'parse_rules',
parsingRulesPath: '',
showGraphs: true,
unstableOnWarning: false,
useProjectRule: true,
])
}
cleanup {
echo "***"
echo "*** Any Office365connector Matched status FAILURE message below means"
echo "*** an earlier Jenkins step failed not the Office365connector itself"
echo "*** Search log file for ERROR to locate true cause"
echo "***"
}
}
}
def archiveCheckstyleResults() {
step([$class: "CheckStylePublisher",
canComputeNew: false,
defaultEncoding: "",
healthy: "",
pattern: "**/target/checkstyle-result.xml",
unHealthy: "",
usePreviousBuildAsReference: true])
}