File tree Expand file tree Collapse file tree 2 files changed +79
-1
lines changed
src/main/resources/templates Expand file tree Collapse file tree 2 files changed +79
-1
lines changed Original file line number Diff line number Diff line change
1
+ pipeline {
2
+ environment {
3
+ registry = " dailycodebuffer/spring-boot-jenkins-docker"
4
+ registryCredential = ' dockerhub'
5
+ dockerImage = ' '
6
+ }
7
+ agent any
8
+ tools { maven " M3" }
9
+ stages {
10
+ stage(' Cloning Git' ) {
11
+ steps {
12
+ git ' https://github.com/dailycodebuffer/Spring-MVC-Tutorials.git'
13
+ }
14
+ }
15
+ stage(' Build' ) {
16
+ steps {
17
+ dir(' Jenkins-PIpeline-Demo' ) {
18
+ bat ' mvn -Dmaven.test.failure.ignore clean package'
19
+ }
20
+ }
21
+ }
22
+ stage(' Test' ) {
23
+ steps {
24
+ dir(' Jenkins-PIpeline-Demo' ) {
25
+ junit ' **/target/surefire-reports/TEST-*.xml'
26
+ archiveArtifacts ' target/*.jar'
27
+ }
28
+ }
29
+ }
30
+ stage(' SonarQube Analysis' ) {
31
+ steps {
32
+ dir(' Jenkins-PIpeline-Demo' ) {
33
+ withSonarQubeEnv(' sonarqube' ) {
34
+ bat ' mvn sonar:sonar'
35
+ }
36
+ }
37
+ }
38
+ }
39
+ stage(' Building image' ) {
40
+ steps{
41
+ script {
42
+ dir(' Jenkins-PIpeline-Demo' ) {
43
+ dockerImage = docker. build registry + " :$BUILD_NUMBER "
44
+ }
45
+ }
46
+ }
47
+ }
48
+ stage(' Deploy Image' ) {
49
+ steps{
50
+ script {
51
+ dir(' Jenkins-PIpeline-Demo' ) {
52
+ docker. withRegistry( ' ' , registryCredential ) {
53
+ dockerImage. push()
54
+ }
55
+ }
56
+ }
57
+ }
58
+ }
59
+ stage(' Remove Unused docker image' ) {
60
+ steps{
61
+ dir(' Jenkins-PIpeline-Demo' ) {
62
+ bat " docker rmi $registry :$BUILD_NUMBER "
63
+ }
64
+ }
65
+ }
66
+ }
67
+
68
+ post {
69
+
70
+ success {
71
+ echo ' This Build is Successfull!'
72
+ }
73
+ failure {
74
+ echo ' I failed :('
75
+ }
76
+
77
+ }
78
+ }
Original file line number Diff line number Diff line change @@ -7,5 +7,5 @@ <h1>Error Occurred!</h1>
7
7
< span th:text ="${error} "> error</ span >
8
8
</ b >
9
9
< p th:text ="${message} "> message</ p >
10
- </ body >
10
+ </ body >
11
11
</ html >
You can’t perform that action at this time.
0 commit comments