forked from lfs261/example-voting-app
-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathJenkinsfile
More file actions
80 lines (72 loc) · 1.68 KB
/
Jenkinsfile
File metadata and controls
80 lines (72 loc) · 1.68 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
pipeline {
agent none
stages{
stage('Vote Build'){
agent{
docker{
image 'python:2.7.16-slim'
args '--user root'
}
}
when{
changeset "**/vote/**"
}
steps{
echo 'Compiling vote app'
dir('vote'){
sh 'pip install -r requirements.txt'
}
}
}
stage('Vote UT'){
agent{
docker{
image 'python:2.7.16-slim'
args '--user root'
}
}
when{
changeset "**/vote/**"
}
steps{
echo 'Running Unit Tests on vote app'
dir('vote'){
sh 'pip install -r requirements.txt'
sh 'nosetests -v'
}
}
}
stage('Vote Docker BnP'){
agent any
when{
changeset "**/vote/**"
branch "master"
}
steps{
echo 'Packaging vote app with docker'
script{
docker.withRegistry('https://index.docker.io/v1/', 'dockerlogin') {
def voteImage = docker.build("xxxxxx/vote:v-adb-${env.BUILD_ID}", "./vote")
voteImage.push()
voteImage.push("latest")
}
}
}
}
stage('Deploy to Dev'){
agent any
when{
branch "master"
}
steps{
echo 'Deploy to Dev with Docker Compose'
sh 'docker-compose up -d '
}
}
}
post{
always{
echo 'Pipeline for vote is complete..'
}
}
}