seb-server/Jenkinsfile

55 lines
2.1 KiB
Text
Raw Permalink Normal View History

2018-11-14 15:24:36 +01:00
void setBuildStatus(String message, String state) {
step([
$class: "GitHubCommitStatusSetter",
reposSource: [$class: "ManuallyEnteredRepositorySource", url: "${env.GIT_URL}"],
contextSource: [$class: "ManuallyEnteredCommitContextSource", context: "ci/jenkins/build-status"],
errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", result: "UNSTABLE"]],
statusResultSource: [ $class: "ConditionalStatusResultSource", results: [[$class: "AnyBuildResult", message: message, state: state]] ]
]);
}
pipeline {
agent any
stages {
stage('Maven build') {
steps {
withMaven(maven: 'Maven', options: [findbugsPublisher(disabled: true)]) {
sh "mvn clean install -e -P let_reporting"
}
}
}
stage('Reporting') {
steps {
2022-03-28 13:56:04 +02:00
withMaven(maven: 'Maven', options: [findbugsPublisher(disabled: true)]) {
2022-03-28 16:37:13 +02:00
sh "mvn --batch-mode -V -U -e -P let_reporting pmd:pmd pmd:cpd findbugs:findbugs spotbugs:spotbugs"
2022-03-28 13:56:04 +02:00
}
2022-03-28 11:48:29 +02:00
}
2018-11-14 15:24:36 +01:00
}
}
post {
2022-03-28 11:27:31 +02:00
always {
junit testResults: '**/target/surefire-reports/TEST-*.xml'
recordIssues enabledForFailure: true, tool: spotBugs()
recordIssues enabledForFailure: true, tool: pmdParser(pattern: '**/target/pmd.xml')
}
2018-11-14 15:24:36 +01:00
failure {
setBuildStatus("Build failed", "FAILURE");
emailext body: "The build of the LET Application (${env.JOB_NAME}) failed! See ${env.BUILD_URL}", recipientProviders: [[$class: 'CulpritsRecipientProvider']], subject: 'LET Application Build Failure'
}
success {
setBuildStatus("Build complete", "SUCCESS");
}
}
options {
timeout(time: 10, unit: 'MINUTES')
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '7'))
}
triggers {
pollSCM('H/5 * * * *')
}
}