forked from sonata-nfv/son-emu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
52 lines (51 loc) · 1.83 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
#!groovy
pipeline {
agent any
stages {
stage('Checkout') {
steps {
echo 'Checkout...'
checkout scm
}
}
stage('Build') {
steps {
echo 'Building...'
sh "docker build --no-cache -t sonatanfv/son-emu:dev ."
}
}
stage('Test') {
steps {
echo 'Testing...'
sh "docker run --name son-emu --rm --privileged --pid='host' -v /var/run/docker.sock:/var/run/docker.sock sonatanfv/son-emu:dev 'py.test -v src/emuvim/test/unittests'"
}
}
stage('Package') {
steps {
echo 'Packaging (Docker-image)...'
// push to public Docker registry
sh "docker push sonatanfv/son-emu:dev"
// might be moved to another job (:dev and :latest are the same for now)
sh "docker tag sonatanfv/son-emu:dev sonatanfv/son-emu:latest"
sh "docker push sonatanfv/son-emu:latest"
// push to internal Docker registry
sh "docker tag sonatanfv/son-emu:dev registry.sonata-nfv.eu:5000/son-emu:latest"
sh "docker push registry.sonata-nfv.eu:5000/son-emu"
}
}
}
post {
success {
mail(from: "[email protected]",
to: "[email protected]",
subject: "SUCCESS: ${env.JOB_NAME}/${env.BUILD_ID} (${env.BRANCH_NAME})",
body: "${env.JOB_URL}")
}
failure {
mail(from: "[email protected]",
to: "[email protected]",
subject: "FAILURE: ${env.JOB_NAME}/${env.BUILD_ID} (${env.BRANCH_NAME})",
body: "${env.JOB_URL}")
}
}
}