forked from jvm-bloggers/jvm-bloggers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
75 lines (65 loc) · 2.1 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
#!/usr/bin/env groovy
properties(
[
pipelineTriggers([
[$class: 'GitHubPushTrigger']
]),
overrideIndexTriggers(false),
disableConcurrentBuilds(),
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '10'))
]
)
node {
try {
timestamps {
ansiColor('xterm') {
stage ('Checkout') {
checkout scm
}
stage ('Test') {
sh """
echo "Building the project"
./gradlew clean build
"""
}
if (env.BRANCH_NAME.equals('production')) {
stage ('Build Docker image') {
sh """
echo "Build Docker image"
"""
}
stage ('Push image to DockerHub') {
sh """
echo "Push image to DockerHub"
"""
}
stage ('Deploy to production') {
sh """
echo "Deploy to production"
"""
}
stage ('Verify health checks') {
sh """
echo "Verify health checks"
"""
}
}
}
}
} catch (Exception e) {
currentBuild.result = "FAILED"
throw e
} finally {
junit '**/build/test-results/**/TEST-*.xml'
if (currentBuild.currentResult == "SUCCESS") {
sh """
echo "Notyfying Codecov after successful build"
bash <(curl -s https://codecov.io/bash)
"""
sh """
echo "Notyfying Sputnik after successful build"
python <(curl -s https://raw.githubusercontent.com/TouK/sputnik-ci/master/sputnik-ci.py)
"""
}
}
}