-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathJenkinsfile
51 lines (51 loc) · 1.43 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
pipeline {
agent any
tools {
maven 'Maven-3.9'
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Build') {
agent {
docker {
image 'registry.x1/j7beck/x1-maven3:jdk-1.8.0'
args '-v $HOME/.m2/repository:/var/lib/jenkins/.m2/repository'
}
}
steps {
sh '$MAVEN_HOME/bin/mvn -B clean package jacoco:report'
junit '**/target/surefire-reports/TEST-*.xml'
recordCoverage(tools: [[parser: 'JACOCO']])
stash name: 'coverage', includes: '**/jacoco.xml'
}
}
stage('Publish') {
tools {
jdk 'JDK-17'
}
steps {
withCredentials([usernameColonPassword(credentialsId: 'nexus', variable: 'USERPASS')]) {
unstash name: 'coverage'
sh '''
mvn -B -Prpm deploy site-deploy -DskipTests
curl -u "$USERPASS" --upload-file target/rpm/wildfly-logstash/RPMS/noarch/wildfly-logstash-*.noarch.rpm https://www.x1/nexus/repository/x1-extra-rpms/testing/
'''
recordIssues tools: [spotBugs(pattern: 'target/spotbugsXml.xml')]
}
}
}
stage('Sonar') {
tools {
jdk 'JDK-17'
}
steps {
unstash name: 'coverage'
sh 'mvn sonar:sonar -DskipTests -Dsonar.java.coveragePlugin=jacoco -Dsonar.jacoco.reportPath=target/jacoco.exec -Dsonar.host.url=https://www.x1/sonar'
}
}
}
}