-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
65 lines (59 loc) · 1.51 KB
/
Jenkinsfile
File metadata and controls
65 lines (59 loc) · 1.51 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
def image
def image_base
def image_version
def image_router
pipeline {
agent any
stages {
stage('Build base image') {
steps {
script {
// Ensure that the base image is up-to-date
image_base = docker.image('python:3.6.5-slim-stretch')
image_base.pull()
image = docker.build('wizardsofindustry/aorta')
image_router = docker.build('wizardsofindustry/aorta-router',
"-f Dockerfile.router")
}
}
}
stage('Build router image') {
steps {
script {
image_router = docker.build('wizardsofindustry/aorta-router',
"-f Dockerfile.router")
}
}
}
stage('Push to Docker Hub') {
when {
expression {
return env.BRANCH_NAME == 'master'
}
}
steps {
script {
image_version = readFile('version.info').trim()
withDockerRegistry([ credentialsId: 'sg-docker-credentials' ]) {
image.push("latest")
image.push("${image_version}")
image_router.push("latest")
image_router.push("${image_version}")
}
}
}
}
} // end stages
post {
success {
slackSend(
color: "#2EB886",
message: "Success: Job ${env.JOB_NAME} [${env.BUILD_NUMBER}] (${env.BUILD_URL})")
}
failure {
slackSend(
color: "#CC0000",
message: "Failed: Job ${env.JOB_NAME} [${env.BUILD_NUMBER}] (${env.BUILD_URL})")
}
}
} // end pipeline