Merge pull request 'feature/21176' (#1) from feature/21176 into master

Reviewed-on: #1
master
ROBERTO CIRILLO 2 years ago
commit e1d7dfb658

46
Jenkinsfile vendored

@ -1,15 +1,25 @@
def agent_root_folder = '/var/lib/jenkins/.m2'
def projects2artifacts = [:]
def artifacts2projects = [:]
def modules2deps = [:]
def alreadyInTheTree = []
def inputProject = params.jenkins_project.trim()
def report = [:]
report['project'] = inputProject
pipeline {
agent {
label 'CD'
}
environment {
AGENT_ROOT_FOLDER = "${agent_root_folder}"
PIPELINE_BUILD_NUMBER = "${env.BUILD_NUMBER}"
WALKER_NOTES = "${agent_root_folder}/walker_notes.${PIPELINE_BUILD_NUMBER}.txt"
}
parameters {
string(name: 'jenkins_project',
defaultValue: '',
@ -69,6 +79,33 @@ pipeline {
}
}
}
// post-build actions
post {
always {
script {
sh '''
cp $WALKER_NOTES ./walker_notes.${PIPELINE_BUILD_NUMBER}.md
'''
}
}
success {
echo 'The dependencies walker pipeline worked!'
emailext to: 'jenkinsbuilds@d4science.org',
subject: "[Jenkins WalkerPipeline D4S] build ${currentBuild.fullDisplayName} worked",
body: "Build time: ${currentBuild.durationString}. See ${env.BUILD_URL}"
emailext attachmentsPattern: "**/walker_notes.${PIPELINE_BUILD_NUMBER}.md",
to: 'jenkinsreleases@d4science.org',
subject: "Dependency Report for gCube component ${inputProject} (build #${PIPELINE_BUILD_NUMBER})",
body: "Downstream dependencies of ${inputProject}. See ${env.BUILD_URL}"
}
failure {
echo 'The dependencies walker pipeline has failed'
emailext attachLog: true,
to: 'jenkinsbuilds@d4science.org',
subject: "[JenkinsDependenciesWalker D4S] build ${currentBuild.fullDisplayName} failed for component ${inputProject}",
body: "Something is wrong with ${env.BUILD_URL}"
}
}
}
// look for modules that use this artifact
@ -144,7 +181,16 @@ def printReport(report) {
text += "\n"
}
println text
appendNotes(text)
}
def appendNotes(report) {
sh("""#!/bin/bash
echo -e "${report}" > $WALKER_NOTES
""")
}
// debug job
def printJob(job) {
println("fullname ${job.fullName}")

Loading…
Cancel
Save