-
Notifications
You must be signed in to change notification settings - Fork 186
/
Jenkinsfile
executable file
·85 lines (76 loc) · 1.45 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
//SCRIPTED
//DECLARATIVE
pipeline {
agent any
// agent { docker { image 'maven:3.6.3'} }
// agent { docker { image 'node:13.8'} }
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 "BUILD_TAG - $env.BUILD_TAG"
echo "BUILD_URL - $env.BUILD_URL"
}
}
stage('Compile') {
steps {
sh "mvn clean compile"
}
}
stage('Test') {
steps {
sh "mvn test"
}
}
stage('Integration Test') {
steps {
sh "mvn failsafe:integration-test failsafe:verify"
}
}
stage('Package') {
steps {
sh "mvn package -DskipTests"
}
}
stage('Build Docker Image') {
steps {
//"docker build -t in28min/currency-exchange-devops:$env.BUILD_TAG"
script {
dockerImage = docker.build("in28min/currency-exchange-devops:${env.BUILD_TAG}")
}
}
}
stage('Push Docker Image') {
steps {
script {
docker.withRegistry('', 'dockerhub') {
dockerImage.push();
dockerImage.push('latest');
}
}
}
}
}
post {
always {
echo 'Im awesome. I run always'
}
success {
echo 'I run when you are successful'
}
failure {
echo 'I run when you fail'
}
}
}