From 1859359578de32fe64e5bd5791c91fc1d668acf3 Mon Sep 17 00:00:00 2001 From: itboots <97653637@qq.com> Date: Wed, 27 Oct 2021 17:47:49 +0800 Subject: [PATCH 1/2] Update Jenkinsfile-online --- Jenkinsfile-online | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile-online b/Jenkinsfile-online index 2ca69e7f1..5364cae8f 100644 --- a/Jenkinsfile-online +++ b/Jenkinsfile-online @@ -14,9 +14,10 @@ pipeline { GITHUB_CREDENTIAL_ID = 'github-id' KUBECONFIG_CREDENTIAL_ID = 'demo-kubeconfig' REGISTRY = 'docker.io' - DOCKERHUB_NAMESPACE = 'docker_username' - GITHUB_ACCOUNT = 'kubesphere' + DOCKERHUB_NAMESPACE = 'itzoozer' + GITHUB_ACCOUNT = 'itboots' APP_NAME = 'devops-java-sample' + SONAR_CREDENTIAL_ID = 'sonar-qube' } stages { From 80bffb66ad67c85bed945d137722c996a86c83a7 Mon Sep 17 00:00:00 2001 From: itboots <97653637@qq.com> Date: Wed, 27 Oct 2021 17:52:46 +0800 Subject: [PATCH 2/2] Update Jenkinsfile-online --- Jenkinsfile-online | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Jenkinsfile-online b/Jenkinsfile-online index 5364cae8f..bb6d57bec 100644 --- a/Jenkinsfile-online +++ b/Jenkinsfile-online @@ -34,6 +34,21 @@ pipeline { } } } + + stage('sonarqube analysis') { + steps { + container ('maven') { + withCredentials([string(credentialsId: "$SONAR_CREDENTIAL_ID", variable: 'SONAR_TOKEN')]) { + withSonarQubeEnv('sonar') { + sh "mvn sonar:sonar -gs `pwd`/configuration/settings.xml -Dsonar.branch=$BRANCH_NAME -Dsonar.login=$SONAR_TOKEN" + } + } + timeout(time: 1, unit: 'HOURS') { + waitForQualityGate abortPipeline: true + } + } + } + } stage ('build & push') { steps {