-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
88 lines (79 loc) · 2.51 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
#!groovy
pipeline {
// agent defines where the pipeline will run.
agent {
label {
label "JSON_Bourne"
// Use custom workspace to avoid issue with long filepaths on Win32
//customWorkspace "C:/JSON_Bourne/${env.BRANCH_NAME}"
}
}
triggers {
pollSCM('H/2 * * * *')
}
stages {
stage("Checkout") {
steps {
echo "Branch: ${env.BRANCH_NAME}"
checkout scm
}
}
stage("Build") {
steps {
echo "Build Number: ${env.BUILD_NUMBER}"
script {
env.GIT_COMMIT = bat(returnStdout: true, script: '@git rev-parse HEAD').trim()
env.GIT_BRANCH = bat(returnStdout: true, script: '@git rev-parse --abbrev-ref HEAD').trim()
echo "git commit: ${env.GIT_COMMIT}"
echo "git branch: ${env.BRANCH_NAME} ${env.GIT_BRANCH}"
if (env.BRANCH_NAME != null && env.BRANCH_NAME.startsWith("Release")) {
env.IS_RELEASE = "YES"
env.RELEASE_VERSION = "${env.BRANCH_NAME}".replace('Release_', '')
echo "release version: ${env.RELEASE_VERSION}"
}
else {
env.IS_RELEASE = "NO"
env.RELEASE_VERSION = ""
}
}
bat """
set BUILD_NUMBER=${env.BUILD_NUMBER}
set GIT_COMMIT=${env.GIT_COMMIT}
set RELEASE_BRANCH=${env.RELEASE_VERSION}
set RELEASE=${env.IS_RELEASE}
call build/update_genie_python.bat
if %errorlevel% neq 0 (
@echo ERROR: Cannot install clean genie_python
goto ERROR
)
C:/Instrument/Apps/Python3/python.exe run_tests.py || echo "running tests failed."
"""
}
}
stage("Unit Test Results") {
steps {
junit "test-reports/**/*.xml"
}
}
}
post {
failure {
step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: '[email protected]', sendToIndividuals: true])
}
always {
logParser ([
projectRulePath: 'parse_rules',
parsingRulesPath: '',
showGraphs: true,
unstableOnWarning: false,
useProjectRule: true,
])
}
}
// The options directive is for configuration that applies to the whole job.
options {
buildDiscarder(logRotator(numToKeepStr:'5', daysToKeepStr: '7'))
timeout(time: 60, unit: 'MINUTES')
disableConcurrentBuilds()
}
}