Skip to content

Commit f7f21d6

Browse files
authored
Create Jenkinsfile
1 parent e0ddef1 commit f7f21d6

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

Jenkinsfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
def userInput = true
2+
def didTimeout = false
3+
node ('master'){
4+
stage('Checkout'){
5+
git branch: 'master', url: 'https://github.com/BINPIPE/java-springboot-sonarqube.git'
6+
}
7+
8+
stage('Build'){
9+
//sh 'mvn clean package -Dmaven.test.skip=true -U'
10+
sh 'mvn clean install'
11+
}
12+
13+
stage('Sonar Scan'){
14+
15+
sh "mvn sonar:sonar -Dmaven.test.skip=true"
16+
}
17+
18+
stage("Quality Gate"){
19+
20+
timeout(time: 1, unit: 'MINUTES') { //---Just in case something goes wrong, pipeline will be killed after a timeout
21+
sleep 10 //---Allow time for Sonar Scan to be over in Server (To Do: Replace this with webhook!)
22+
def qg = waitForQualityGate() //--Reuse taskId previously collected by withSonarQubeEnv
23+
if (qg.status != 'OK') {
24+
error "Pipeline aborted due to quality gate failure: ${qg.status}"
25+
26+
}
27+
}
28+
}
29+
stage('Deploy'){
30+
sh 'echo Moving ahead with Deployment to Endpoints!'
31+
32+
}
33+
}

0 commit comments

Comments
 (0)