I have multiple build jobs for a project. ie:
projectA is built with different parameters, for SIT, UAT, Staging and Prod DC1, Prod DC2
I use the build ID within the code for cache busting JS and CSS files.
However, there is a little problem here.
I have multiple build IDs for Prod DC1 and DC2.
for example:
DC1: apple.com/me.js?v=45
DC2: apple.com/me.js?v=78
I need one id to unite them all. so that my apple.js?v=blah wont be different in DC1 and DC2. I am also using CDN so this might become a bigger problem.
How can I do this on jenkins?
If all Jobs are connected as Upstream/Downstream way, create a version label parameter in the first Job and pass this label as parameter to the next downstream job till the last Job.
You can use this as the Unique label from starting Job to last Job.
Use Build Name Setter Plugin to set the build name with the unique label for all the Jobs. So that it will be easy to identify the which build belongs to which label.
To have a full visibility of the Jobs use Delivery Pipeline Plugin
Related
I have two jobs that kind of upload the file to the server. Both jobs are the same except they upload to different remote URLs.
Currently, I am using two Jenkins files in the same git repository for these jobs. But these files are almost the same except server URLs are different.
I tried to use the single Jenkins file and passing the server URL as a parameter from a new parent job. These two children's jobs are running concurrently and one of them is succeeding while another one is failing.
So, My question is can we run multiple jobs pointing to the single Jenkinsfile?
My approach works fine but I was making silly mistakes of not passing the workspace name as a parameter and thus both child jobs were sharing a workspace.
After setting the workspace name through a parameter, this approach works fine.
I'd like to run several builds concurrently in Jenkins for the same job. I run at maximum 3 builds concurrently. I want each build to run with a parameter that must be unique from a pool for parameters. For instance, pool=[1, 2, 3]: The 1st build picks "1", 2nd picks "2" and the 3rd picks "3".
I must ensure that different builds can't pick the same parameter.
After building, the parameter is available again.
How can I do it?
Alternative: How can I count the number of builds running in this project and pass it as parameter?
At first, select the checkbox button named build-concurrently-if-neccesary to ensure the same job could build concurrently. you'd better read the help-html seriously before
The isolated environments for building different jobs make that data could not be shared each other in a simple way.
Here is a solution that trigger the buildWithParameters link by jenkins rest api to control the pool in the program procedure of your own.
add a string-parameter in job's config.
post the string parameter to http://$JENKINS_SERVER_URL/job/$JOB_NAME/buildWithParameters
Maybe it's the most convenient way if no available plugin found.
I found a plugin in github and asked the author to publish it. It works well and solves my problem.
Jenkins Parameter Pool Plugin
we have many Jenkins Test Jobs dependening on one library. Every Job has multiple parameters (always identical).
Now the problem is that if we change or add an parameter in the library, we have to touch every single jenkins job configuration.
Is there a way to configure the parameters of multiple jobs in a central place? Like defining the parameters in a file and refering to that? or is there jenkins plugin for that use case?
Thanks,
Marco
You can edit parameters (and much more) of multiple jobs in one place with Configuration Slicing Plugin:
Job Parameters (aka "This build is parameterized") can be configured across multiple jobs at one time through the "Parameters" link. To indicate which parameter you are configuring, note the "JobName[ParameterName]" syntax.
Not sure if this can help if you use some advanced parameters like File parameter, Dynamic parameter etc.
Use Build Flow plugin
You can run same or multiple jobs many times with different configuration.
Use Multijob Plugin and parameterized plugin
You can pass different parameter by using these plugins
For some organizational reasons we have to move Jenkins to new servers. As we are on a old version so a updated is also need on same time. What are things we should consider. Also not sure if we need to configure all jobs in new instance manually or there is faster way to clone them from existing instance. We have around 300 jobs, one master and 7 slaves. We need to set up three masters, one with four slaves and two with three slaves. 300 jobs will split between three masters depending upon there category.
Thanks !!
If I wanted to move Jenkins jobs to 3 different servers with their own plugins - I would:
Create those 3 instances of Jenkins and configure them separately. Make sure that new/resetup slaves are ready to handle new requirements.
Create 3 separate lists of jobs (split from the original list).
Determine which jobs should be run by which Jenkins
Install all the common plugins used by all/most jobs on all 3 Jenkins instances.
Go to the original ${JENKINS_HOME}/jobs and
tar cvfz < jobs_list > jobs.tgz
3 times, separately for each new Jenkins instance
Finally unpack the job archives to corresponding new ${JENKINS_HOME}/jobs directories.
Run tests and install missing plugins after that, if needed. In my opinion, access permissions should be set separately on each Jenkins instance.
I wonder, if it is possible to create generic parametric jobs ready to copy where the only post copy action is to redefine its parameters.
During my investigation I find out that:
- I can use parameters in svn path definition
- I can define the flow of builds using *Build Flow Plugin*
However I cannot force Jenkins to use parameters inside job names definition for promotion process. Is any way to achieve that?
Since I create sometimes branches from master I would like to copy the whole configuration of jobs but only one difference most times is that in the job name definition I replace master with branch name.
Why it not possible to use a parameter as the branch name?
Then when you start to build the job, you can input the parameters based on the branch you want to build.
Or find some way to get the branch info and inject it.
For example, we have one common job, which will monitor maybe 20 projects, if any of those job was merged into git, our gerrit trigger plugin will start to work, and all of job name, and branch is got dynamically from parameters.
Hope this works for you.