Jenkins - Wait for the manual step to finish in parallel with some automatic job - jenkins

I'm trying to build the above 'delivery pipeline' using Jenkins.
Every job excluding "Manual Step" will run when upstream jobs end with success. My problem is that I cannot do 'join'
between the two jobs (run "Manual Step" and "Auto Step" in parallel and wait for the 2 to finish sucessfully before "Final Step").
Is there any way to make this possible with Jenkins? Maybe some plugin?
This question is very similar to this one: How do I make a Jenkins job start after multiple simultaneous upstream jobs succeed?
But what I really want is to know if it is possible to parallelize two different types of jobs (jobs who run manually and jobs who run automatically).

Since it's been a time since I posted the question and it seems there is no elegant solution to the problem I'm going to share my work-around:
First, I edited the two jobs so that a new file is created whenever the Manual and Automatic Jobs finish successfully (1 file for each job).
Next, I put a validation on the 'Final Step' job to only run if the two files are created. If the two files are created, proceeds to the 'Final Step' job instructions

Related

Jenkins - Job Y is configure to run after Job x, but is not triggered

I have a Jenkins server on K8s (using Rancher).
Job Y is configured to run after job X (image is attached).
Job X runs successfully, but at its end, job Y is not triggered.
Both jobs are on the same Jenkins master.
This problem has never happened to me before, on our Jenkins on prem servers.
I have checked everything I could think of, including creating test jobs that basically do nothing, just in order to test if the triggering is working for other jobs on this master, it does not.
Checking the logs - job x is in the log (image is also attached), job Y is missing from the log completely.
I will mention that on another master on the same cluster, triggering is working. Any ideas?
check the trigger condition for job Y.
Below is the one way you can trigger jobs in Jenkins
Chain jobs together
Chain Jenkins job together using the “Build other projects” option in the “Post Build Actions” of a job. The downside to this is that it introduces a dependency between jobs. For example, I want to be able to run the database backup job without doing a deployment every time.
Parameterized Trigger Plugin
When you have the Parameterized Trigger Plugin installed:
Create a wrapper job for your sequential jobs
For each sequential job
Select Build->Add build step->Trigger/call builds on other projects
Enter the sequential job name
Check the ‘Block until the triggered projects finish their builds’ checkbox (this only appears when you have the Parameterized Trigger Plugin installed)
Now when you run the wrapper job, all the triggered jobs will be run in order and sequentially. You of course also have the option of using the parameters functionality of the plugin too.
Throttle Concurrent Builds Plugin
The docs for the Throttle Concurrent Builds Plugin seem to be a little lacking, but it works well. With it installed, a “Throttle Concurrent Builds” section shows up in the Jenkins config section (Jenkins -> Manage Jenkins -> Configure System). There, you create a “Multi-Project Throttle Category”
Next, for each job that needs to be run sequentially, you
Check the ‘Throttle Concurrent Builds’ check box
Select the ‘Throttle this project as part of one or more categories’ radio button
Check the checkbox of the “Multi-Project Throttle Category” you created above
Save
Finally, you create a wrapper job that triggers all your to-be-run-sequentially jobs and when you run it, you should see your jobs running sequentially and in order.
Although a fairly complex option, this approach also allows you to run some jobs sequentially and others in parallel. For example, your wrapper job can run jobs A and B sequentially and jobs C and D sequentially, but trigger A and C in parallel. You can also combine this plugin with the Parameterized Trigger Plugin for maximum flexibility.
Join Plugin
Although I haven’t used the Join Plugin myself, it seems worth mentioning. Its docs state that
This plugin allows a job to be run after all the immediate downstream jobs have completed. In this way, the execution can branch out and perform many steps in parallel, and then run a final aggregation step just once after all the parallel work is finished.
That’s it. Several options for running Jenkins jobs in parallel. Choose the one that best suits your needs…

Jenkins executing one job that runs multiple jobs

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

How to make a cycled sequence of jobs in Jenkins?

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

Jenkins to run 10 jobs sequestially and few parallely and only run jobs what I choose

Jenkins to run 10 jobs sequentially and few parallely and let say 1-2 jobs are successful and job3 failed. I fixed the job3.Now I want to again trigger the job but only want to trigger it from job3.All 10 jobs have string parameter.
I can pick an choose what jobs to trigger. how can I achieve it.Please help.
The whole point of CI is to have multiple runs frequently, so that in next run you can see them all stable. Not sure why you wanted to do this. However, You can take 2 approaches.
You can use conditional Step plugin along with multiphase plugin,
wrap you build step with condition and pass whether you want to run
it or not. only if the condition is passed then the individual jobs
will be triggered.
You can use jenkins-cli and trigger the jobs
which ever you wish.

How do I get all build steps to execute in Hudson/Jenkins?

I'm using Jenkins to build a number of client libraries to my system, each one targeting a different language. My configuration consists of a number of distinct build steps, one for each language, building and/or testing the library.
Right now, a breaking change in the system will cause the first build step to fail, and no other build step ever gets run, which is very inconvenient. I need to run all build steps, so that I can see all resulting errors.
One alternative would be for a configuration to exist to tell jenkins not to abort latter build steps if earlier ones fail. I didn't find any such thing, but maybe there is.
Another alternative I thought of was to trigger each language as a separate build, but then I have to tie them all up for my post build steps, and I'm not sure how to do that.
And, of course, there might be something I'm missing.
Any of the above would solve my problem. So, what should I do, and how do I do it?
The Multijob Plugin is what you are looking for. I use this plugin a lot. Take a look at their screenshots - You can specify three options on how to mark a Phase(a Phase can have multiple jobs) as successful
when the Phase Job's build was successful
even if the Phase Job's build was unstable
even when the Phase Job's build failed - this is what you need
In your case, you can create a Multijob Job that has one phase for each 'client library'. And add your respective 'client library' jobs into their Phrases. So if you have 10 'client library' jobs then you will end up having 10 Phases (one for each) in this MutliJob. And don't forget to set the 'Mark phase as successful when phase jobs' statuses are' as 'Complete (always continute)'
I usually don't prefer using Downstream Jobs for this purpose, because, there is no nice UI in Jenkins to look at the whole build flow in a single page. Ofcourse there is this Build Pipeline Plugin that shows each and every build flow status. You may choose the right plugin based on your need.
To make this work in one job, I think you need to make the build steps to not fail (return non-zero exit code). Then you need a post-build step which analyzes test results and marks build failed or unstable, if needed.
You may need to write a wrapper script to do the build, such as simple .BAT or shell script, which has exit 0 as last line, after running the build/test actions.
Example of a post-build action which does this kind of test result processing is Publish JUnit test result report.

Resources