Forum Discussion
ChandanD
Contributor
This is too much maintenance. I want to achieve it with one build job. It should be possible.
I feel sbellary idea and solution would be best. Just need more details how to configure the build job.
sbellary
2 years agoOccasional Contributor
ChandanD This is the Jenkins Pipeline Job I created based on your scenario just an example. Hope this helps...!
pipeline {
agent any
parameters {
Choice(
name: 'Projects',
choices: ['Entier Suite','Project1', 'Project2', 'Project3'],
description: 'Select the required Project.'
)
}
stages {
stage('Entier Suite') {
when {equals expected: "Entier Suite", actual: "${params.Projects}"}
steps {
script {
try{
downstreamJob = build job: "EntierSuiteJob", propagate: true, wait: true,
parameters: [
string(name: 'Parameter1', value: "${Parameter1}"),
string(name: 'Parameter2', value: "${Parameter2}")
]
} catch (Exception e) {
echo 'Exception occurred: ' + e.toString()
error("Exception occurred at ${stage_name} --> " + e.toString())
}
}
}
}
stage('Project1') {
when {equals expected: "Project1", actual: "${params.Projects}"}
steps {
script {
try{
downstreamJob = build job: "Project1Job", propagate: true, wait: true,
parameters: [
string(name: 'Parameter1', value: "${Parameter1}"),
string(name: 'Parameter2', value: "${Parameter2}")
]
} catch (Exception e) {
echo 'Exception occurred: ' + e.toString()
error("Exception occurred at ${stage_name} --> " + e.toString())
}
}
}
}
}
}
Related Content
- 12 years ago
Recent Discussions
- 6 hours ago
- 4 days ago