i have 2 functions which I like to execute them in parallel, each job will run on slave or where there are enough resources. the problem is that I dont want to create pipelines in Jenkins GUI and then from that pipeline to execute my function. i like to be able to create the pipeline on the fly in code. this is example what i have now :

//downstream job
build job: "my_job_pipeline_1",
parameters: [string(name: 'PROJECT_NAME', value: "${PROJECT_NAME}"),
propagate: false,
wait: true


//downstream job
build job: "my_job_pipeline_2", 
parameters: [string(name: 'PROJECT_NAME', value: "${PROJECT_NAME}"),
propagate: false,
wait: true 

This called from my main pipeline but for this to work I have to create 2 pipelines in Jenkins GUI
my_job_pipeline_2 and my_job_pipeline_1
can i create those pipelines programmatically ?

1

There are 1 answers

1
smelm On

The Jenkins CLI allows you to create jobs from the terminal. Follow the documentation to set it up. Under Manage Jenkins > Jenkins CLI you can find the available commands (including "create job")