Skip to content

Commit 8beeafa

Browse files
authored
Merge pull request kubesphere#1 from runzexia/runzexia-patch-1
Runzexia patch 1
2 parents 9095fc4 + e37687e commit 8beeafa

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

Jenkinsfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff 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

Jenkinsfile-online

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff 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

src/main/java/io/kubesphere/devops/HelloWorldController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ public class HelloWorldController {
1616
public String sayHello() {
1717
return "Hello,World!";
1818
}
19-
}
19+
}

0 commit comments

Comments
 (0)