Hello: I have a pipeline project at Jenkins called "ProjectLaunch" that launches other projects automatically one day a week. I would like to show in "Edit Build Information" a text that says something like "ProjectCalled full launched", in the project that is called. With the pipeline I have in "ProjectLaunch" I can only get that text in its "Edit Execution Information" but not in the projects called. Image of ProjectLaunch
My pipeline:
pipeline {
agent any
parameters{
choice(choices: ['EVOLUTIVO','PRODUCCION'], description: '', name: 'EntornoBaseDatos')
choice(choices: ['EVOLUTIVO','PRODUCCION'], description: '', name: 'EntornoDeSerV')
choice(choices: ['Chrome','MicrosoftEdge'], description: '', name: 'Browser')
}
triggers {
cron('H 23 * * 6')
}
stages {
stage('Limpiar nodos'){
steps {
build job: 'Clean Nodes', parameters: []
}
}
stage('launch Jobs') {
parallel {
stage('ProyectCalled') {
steps{
script {
currentBuild.description = "ProjectCalled full launched."
}
build job: 'ProyectCalled', parameters: [string(name: 'EntornoBaseDatos', value: params.EntornoBaseDatos), string(name: 'EntornoDeSerV', value: params.EntornoDeSerV)]
}
post {
always {
copyArtifacts(
filter: 'target\\allure-results\\*',
projectName: 'ProyectCalled',
selector: lastCompleted()
)
}
}
}
}
}
}
post('create allure report'){
always{
script {
allure([
includeProperties: false,
jdk: '',
properties: [],
reportBuildPolicy: 'ALWAYS',
results: [[path: 'target\\allure-results']]
])
}
}
}
}
Any ideas? Thank you.
As far as I know, you can't set the build description of a downstream job from an upstream Job. Hence in your Downstream Job, you can have some logic to set the description based on the trigger.
pipeline {
agent any
stages {
stage('Hello') {
steps {
script {
echo 'Your second Job'
if(currentBuild.getBuildCauses()[0]._class == "org.jenkinsci.plugins.workflow.support.steps.build.BuildUpstreamCause") {
echo "This is triggered by upstream Job"
currentBuild.description = "ProjectCalled full launched."
}
}
}
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.