Run a jenkins job without triggering its downstream jobs - jenkins

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)".

Related

How to get downstream job's build status and trigger another job?

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).

How can I ask jenkins to execute one job before another job?

I will create many jobs everyday, each of them depends on one job called baseline. Sometimes I may forget to execute the baseline job manually.
I want to know If the baseline job can be executed automatically before the target job is executed.
What I want is : I only need to one click my target job, then the target job will not start until the baseline job was scheduled and finished.
Probably the thing you need is "Build another project" in "post build actions".

Jenkins, Do not trigger "post build actions:trigger parameterized build" when built manually

I have a job that, when complete, starts another job through post-build actions:trigger parametrized build. However at times, I wish to just run one specific job manually (not through the timer) without chaining off the rest of the jobs. How would I accomplish such a task.
Thanks in advance!
You can't in your current setup.
You want the Flexible Publish Action to make your post-build action conditional (probably based on parsing the console log for indication that the build is manual)

Include a different job in a job's build steps in Jenkins

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.

jenkins promoting builds with Paramaterized build parameters

I have Job A and Job B. Job A is having it's own few build parameters settings and Job B is having it's own other build parameters. Now, I want to promote few selected builds from Job A to Job B using promoted builds plugin by providing user inputs for the required parameters to Job B. Let me know how we can prompt and get the values for Job A build promotion.
Regards,
Srinivas
For general usage of promotions with builds, read this answer How to promote a specific build number from another job in Jenkins?. It may give you ideas so that you won't have to pass extra parameters manually.
If you still need to provide parameters to Job B, here are some options:
Create multiple promotions on Job A triggering the same Job B, but with different parameters (through Parameterized Trigger plugin). This is essentially what I am doing in the linked answer. I have 1 deployment job (Job B) which takes various parameters for various environments. And I trigger it by having multiple promotions on build job (Job A), such as "Deploy to DEV", "Deploy to QA", and so on. Obviously this only works when you have a finite number of parameters to pass to Job B.
Use "manual approval" checkbox. When checked, you can further provide "Approval Parameters". The approving user will be prompted to provide those when clicking "Approve" button. Please note that "manual" approval parameters cannot be changed with "Force Promotion/ Re-execute Promotion" buttons.

Resources