From 3160da7d5ed502e043d90a0044fed927b07286ba Mon Sep 17 00:00:00 2001 From: "michael.breu" <michael.breu@uibk.ac.at> Date: Fri, 26 Feb 2021 17:15:38 +0100 Subject: [PATCH] Initial version to run on Jenkins --- Jenkinsfile | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000..41af71a74 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,46 @@ +pipeline { + agent any + environment { + scannerHome = tool 'SonarQube Scanner' + } + options { + buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10')) + } + tools { + // Install the Maven version configured as "M3" and add it to the path. + maven "/usr/share/maven" + } + stages { + stage('Compile') { + steps { + milestone 1 + withSonarQubeEnv('SonarQube Production') { + sh "mvn -Dmaven.test.failure.ignore=true -Dsonar.projectName=WS2020_PS_SWA_6_2 -Dsonar.projectKey=WS2020_PS_SWA_6_2 clean test jacoco:report sonar:sonar" + } + } + } + + post { + failure { + notifyByEmail("Failure"); + } + unstable { + notifyByEmail("Unstable"); + } + fixed { + notifyByEmail("Fixed"); + } + } + +} + + void notifyByEmail(String reason) { + def mailRecipients = "michael.breu@arctis.at" + emailext ( + subject: reason + ": Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'", + body: '''${SCRIPT, template="groovy-html.template"}''', + mimeType: 'text/html', + recipientProviders: [[$class: 'CulpritsRecipientProvider']] + ) + + } -- GitLab