File tree Expand file tree Collapse file tree 1 file changed +30
-42
lines changed Expand file tree Collapse file tree 1 file changed +30
-42
lines changed Original file line number Diff line number Diff line change 1
- pipeline{
1
+ pipeline {
2
2
agent any
3
3
tools{
4
4
maven ' maven'
5
5
}
6
- stages{
7
- stage(' Build' ){
8
- steps{
9
- sh '''
10
- mvn clean package -DskipTests
11
- '''
12
- }
6
+ stages{
7
+ stage(' Build' ){
8
+ steps{
9
+ sh '''
10
+ mvn clean package -DskipTests
11
+ '''
12
+ }
13
+ }
14
+ stage(' Test' ){
15
+ steps{
16
+ sh ' mvn test'
13
17
}
14
- stage( ' Test ' ){
15
- steps {
16
- sh ' mvn test '
17
- }
18
+ }
19
+ stage( ' Sonar ' ) {
20
+ environment{
21
+ scanner = tool ' SONAR_SCANER '
18
22
}
19
- stage( ' Sonar ' ) {
20
- environment {
21
- scanner = tool ' SONAR_SCANER '
23
+ steps {
24
+ withSonarQubeEnv( ' SONAR ' ) {
25
+ sh " ${ scanner} /bin/sonar-scanner -e -Dsonar.host.url=http://172.17.0.1:9000 -Dsonar.projectKey=Backend -Dsonar.java.binaries=target -Dsonar.exclusions=src/test/** "
22
26
}
23
- steps{
24
- withSonarQubeEnv(' SONAR' ){
25
- sh " ${ scanner} /bin/sonar-scanner -e -Dsonar.host.url=http://172.17.0.1:9000 -Dsonar.projectKey=Backend -Dsonar.java.binaries=target -Dsonar.exclusions=src/test/**"
26
- }
27
- }
28
-
29
- }
30
- pipeline{
31
- agent any
32
- Stages {
33
- Stage (' Stage 1' ){
34
- steps{
35
- echo
36
- }
37
- }
38
27
}
39
- }
40
- stage(' QualityGate' ){
41
- steps {
42
- sleep(10 )
43
- timeout(1 ){
44
- withForQualityGate abortPipeline :false , credentialsId : ' token_sonar'
45
- }
46
- }
47
- }
48
-
49
28
50
-
51
- }
29
+ }
30
+ stage(' QualityGate' ){
31
+ steps {
32
+ sleep(10 )
33
+ timeout(1 ){
34
+ withForQualityGate abortPipeline :false , credentialsId : ' token_sonar'
35
+ }
36
+ }
37
+ }
38
+
52
39
}
40
+ }
You can’t perform that action at this time.
0 commit comments