I want to automate the process of creating jenkins job and want to trigger a script that will automatically create a job with certain set of required parameter. One way I exploreed is using DSL and parameterized trigger plugin.
As far as my observation over it-
Parameterized Trigger Plugin- used trigger new builds when one build has completed, with various ways of specifying parameters for the new build.
DSL Plugin- Allows the programmatic creation of projects using a DSL.
My requirement is to write a script that create a job with some parameters like string or choice parameters including Source Code Management configuration and build trigger specification.
Any input is appreciated :)
Related
I have a multi-configuration job that has a custom axis for each of our clients, with the selected values determining which config file is used in the build steps.
I'm trying to setup a pipeline to mimic this job but I can't seem to figure it out.
The choice parameter is a single choice only, and the plugin Extended Choice Parameter is suffering from various security issues and hasn't been updated in some time.
Is there a way I can achieve my multi-configuration job in pipelines without using Extended Choice Parameters?
So I need a list of values (client names) that I can select all or some, and have the build run for each selection.
i am new to Jenkins , i need to execute one job that run's another multiple jobs in parallel were it should not stop even if one job fails.
i am not sure how to achieve it. After googling i can achieve by 3 ways Multi-Job plugin , Pipeline multiple Jenkins jobs , Build after other projects , Build Flow Plugin.
can any body please provide me the correct way.
Update : i am trying to achieve this using the pipeline plugin , can any body suggest me were it was correct choice ?..Please suggest!..
We use the Parameterized Trigger Plugin to do this.
In your build configuration add a Trigger/call builds on other projects build step. Add the names of the builds you want to trigger as a comma separated list and make sure that the Block until triggered projects finish their builds box is unchecked. Your build will trigger each of the listed builds, however note that your parent build won't wait for them to finish it will just trigger them and then perform the rest of it's buildsteps so if you have buildsteps.
If you do want to wait then check the block until triggered builds finish box, but set the options for when to fail the build, build step or mark the build as unstable appropriately.
If you need to pass parameters to the jobs you can add parameters using this plugin. If your downstream jobs need different parameters for different jobs you can click the add trigger button which adds another project to build where you can specify different options.
If these other jobs are follow up jobs to the current job and you don't need to wait for them to finish you can also achieve what you want to do by using the post build action build other projects, but again this occurs after the current job and you won't be able to use the results.
can any body please provide me the correct way.
I wouldn't approach using Jenkins with a "one correct way" mentality. Often times the requirements of your build will dictate which method or plugin you use in your build configurations.
The job can start other jobs via the jenkins api.
updated Answer : i used pipeline plugin to achieve my task and tuffwer was right to if u have paramaterized trigger plugin!..
I am using this plugin: https://developer.ibm.com/urbancode/docs/integrating-jenkins-ibm-urbancode-deploy/
Is there a way to push to multiple components in UCD from inside one Jenkins job? e.g. The same Jenkins project compiles Java and produce three components: app1_web, app1_ear, app1_db in UCD. I see the plugin inside the Post Build Action can only be inserted once in the same job. Guess this is a question in Jenkins.
If you use Pipeline rather than the old Freestyle job type, you can use post-build actions multiple times.
Though I don't know which plugin you're using, and whether it supports Pipeline.
In Jenkins, if we use Post-Build Trigger to start another build
What are ENVs available to the new build.
I need to identify, parent builds Name, Build Number, Last Successful Artifacts' URL etc.,
In simple words, how to get upstream project info on a downstream project
Is that possible
You can use the Parameterized Trigger Plugin to pass variables from one build to the next. It is used in much the same way as the Post Build Trigger plugin you mentioned you're using already.
It defines some variables that are passed through to the next job, but you are free to define your own in the box provided, e.g:
ARTEFACT_URL=www.example.com/builds/$BUILD_NUMBER #using another variable from this build
SOMETHING=VALUE
UPSTREAM_BUILD_NAME=myProject
UPSTREAM_BUILD_NUMBER=$BUILD_NUMBER
#note that you shouldn't override any properties likely to be set in subsequent builds!
I am trying to combine nice branching handling of Workflow Multibranch
with powerfull Job-Dsl plugin Job generation. So basically I want branch to regenerate it's jobs from script in repository and run the main one.
But I don't see a way to run Process Job DSLs step from workflow script. May be there is a built in way to execute custom steps in Workflow, but I just can't find it.
You could create a separate job that processes the job-dsl, and then call it with the proper parameters from the workflow via a "build job: xxx" step.
Not quite sure where you are going with this, but perhaps what you really want is multibranch binding for Job DSL, or to manually iterate branches.
Alternately, with Workflow alone you can probably accomplish your goal, whatever that is.
It seems that the jobDSL method can be used in the pipeline.
Have a look into the Snippet Generator to generate some code :