-
Notifications
You must be signed in to change notification settings - Fork 6
/
Jenkinsfile
35 lines (35 loc) · 1.33 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
pipeline {
agent { label 'docker' }
options {
ansiColor('xterm')
timestamps()
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '5'))
timeout(time: 1, unit: 'HOURS')
}
post {
always {
step([$class: 'WsCleanup'])
}
}
stages {
stage('Sonarqube') {
steps {
script {
sh(label: 'SonarScan wGet', script: 'wget -nv https://apsvssinfsto001.blob.core.windows.net/component-live-executables/SonarQubeJunitQGGitHubNixClient; chmod 555 ./SonarQubeJunitQGGitHubNixClient')
if ("$BRANCH_NAME" == 'master') {
sonarOpts = "sonar.branch.name=$BRANCH_NAME;"
}
else {
sonarOpts = "sonar.branch.name=$BRANCH_NAME;sonar.branch.target=master"
}
withEnv(["SONAROPTIONS=${sonarOpts}"]) {
if (sh(label: 'SonarScan run', script: './SonarQubeJunitQGGitHubNixClient "https://github.com/DEFRA/defra-identity-hapi-plugin.git" "$BRANCH_NAME" "$SONAROPTIONS" "runJunit.sh"', returnStatus: true) != 0) {
error('sonarscan failed')
}
}
}
}
}
}
}