I have 3 pipeline jobs in which there are many stages Pipeline 1 - contain ui stages - it has two parameters - choice parameters for environment, string parameter for branch
Pipeline 2 contain java- it has two parameters - choice parameters for environment, string parameter for branch
Pipeline 3 contain database - it has two parameters - choice parameters for environment, string parameter for branch
I have created one pipeline job and added boolean parameter to select the required pipeline to be triggered. From the jenkins UI, I am able to select the checkbox.
However the selected pipeline job is not executed correctly as it require parameters.
Please help me how to achieve the below requirement:
I want user to select the pipeline job which they want to execute and control all the pipeline from a single job.
I haven’t tried it, but you could maybe use the following approach:
Create a new pipeline job (let’s call it “Main Job”) to control the execution of other pipeline jobs.
Add a Boolean parameter to the “Main Job” to allow the user to select the pipeline they want to execute. Let’s call it “pipelineSelection”.
Inside the “Main Job” pipeline script, use a conditional statement (such as if or switch) to check the value of the “pipelineSelection” parameter.
Based on the selected pipeline, trigger the corresponding pipeline job using the build step and pass the required parameters to it.
The problem I see with this approach is that you would have to give all the parameters for all the pipelines upfront… which is not elegant.
pipeline {
agent any
parameters {
booleanParam(name: 'pipelineSelection', defaultValue: false, description: 'Select the pipeline to execute')
// Add other parameters for all the different pipelines
// Ugly, isn't it?
}