File tree Expand file tree Collapse file tree 3 files changed +11
-7
lines changed
src/main/java/io/kubesphere/devops Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ pipeline {
1717 NAMESPACE = ' library'
1818 GITLAB_ACCOUNT = ' admin1'
1919 APP_NAME = ' devops-sample-s2i'
20- SONAR_TOKEN_ID = ' sonar-token'
20+ SONAR_CREDENTIAL_ID = ' sonar-token'
2121 }
2222
2323 stages {
@@ -38,8 +38,10 @@ pipeline {
3838 stage(' sonarqube analysis' ) {
3939 steps {
4040 container (' maven' ) {
41- withSonarQubeEnv(' sonar' ) {
42- sh " mvn sonar:sonar -o -gs `pwd`/configuration/settings.xml -Dsonar.branch=$BRANCH_NAME -Dsonar.login=$SONAR_TOKEN_ID "
41+ withCredentials([string(credentialsId : " $SONAR_CREDENTIAL_ID " , variable : ' SONAR_TOKEN' )]) {
42+ withSonarQubeEnv(' sonar' ) {
43+ sh " mvn sonar:sonar -o -gs `pwd`/configuration/settings.xml -Dsonar.branch=$BRANCH_NAME -Dsonar.login=$SONAR_TOKEN "
44+ }
4345 }
4446 timeout(time : 1 , unit : ' HOURS' ) {
4547 waitForQualityGate abortPipeline : true
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ pipeline {
1717 NAMESPACE = 'docker_username'
1818 GITHUB_ACCOUNT = 'kubesphere'
1919 APP_NAME = 'devops-sample-s2i'
20- SONAR_TOKEN_ID = 'sonar-token'
20+ SONAR_CREDENTIAL_ID = 'sonar-token'
2121 }
2222
2323 stages {
@@ -38,8 +38,10 @@ pipeline {
3838 stage('sonarqube analysis') {
3939 steps {
4040 container ('maven') {
41- withSonarQubeEnv('sonar') {
42- sh "mvn sonar:sonar -o -gs `pwd`/configuration/settings.xml -Dsonar.branch=$BRANCH_NAME -Dsonar.login=$SONAR_TOKEN_ID"
41+ withCredentials([string(credentialsId: "$SONAR_CREDENTIAL_ID", variable: 'SONAR_TOKEN')]) {
42+ withSonarQubeEnv('sonar') {
43+ sh "mvn sonar:sonar -o -gs `pwd`/configuration/settings.xml -Dsonar.branch=$BRANCH_NAME -Dsonar.login=$SONAR_TOKEN"
44+ }
4345 }
4446 timeout(time: 1, unit: 'HOURS') {
4547 waitForQualityGate abortPipeline: true
Original file line number Diff line number Diff line change @@ -16,4 +16,4 @@ public class HelloWorldController {
1616 public String sayHello () {
1717 return "Hello,World!" ;
1818 }
19- }
19+ }
You can’t perform that action at this time.
0 commit comments