2018-04-25 09:42:39 +02:00
|
|
|
package eo;
|
|
|
|
|
|
|
|
|
2018-04-25 10:23:23 +02:00
|
|
|
def mail_notify(currentBuild, env, email) {
|
2021-01-04 23:48:21 +01:00
|
|
|
/* Send mail to 'email' if branch is main
|
2018-04-25 19:33:35 +02:00
|
|
|
else send mail to the author of the last commit
|
2018-04-25 10:23:23 +02:00
|
|
|
*/
|
|
|
|
if (currentBuild.result == null) {
|
|
|
|
// Hack to have the 'jenkins build back to normal' mail sent
|
|
|
|
currentBuild.result = 'SUCCESS'
|
|
|
|
}
|
2021-01-04 23:48:21 +01:00
|
|
|
if (env.GIT_BRANCH == 'origin/main') {
|
2018-04-26 12:00:08 +02:00
|
|
|
step([
|
|
|
|
$class: 'Mailer', notifyEveryUnstableBuild: true,
|
|
|
|
recipients: email, sendToIndividuals: true
|
|
|
|
])
|
2018-04-25 10:23:23 +02:00
|
|
|
} else {
|
2018-06-08 18:31:59 +02:00
|
|
|
author = sh(returnStdout: true, script: "/usr/bin/git show -s --format='%ae' HEAD").trim()
|
2018-04-26 11:48:09 +02:00
|
|
|
step([
|
|
|
|
$class: 'Mailer', notifyEveryUnstableBuild: true,
|
2018-06-08 18:31:59 +02:00
|
|
|
recipients: author, sendToIndividuals: true
|
2018-04-26 12:00:08 +02:00
|
|
|
])
|
2018-04-25 10:23:23 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-25 19:33:35 +02:00
|
|
|
|
|
|
|
def publish_coverage(report_pattern) {
|
2018-04-26 12:00:08 +02:00
|
|
|
step([
|
|
|
|
$class: 'CoberturaPublisher', autoUpdateHealth: false, autoUpdateStability: false,
|
|
|
|
coberturaReportFile: report_pattern, failUnhealthy: false, failUnstable: false,
|
|
|
|
maxNumberOfBuilds: 0, onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false
|
|
|
|
])
|
2018-04-25 19:33:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-06-14 15:04:24 +02:00
|
|
|
def publish_coverage_native(
|
|
|
|
report_pattern = 'index.html', report_dir = 'htmlcov',
|
|
|
|
report_name = 'Coverage Report (native)') {
|
2018-04-26 11:48:09 +02:00
|
|
|
publishHTML target : [
|
2018-06-14 15:04:24 +02:00
|
|
|
allowMissing: false, alwaysLinkToLastBuild: false, keepAll: true, reportDir: report_dir,
|
|
|
|
reportFiles: report_pattern, reportName: report_name,reportTitles: ''
|
2018-04-26 11:48:09 +02:00
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2018-04-26 12:09:16 +02:00
|
|
|
|
2018-04-25 19:33:35 +02:00
|
|
|
def publish_pylint(report_pattern) {
|
2018-04-26 11:48:09 +02:00
|
|
|
warnings canComputeNew: false, canResolveRelativePaths: false, categoriesPattern: '',
|
|
|
|
defaultEncoding: '', excludePattern: '', healthy: '', includePattern: '',
|
|
|
|
messagesPattern: '', parserConfigurations: [[parserName: 'PyLint', pattern: report_pattern]],
|
|
|
|
unHealthy: ''
|
2018-04-25 19:33:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-04-25 09:42:39 +02:00
|
|
|
return this
|