-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
67 lines (67 loc) · 1.94 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
pipeline {
agent {
label 'connectivity'
}
stages {
stage('Build image') {
steps {
sh "docker image build --target build-env -t scala213-dev:${BUILD_NUMBER} ."
}
}
stage('Code analysis') {
steps {
sh 'docker run --rm -v sbt-dev:/root scala213-dev:${BUILD_NUMBER} sbt scalastyle scapegoat'
}
}
stage('Test Unit') {
steps {
sh 'docker run --rm -v sbt-dev:/root scala213-dev:${BUILD_NUMBER} sbt coverage test coverageReport'
}
}
stage('Create production image') {
when {
anyOf {
branch 'master'; branch 'refactoring'
}
}
steps {
sh "docker image build -t docker.bunic.de:5001/scala213:${BUILD_NUMBER} ."
sh "docker push docker.bunic.de:5001/scala213:${BUILD_NUMBER}"
}
}
stage('Deploy Stage') {
when {
anyOf {
branch 'master';
}
}
steps {
sh 'echo \'{ \
"container": { \
"type": "DOCKER", \
"docker": { \
"image": "docker.bunic.de:5001/sscala213:\'$BUILD_NUMBER\'", \
"network": "BRIDGE", \
"portMappings": [ \
{ \
"containerPort": 8080, \
"hostPort": 0, \
"protocol": "tcp" \
} \
] \
} \
} \
}\' | docker run -i k0pernikus/httpie-docker-alpine:1.0.0 PUT http://bunic.de/marathon/v2/apps/seed'
}
}
stage('Deploy Production') {
input {
message "Deploy to production?"
id "simple-input"
}
steps {
echo 'deploy production'
}
}
}
}