-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
76 lines (73 loc) · 2.07 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
pipeline {
agent any
stages {
stage('Checkout') {
steps {
echo "Checkout"
git 'https://github.com/NevenMoore/scf_devops_demo.git'
}
}
stage('Build') {
steps {
echo 'Building'
sh "pip install -r requirements.txt"
}
}
stage('Test') {
steps {
echo 'Testing'
script {
ret = sh(script: "scf native invoke -t ./template.yaml --no-event", returnStatus: true)
if (ret != 0) {
echo '[Test] Failed'
currentBuild.result = 'FAILURE'
return
}
}
}
}
stage('Deploy - Staging') {
steps {
echo 'Deploy - Staging'
}
}
stage('Sanity check') {
steps {
input "Does the staging environment look ok?"
}
}
stage('Deploy - Production') {
steps {
echo 'Deploy - Production'
script {
ret = sh(script: "scf package -t ./template.yaml", returnStatus: true)
if (ret != 0) {
echo '[Deploy] Failed'
currentBuild.result = 'FAILURE'
return
}
ret = sh(script: "scf deploy -t ./deploy.yaml -f", returnStatus: true)
if (ret != 0) {
echo '[Deploy] Failed'
currentBuild.result = 'FAILURE'
return
}
}
}
}
}
post {
success {
echo 'I succeeeded!'
}
unstable {
echo 'I am unstable :/'
}
failure {
echo 'I failed :('
}
changed {
echo 'Things were different before...'
}
}
}