-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
53 lines (51 loc) · 1.21 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
/* Requires the Docker Pipeline plugin */
/*
pipeline {
agent { docker { image 'maven:3.3.3' } }
stages {
stage('build') {
steps {
sh 'mvn --version'
}
}
}
}
*/
node {
def app
def mavendocker
stage('Clone repository') {
/* Let's make sure we have the repository cloned to our workspace */
checkout scm
}
stage('Prerequisite') {
mavendocker =docker.image('maven:3.3.3')
sh 'echo "maven ready"'
}
stage('Build') {
/* This builds the actual image; synonymous to
* docker build on the command line */
mavendocker.inside {
sh 'mvn install -DskipTests'
}
app = docker.build("consul-integration-demo")
}
stage('Test image') {
/* Ideally, we would run a test framework against our image.
* For this example, we're using a Volkswagen-type approach ;-) */
sh 'consul agent -dev &'
steps{
mavendocker.inside {
sh 'mvn test'
}
}
post {
always {
junit 'target/surefire-reports/*.xml'
}
}
app.inside {
sh 'echo "Tests passed"'
}
}
}