forked from jonnygovish/gallery
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
74 lines (58 loc) · 1.74 KB
/
Jenkinsfile
File metadata and controls
74 lines (58 loc) · 1.74 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
// define slack notification colors
def COLOR_MAP = [
'FAILURE' : 'danger',
'SUCCESS' : 'good'
]
pipeline{
// define agents
agent any
// define tools
tools{
nodejs 'node'
}
// define stages
stages{
// stage 1
stage("clone git repo"){
steps{
git branch: 'master', url:'https://github.com/LukaLmelias/gallery.git'
}
}
// stage 2
stage("npm install"){
steps{
sh "rm -rf /var/jenkins_home/workspace/gallery-pipeline/node_modules" // remove some locked files
sh "npm install"
}
}
// stage 3
stage("npm test"){
steps{
sh "npm test"
}
}
// stage 4
stage("Deploy to render"){
steps{
sh "curl ${env.RENDER_WEBHOOK}"
}
}
}
// post to slack on success/failure
post {
always {
slackSend(
channel: '#luka_ip1',
color: COLOR_MAP[currentBuild.currentResult],
message: "*${currentBuild.currentResult}:* job ${env.JOB_NAME} \n build ${env.BUILD_NUMBER} \n more info at (<${env.BUILD_URL}|Open>) "
)
}
//"Build deployed successfully "- ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)
// // post to slack on Failure
// post {
// failure {
// slackSend failOnError: true message: "Build failed - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)"
// }
// }
}
}