This repository was archived by the owner on Oct 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathJenkinsfile
More file actions
40 lines (40 loc) · 1.63 KB
/
Jenkinsfile
File metadata and controls
40 lines (40 loc) · 1.63 KB
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
36
37
38
39
40
pipeline {
agent {
label 'docker-ce'
}
stages {
stage('Build and publish') {
agent {
docker {
image 'europeanspallationsource/oracle-jdk-maven-jenkins:8u161-b12-2'
reuseNode true
}
}
steps {
script {
env.POM_VERSION = readMavenPom().version
currentBuild.displayName = env.POM_VERSION
}
withCredentials([file(credentialsId: 'gpg-privatekey', variable: 'GPG_PRIVATE_KEY'),
string(credentialsId: 'gpg-passphrase', variable: 'GPG_PASSPHRASE'),
usernamePassword(credentialsId: 'maven-central', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
sh 'gpg --import ${GPG_PRIVATE_KEY}'
sh "mvn --batch-mode -Dxaos.headless=true -Dgpg.passphrase='${GPG_PASSPHRASE}' -Dserver.id=ossrh -Dserver.username=${USERNAME} -Dserver.password='${PASSWORD}' clean deploy"
}
}
}
stage('SonarQube analysis') {
agent {
docker {
image 'europeanspallationsource/oracle-jdk-maven-jenkins:8u161-b12-2'
reuseNode true
}
}
steps {
withCredentials([string(credentialsId: 'sonarqube', variable: 'TOKEN')]) {
sh 'mvn --batch-mode -Dsonar.scm.disabled=true -Dsonar.login=$TOKEN -Dsonar.branch=${BRANCH_NAME} sonar:sonar'
}
}
}
}
}