-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
91 lines (79 loc) · 2.44 KB
/
Copy pathJenkinsfile
File metadata and controls
91 lines (79 loc) · 2.44 KB
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
pipeline {
agent any
environment {
JOB_DESC = 'example_mail'
PIPELINE = "https://jenkins.example.com/blue/organizations/jenkins/${env.JOB_DESC}/detail/${env.JOB_BASE_NAME}/${env.BUILD_NUMBER}/pipeline"
}
options {
disableConcurrentBuilds()
timestamps()
timeout(time: 5, unit: 'MINUTES')
}
stages {
// notify slack of build-number, job and branch
stage('notify') {
steps {
sh 'echo $BRANCH_NAME'
slackSend(color: '#0F1DBC', message: "[${env.BUILD_NUMBER}] *STARTED:* Job `${env.JOB_DESC}` Branch `${env.GIT_BRANCH}` ( <${env.BUILD_URL}|Open> ) - ( <${env.PIPELINE}|BlueOcean> )")
}
}
// pre-converge stage
stage('pre-converge') {
steps {
echo 'rubocop style linting'
sh '''
eval "$(chef shell-init bash)"
rubocop
'''
echo 'foodcritic compliance testing'
sh '''
eval "$(chef shell-init bash)"
foodcritic .
'''
echo 'rspec unit testing'
echo 'TODO: implement rspec unit-testing'
// sh '''
// eval "$(chef shell-init bash)"
// rspec
// '''
}
}
// converge stage
stage('converge') {
steps {
echo 'kitchen converge cookbook'
}
}
// post-converge stage
stage('post-converge') {
steps {
echo 'do integration testing with the machine'
}
}
// archive pipeline results
stage('archive results') {
steps {
echo 'archive artefacts to somewhere'
}
}
}
// post-build actions - cleanup, notify and document
post {
// Always runs. And it runs before any of the other post conditions.
always {
echo 'report on rspec findings'
echo 'TODO: unit-tests'
// junit 'results.xml'
echo 'wipe out the workspace before finish'
// deleteDir()
}
success {
echo 'TODO: notify JIRA / Confluence for comments on the build of the issue'
slackSend(color: '#00FF3B', message: "[${env.BUILD_NUMBER}] *SUCCESS:* Job `${env.JOB_DESC}` Branch `${env.GIT_BRANCH}` ( <${env.BUILD_URL}|Open> ) - ( <${env.PIPELINE}|BlueOcean> )")
}
failure {
echo 'TODO: notify JIRA / Confluence for comments on the build of the issue'
slackSend(color: '#FF0000', message: "[${env.BUILD_NUMBER}] *FAILED:* Job `${env.JOB_DESC}` Branch `${env.GIT_BRANCH}` ( <${env.BUILD_URL}|Open> ) - ( <${env.PIPELINE}|BlueOcean> )")
}
}
}