Skip to content

Commit 9ee8bc1

Browse files
authored
Merge pull request #61 from TonyMorrison/master
BR-120 Remove SonarCloud stages from Jenkinsfiles
2 parents 5616b2a + c0cd4d1 commit 9ee8bc1

2 files changed

Lines changed: 6 additions & 39 deletions

File tree

‎Jenkinsfile‎

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pipeline {
2525
SONAR_PROJECT_KEY = 'acdebugger'
2626
GITHUB_USERNAME = 'codice'
2727
GITHUB_REPONAME = 'acdebugger'
28+
DOCKERHUB_CREDS = 'dockerhub-codicebot'
2829
}
2930
stages {
3031
stage('Setup') {
@@ -69,8 +70,8 @@ pipeline {
6970
stage ('Linux') {
7071
steps {
7172
withMaven(maven: 'maven-latest', globalMavenSettingsConfig: 'default-global-settings', mavenSettingsConfig: 'codice-maven-settings', mavenOpts: '${LINUX_MVN_RANDOM}') {
72-
sh 'mvn install -B -DskipStatic=true -DskipTests=true $DISABLE_DOWNLOAD_PROGRESS_OPTS'
73-
sh 'mvn clean install -B -Dgib.enabled=true -Dgib.referenceBranch=/refs/remotes/origin/$CHANGE_TARGET $DISABLE_DOWNLOAD_PROGRESS_OPTS'
73+
sh 'mvn install -B -DskipStatic=true -DskipTests=true $DISABLE_DOWNLOAD_PROGRESS_OPTS -Ddocker.username=$DOCKERHUB_CREDS_USR -Ddocker.password=$DOCKERHUB_CREDS_PSW'
74+
sh 'mvn clean install -B -Dgib.enabled=true -Dgib.referenceBranch=/refs/remotes/origin/$CHANGE_TARGET $DISABLE_DOWNLOAD_PROGRESS_OPTS -Ddocker.username=$DOCKERHUB_CREDS_USR -Ddocker.password=$DOCKERHUB_CREDS_PSW'
7475
}
7576
}
7677
post {
@@ -112,7 +113,7 @@ pipeline {
112113
stage ('Linux') {
113114
steps {
114115
withMaven(maven: 'maven-latest', globalMavenSettingsConfig: 'default-global-settings', mavenSettingsConfig: 'codice-maven-settings', mavenOpts: '${LINUX_MVN_RANDOM}') {
115-
sh 'mvn clean install -B $DISABLE_DOWNLOAD_PROGRESS_OPTS'
116+
sh 'mvn clean install -B $DISABLE_DOWNLOAD_PROGRESS_OPTS -Ddocker.username=$DOCKERHUB_CREDS_USR -Ddocker.password=$DOCKERHUB_CREDS_PSW'
116117
}
117118
}
118119
post {
@@ -161,7 +162,7 @@ pipeline {
161162
}
162163
steps{
163164
withMaven(maven: 'maven-latest', jdk: 'jdk8-latest', globalMavenSettingsConfig: 'default-global-settings', mavenSettingsConfig: 'codice-maven-settings', mavenOpts: '${LINUX_MVN_RANDOM}') {
164-
sh 'mvn deploy -B -DskipStatic=true -DskipTests=true -DretryFailedDeploymentCount=10 $DISABLE_DOWNLOAD_PROGRESS_OPTS'
165+
sh 'mvn deploy -B -pl !docker -DskipStatic=true -DskipTests=true -DretryFailedDeploymentCount=10 $DISABLE_DOWNLOAD_PROGRESS_OPTS'
165166
}
166167
}
167168
}
@@ -199,40 +200,6 @@ pipeline {
199200
}
200201
}
201202
}
202-
stage ('SonarCloud') {
203-
steps {
204-
withMaven(maven: 'maven-latest', jdk: 'jdk8-latest', globalMavenSettingsConfig: 'default-global-settings', mavenSettingsConfig: 'codice-maven-settings', mavenOpts: '${LINUX_MVN_RANDOM}') {
205-
withCredentials([string(credentialsId: 'sonarqube-token', variable: 'SONAR_TOKEN')]) {
206-
script {
207-
// If this build is not a pull request, run sonar scan. otherwise run incremental scan
208-
if (env.CHANGE_ID == null) {
209-
sh 'mvn -q -B -Dcheckstyle.skip=true org.jacoco:jacoco-maven-plugin:prepare-agent install sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN -Dsonar.organization=codice -Dsonar.projectKey=${SONAR_PROJECT_KEY} -Dsonar.exclusions=${COVERAGE_EXCLUSIONS} $DISABLE_DOWNLOAD_PROGRESS_OPTS'
210-
} else {
211-
sh 'mvn -q -B -Dcheckstyle.skip=true org.jacoco:jacoco-maven-plugin:prepare-agent install sonar:sonar -Dsonar.pullrequest.provider=github -Dsonar.pullrequest.github.repository=${GITHUB_USERNAME}/${GITHUB_REPONAME} -Dsonar.pullrequest.github.endpoint=https://api.github.com/ -Dsonar.pullrequest.branch=${BRANCH_NAME} -Dsonar.pullrequest.key=${CHANGE_ID} -Dsonar.pullrequest.base=${CHANGE_TARGET} -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN -Dsonar.organization=codice -Dsonar.projectKey=${SONAR_PROJECT_KEY} -Dsonar.exclusions=${COVERAGE_EXCLUSIONS} -Dgib.enabled=true -Dgib.referenceBranch=/refs/remotes/origin/$CHANGE_TARGET $DISABLE_DOWNLOAD_PROGRESS_OPTS'
212-
}
213-
}
214-
}
215-
}
216-
}
217-
post {
218-
success {
219-
script {
220-
withCredentials([usernameColonPassword(credentialsId: 'cxbot', variable: 'GITHUB_TOKEN')]) {
221-
def jsonBlob = getGithubStatusJsonBlob("success", "${BUILD_URL}display/redirect", "Sonar Succeeded!", "jenkins/static-analysis/sonar")
222-
postStatusToHash("${jsonBlob}", "${GITHUB_USERNAME}", "${GITHUB_REPONAME}", "${env.PR_COMMIT}", "${GITHUB_TOKEN}")
223-
}
224-
}
225-
}
226-
failure {
227-
script {
228-
withCredentials([usernameColonPassword(credentialsId: 'cxbot', variable: 'GITHUB_TOKEN')]) {
229-
def jsonBlob = getGithubStatusJsonBlob("failure", "${BUILD_URL}display/redirect", "Sonar Failed!", "jenkins/static-analysis/sonar")
230-
postStatusToHash("${jsonBlob}", "${GITHUB_USERNAME}", "${GITHUB_REPONAME}", "${env.PR_COMMIT}", "${GITHUB_TOKEN}")
231-
}
232-
}
233-
}
234-
}
235-
}
236203
}
237204
}
238205
}

‎pom.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070

7171
<!-- Maven Plugin Version Properties -->
7272
<directory-maven-plugin.version>0.3.1</directory-maven-plugin.version>
73-
<dependency-check-maven.version>5.2.2</dependency-check-maven.version>
73+
<dependency-check-maven.version>6.0.5</dependency-check-maven.version>
7474
<maven-jacoco-plugin.version>0.8.2</maven-jacoco-plugin.version>
7575
<fabric8.docker.plugin.version>0.27.1</fabric8.docker.plugin.version>
7676
<maven-plugin-plugin.version>3.6.0</maven-plugin-plugin.version>

0 commit comments

Comments
 (0)