My Jenkins pipeline is set up like this:
I have a job A which is the upstream job and on completion of it, Job B and C which is the downstream job's gets triggered. I have done this using 'Trigger Parameterised build on other projects' in the post build action of job A
What i need is, once job B and C are completed, i need to trigger another job - job D. And i want job D to start only when both job B and C is completed.
How can i do this? Can you please help or suggest any other way in which i can achieve this?
In job D you could use Build after other projects are built option in Build Triggers section. In the Projects to watch field enter job names you want to wait for (e.g. Job_B, Job_C).
Related
Consider that I have jobs A,B,C,D in Jenkins.
Job A- contains my common code dependencies.
Job B,C,D- These are independent jobs, which refers to the dependencies in Job A.
Please note that A and B,C,D(have the upstream downstream relationship). I have added build triggers in each of them such that, each time a code is merged in GIT, it triggers the job.
The problem what I face is, Each time when the build is triggered for B, it invokes A. Now A has a list of downstream jobs C and D, it builds C and D jobs too. I want to make sure that, if B is triggered due to a commit then it should build only A and B jobs and not C and D.
I think there is a wrong configuration which i have set, kindly suggest.
I use jenkins version 1.643. Please let me know if there are plugins which can help me handle it.
I have a jenkins job named "a", that triggers job "b" after it finishes successfully (job "b" is on the down-stream of job "a")
Is there a way to run job "a" without automatically triggering job "b"?
Maybe some kind of plugin ?
Disable job "b". Then it won't run even when it's getting triggered from "a".
If you need a more dynamic/automated solution, then you can also disable/enable job "b" from within job "a".
If you check your configuration on the UPSTREAM job, you must have added a POST-BUILD step, just as shown below and there would be a possible selection out of what is displayed here. The Job B that you talk about, it will be triggered based on the outcome of Job A and by the choices that are available, it will be triggered irrespective of the choice that you make from the drop-down.
Hence the only option left out is to DISABLE it, on scenarios (the outcomes of Job A) that you think where Job B should not be triggered.
Hope this helps!
Post-build action in job "a" that is of a type "Trigger parameterized build on other projects" will trigger project "b" automatically. Replace the post-build action with type "Build other projects (manual step)".
I'm new to Jenkins. I have a stack of 5 different jobs. I want them to execute endlessly, meaning the first one will start after successfull finish of 5th. Is there a way to do this? Is Jenkins pipeline plugin the right tool to make this?
If you already have 5 non-pipeline jobs, the easiest way is to
set a downstream job on each job as it makes a loop.
In the configuration page of each job, Add post-build action > choose Build other projects > Enter a name of a downstream job.
in pipeline there is a build step (https://jenkins.io/doc/pipeline/steps/pipeline-build-step/), but I haven't tried if this can take trigger itself (most probably).
I need to promote a deploy job, but have only the Kitver which is a parameter passed from the last downstream job.
So let us say the following jobs
A builds and compile and creates a zip with version and pushes to a ftp server. I don't store artifacts on job workspace.
B does the deployment by taking the Kitver passed on to it from A.
C does the testing
All the above is a build pipeline process so all of them happens sequentially.
D is a Prod deploy job, not in the pipeline but needs to be connected to A job using a promotion process. How to pass the Kitver to this job using promotion?
I am assuming the job A is the one that has the promotion process configured.
Perhaps you would store the Kitver into a file and archive it has a build artifact.
When the promotion process runs, it has a parameter, PROMOTED_BUILD, which is the build which is being promoted. If you pass that number to job D as a parameter, D can get the file and read the Kitver.
Alternatively you can get the file in the promotion process, read the file and pass Kitver as a parameter to D. Please note that this has to be done carefully. The promotion process runs in the same workspace as build A. The promotion process may be running at the same time as the next build of A, so they must take care not to touch or delete each other's files.
It would be safer to simply pass PROMOTED_BUILD to D and let D do all the complicated things because D will have its own workspace.
I am trying to make this rather unique build flow and I haven't found a plugin or a way to do it with jenkins yet.
There is one job called "JOB A" which is used by itself and creates a standalone installer.
Then there is "JOB B" which creates another installer but it needs to include everything built in "JOB A" in addition to some other stuff. Now I could just copy JOB A build steps into JOB B, but I want to actually build JOB A and maybe even use those artifacts later as well.
It cannot be a build trigger cause JOB B needs to continue building after JOB A has finished and I cannot use something like flow because that creates JOB C and only sequences other jobs and I would need to go into A and B to get the artifacts.
Bonus points would be if it checked JOB A source code in git for any changes since its last build when building JOB B and decide if it needs to build it again.
I looked at many plugins and I can't seem to find one that would do this.
I hope my explanation was not confusing. Sorry if it was, I could elaborate.
If I understand correctly what you want, then what you need is:
Custom (shared) workspace
Parameterized Trigger Plugin
For both, JOB A and JOB B, setup Custom Workspace to the same folder on the server (You can even leave JOB A workspace as is, and just point JOB B custome workspace to workspace of JOB A. I am not at my work computer with Jenkins and can't provide screenshots, so I will borrow this great guide for more info on how to setup custom workspace
Then, whenever appropriate, have JOB A execute a build step Trigger/call builds on other projects, namely JOB B. You can even pass it all the same parameters that JOB A had. By default, this will not wait for JOB B to complete. It will kick off JOB B, meanwhile JOB A will finish running, and then JOB B completes whenever it is done.
If needed, you can check-mark Block until triggered projects finish their builds, and then JOB A will wait for JOB B to finish before continuing.
So, the above will:
Share workspace, and not do extra checkouts if code didn't change
Let JOB A and JOB B exist independently, with it's own artifacts, and each being able to be triggered separately.
JOB B will get everything from JOB A through shared workspace and passed parameters.