-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
86 lines (78 loc) · 2.32 KB
/
Copy pathJenkinsfile
File metadata and controls
86 lines (78 loc) · 2.32 KB
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
def registry = 'https://dimlav.jfrog.io'
def imageName = 'dimlav.jfrog.io/aman-app-docker-local/springboot'
def version = '1.0.1'
pipeline {
agent {
node {
label 'maven'
}
}
environment {
PATH = "/opt/apache-maven-3.9.3/bin:$PATH"
}
stages {
stage("build") {
steps {
echo "----------- build started ----------"
sh 'mvn clean deploy -Dmaven.test.skip=true'
echo "----------- build complted ----------"
}
}
// stage("test") {
// steps {
// echo "----------- unit test started ----------"
// sh 'mvn surefire-report:report'
// echo "----------- unit test Complted ----------"
// }
// }
// stage('SonarQube analysis') {
// environment {
// scannerHome = tool 'sonar-scanner'
// }
// steps {
// withSonarQubeEnv('sonarqube-server') { // If you have configured more than one global server connection, you can specify its name
// sh "${scannerHome}/bin/sonar-scanner"
// }
// }
// }
// stage("Quality Gate") {
// steps {
// script {
// timeout(time: 1, unit: 'HOURS') { // Just in case something goes wrong, pipeline will be killed after a timeout
// def qg = waitForQualityGate() // Reuse taskId previously collected by withSonarQubeEnv
// if (qg.status != 'OK') {
// error "Pipeline aborted due to quality gate failure: ${qg.status}"
// }
// }
// }
// }
// }
stage(" Docker Build ") {
steps {
script {
echo '<--------------- Docker Build Started --------------->'
app = docker.build(imageName+":"+version)
echo '<--------------- Docker Build Ends --------------->'
}
}
}
stage (" Docker Publish "){
steps {
script {
echo '<--------------- Docker Publish Started --------------->'
docker.withRegistry(registry, 'jfrog-cred'){
app.push()
}
echo '<--------------- Docker Publish Ended --------------->'
}
}
}
stage (" Deploy application on Kubernetes "){
steps {
script {
sh './deploy.sh'
}
}
}
}
}