-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
89 lines (85 loc) · 1.55 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//SCRIPTED PIPELINE
// node {
// echo "Build"
// echo "Test"
// echo "Integration Test"
// }
//DECLARATIVE PIPELINE
pipeline{
agent any
//agent { docker {image 'maven:3.6.3'}}
environment {
dockerHome = tool 'myDocker'
mavenHome = tool 'myMaven'
PATH = "$dockerHome/bin:$mavenHome/bin:$PATH"
}
stages{
stage('Checkout'){
steps{
sh 'mvn --version'
sh 'docker version'
echo "Build"
echo "PATH - $PATH"
echo "BUILD NUMBER - $env.BUILD_NUMBER"
echo "BUILD_ID - $env.BUILD_ID"
echo "JOB_NAME - $env.JOB_NAME"
echo "BUILDTAG - $env.BUILDTAG"
echo "BUILD_URL - $env.BUILD_URL"
}
}
stage('Compile'){
steps{
sh "mvn clean compile"
}
}
stage('Test'){
steps{
echo "mvn test"
}
}
stage('Integration Test'){
steps{
echo "mvn failsafe:integration-test failsafe:verify"
}
}
stage('Build Docker Image'){
steps{
script{
dockerImage = docker.build("sm171190/currency-exchange-service:{$env.BUILD_TAG}")
}
}
}
stage('Push Docker Image'){
steps{
script{
docker.withRegistry('',dockerhub){
dockerImage.push();
dockerImage.push('latest');
}
}
}
}
stage('Package'){
steps{
sh "mvn package -DskipTests"
}
}
}
post{
always {
echo "I'm awesome. I run always."
}
success{
echo "I run when you are successful."
}
failure{
echo "I run when you fail."
}
// unstable{
// echo "I run when a test failure happens."
// }
//changed{
// echo "I run when the build status changes."
//}
}
}