forked from jonnygovish/gallery
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsFile
More file actions
68 lines (62 loc) · 1.9 KB
/
JenkinsFile
File metadata and controls
68 lines (62 loc) · 1.9 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
pipeline {
agent any
tools {nodejs "nodejs"}
stages {
stage('Start') {
steps {
echo 'Build is starting'
}
}
stage('Clone Github Repository') {
steps {
git url: 'https://github.com/Tonzi254/gallery.git', branch: 'master'
}
}
stage('Get Latest Commit') {
steps {
sh '''
export COMMIT=$(git log --oneline | awk '{print $1}' | head -n 1)
echo $COMMIT
'''
}
}
stage('Install Dependencies') {
steps {
sh '''
npm install
'''
}
}
stage('Test') {
steps {
sh 'npm test'
}
}
stage('Deploy') {
steps {
sh 'curl -X POST https://api.render.com/deploy/srv-chj7117dvk4pootggvp0?key=Vlvq1vwGww4'
}
}
stage('End') {
steps {
echo 'Build is finished'
}
}
}
post {
success {
emailext to: "danteskilz@gmail.com",
subject: "JENKINS-NOTIFICATION build:${currentBuild.currentResult}: ${env.JOB_NAME}",
body: "${currentBuild.currentResult}: Job ${env.JOB_NAME}\nMore Info can be found here: ${env.BUILD_URL}",
attachLog: true,
compressLog: true
}
failure {
emailext to: "danteskilz@gmail.com",
subject: "JENKINS-NOTIFICATION build:${currentBuild.currentResult}: ${env.JOB_NAME}",
body: "${currentBuild.currentResult}: Job ${env.JOB_NAME}\nMore Info can be found here: ${env.BUILD_URL}",
attachLog: true,
compressLog: true
}
}
}