-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
executable file
·63 lines (58 loc) · 1.31 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
pipeline {
environment {
jobBaseName = "${env.JOB_NAME}".split('/').first()
}
options {
timeout(time: 10, unit: 'MINUTES')
} //option
agent none
stages {
stage("build and test the project") {
when {
not {
branch 'master'
}
}
agent {
docker {
image 'maven:3-alpine'
args '-v m2_repos:/root/.m2'
} //docker
} // agent
stages {
stage('Build') {
steps {
echo "Building Chatter"
sh 'mvn -f Project_src/pom.xml install'
echo "Building Prattle"
sh 'mvn -f Project_src/pom.xml compile'
}
} // build
stage('SonarQube') {
when {
not {
branch 'master'
}
}
steps {
withSonarQubeEnv('SonarQube') {
sh 'mvn -f Project_src/pom.xml clean install'
sh 'mvn -f Project_src/pom.xml sonar:sonar -Dsonar.projectKey=${jobBaseName} -Dsonar.projectName=${jobBaseName}'
}
sh 'sleep 30'
timeout(time: 10, unit: 'SECONDS') {
retry(5) {
script {
def qg = waitForQualityGate()
if (qg.status != 'OK') {
error "Pipeline aborted due to quality gate failure: ${qg.status}"
}
}
}
}
} //steps
} //SONAR
}
} //stage
} // STAGES
}