@@ -11,12 +11,13 @@ pipeline {
1111
1212 environment {
1313 DOCKER_CREDENTIAL_ID = 'dockerhub-id'
14- GITHUB_CREDENTIAL_ID = 'gitlab -id'
14+ GITHUB_CREDENTIAL_ID = 'github -id'
1515 KUBECONFIG_CREDENTIAL_ID = 'demo-kubeconfig'
1616 REDISTRY = 'docker.io'
1717 NAMESPACE = 'docker_username'
1818 GITHUB_ACCOUNT = 'kubesphere'
1919 APP_NAME = 'devops-sample-s2i'
20+ SONAR_TOKEN_ID= 'sonar-token'
2021 }
2122
2223 stages {
@@ -37,15 +38,13 @@ pipeline {
3738 stage('sonarqube analysis') {
3839 steps {
3940 container ('maven') {
40- withCredentials([string(credentialsId: 'sonar-token', variable: 'SONAR_TOKEN')]) {
41- withSonarQubeEnv('sonar') {
42- sh "mvn sonar:sonar -o -gs `pwd`/configuration/settings.xml -Dsonar.branch=$BRANCH_NAME -Dsonar.login=$SONAR_TOKEN"
43- }
41+ withSonarQubeEnv('sonar') {
42+ sh "mvn sonar:sonar -o -gs `pwd`/configuration/settings.xml -Dsonar.branch=$BRANCH_NAME -Dsonar.login=$SONAR_TOKEN_ID"
4443 }
4544 timeout(time: 1, unit: 'HOURS') {
4645 waitForQualityGate abortPipeline: true
4746 }
48- }
47+ }
4948 }
5049 }
5150
@@ -96,7 +95,7 @@ pipeline {
9695 sh 'git config --global user.email "kubesphere@yunify.com" '
9796 sh 'git config --global user.name "kubesphere" '
9897 sh 'git tag -a $TAG_NAME -m "$TAG_NAME" '
99- sh 'git push http://$GIT_USERNAME:$GIT_PASSWORD@gitlab.devops.kubesphere.local:30080 /$GITHUB_ACCOUNT/$APP_NAME.git --tags'
98+ sh 'git push http://$GIT_USERNAME:$GIT_PASSWORD@github.com /$GITHUB_ACCOUNT/$APP_NAME.git --tags'
10099 }
101100 sh 'docker tag $REDISTRY/$NAMESPACE/$APP_NAME:SNAPSHOT-$BRANCH_NAME-$BUILD_NUMBER $REDISTRY/$NAMESPACE/$APP_NAME:$TAG_NAME '
102101 sh 'docker push $REDISTRY/$NAMESPACE/$APP_NAME:$TAG_NAME '
0 commit comments