forked from stalin12/valaxy-rtp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
67 lines (63 loc) · 2.15 KB
/
Jenkinsfile
File metadata and controls
67 lines (63 loc) · 2.15 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
def imageName = 'stalinrtp.jfrog.io/valaxy-docker/valaxy-rtp'
def registry = 'https://stalinrtp.jfrog.io'
def version = '1.0.0'
def app
pipeline {
agent {
node {
label "rtp2"
}
}
stages {
stage('Build') {
steps {
echo '<--------------- Building --------------->'
sh 'printenv'
sh 'mvn clean deploy -Dmaven.test.skip=true'
echo '<------------- Build completed --------------->'
}
}
stage('Unit Test') {
steps {
echo '<--------------- Unit Testing started --------------->'
sh 'mvn surefire-report:report'
echo '<------------- Unit Testing stopped --------------->'
}
}
stage ("Sonar Analysis") {
environment {
scannerHome = tool 'SonarQubeScanner'
}
steps {
echo '<--------------- Sonar Analysis started --------------->'
withSonarQubeEnv('SonarServer') {
sh "${scannerHome}/bin/sonar-scanner"
}
echo '<--------------- Sonar Analysis stopped --------------->'
}
}
stage ("Quality Gate") {
steps {
script {
echo '<--------------- Quality Gate started --------------->'
timeout(time: 1, unit: 'HOURS') {
def qg = waitForQualityGate()
if(qg.status!='OK'){
error "Pipeline failed due to the Quality gate issue"
}
}
echo '<--------------- Quality Gate stopped --------------->'
}
}
}
stage(" Docker Build ") {
steps {
script {
echo '<--------------- Docker Build Started --------------->'
app = docker.build(imageName)
echo '<--------------- Docker Build Ends --------------->'
}
}
}
}
}