-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
104 lines (100 loc) · 3.3 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
pipeline {
agent { node { label 'zOS' } }
environment {
projectClean = 'true'
DBBClean = 'false'
projectDelete = 'false'
Debug = 'false'
CollectionName = 'SampleApplication'
}
stages {
stage ('Start') {
steps {
// send to email
emailext (
subject: "STARTED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
body: """STARTED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'>
Check console output at;<a href='${env.BUILD_URL}'>${env.JOB_NAME} [${env.BUILD_NUMBER}]""",
recipientProviders: [[$class: 'DevelopersRecipientProvider']]
)
}
}
stage('Clean workspace') {
when {
expression {
env.projectClean.toBoolean()
}
}
steps {
sh 'printf "running conditional clean of workspace"'
cleanWs()
}
}
stage("CheckOut") {
steps {
checkout scm
}
}
stage('DBB clean collection') {
when {
expression {
env.DBBClean.toBoolean()
}
}
steps {
sh 'printf "running DBB delete collection"'
sh "export DBB_HOME=${env.DBB_HOME}"
sh "export DBB_CONF=${env.DBB_CONF}"
sh "${env.GROOVYZ_HOME}/groovyz --classpath .:${env.POLY_CLASSPATH} $WORKSPACE/build/build.groovy --clean --collection ${env.CollectionName}"
}
}
stage("Build-Debug") {
when {
expression { env.Debug.toBoolean()}
}
steps {
sh "export DBB_HOME=${env.DBB_HOME}"
sh "export DBB_CONF=${env.DBB_CONF}"
sh "${env.GROOVYZ_HOME}/groovyz --classpath .:${env.POLY_CLASSPATH} $WORKSPACE/build/build.groovy --debug --collection ${env.CollectionName}"
}
}
stage("Build") {
when {
expression { !env.Debug.toBoolean()}
}
steps {
sh "export DBB_HOME=${env.DBB_HOME}"
sh "export DBB_CONF=${env.DBB_CONF}"
sh "${env.GROOVYZ_HOME}/groovyz --classpath .:${env.POLY_CLASSPATH} $WORKSPACE/build/build.groovy --collection ${env.CollectionName}"
}
}
stage("Test") {
steps {
sh 'printf "\\Some tests execution here...\\e[0m\\n"'
}
}
stage("Deploy") {
steps {
sh 'printf "\\e[31m Deploy package...\\e[0m\\n"'
}
}
}
post {
success {
emailext (
attachLog: true, attachmentsPattern: '*.log',
subject: "SUCCESSFUL: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}",
recipientProviders: [developers(), requestor()],
)
}
failure {
emailext (
attachLog: true, attachmentsPattern: '*.log',
body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}",
recipientProviders: [developers(), requestor()],
subject: "Jenkins Build ${currentBuild.currentResult}: Job ${env.JOB_NAME}"
)
}
}
}