Developer team needs a pipeline should only be allowed to start only if another related pipeline has completed and they need the pipeline view on same page
It is something like this , a set of stages complete and the next stages would start when project manager starts the pipeline manually .
Simply they need to visualize both pipelines in a single page like below picture.
(https://puppet.com/sites/default/files/2016-09/puppet_continuous_diagram.gif)
You can use the step build job: '<first_pipeline>', parameters: [...] in say, stage 1 of your second pipeline as a upstream job. Then define the steps of your second pipeline from stage 2 onwards. This will make sure that the first pipeline is always built when you trigger the second and also works with delivery pipeline view for single page visualization.
Or, if you just want to check if the first pipeline is completed without actually triggering it, use the api <jenkins_url>/job/<first_pipeline>/lastBuild/api/json in stage 1 of your second pipeline with a while loop to wait until the status is “completed”.
I haven't heard of a way to link them, but you could write the steps in the same pipeline.
You can work with input steps to ask for the project manager to confirm. Note that this halts an entire build processor until confirmed (or you set a timeout).
You might also want to have a look at conditional steps.
Related
Is it possible to edit/save the code of "Job Configuration" (the structure and order of UI elements) ?
The pipeline job get the pipeline code from git, but this occurs only AFTER the job started. I want to edit the UI of job parameters (BEFORE user press "build")
Its necessary for 2 reasons :
its much easier to cut/paste text lines, than move elements up/down with the mouse.
can be saved and deployed easily on a new Jenkins machine
You can edit the configuration before the job is run to add the initial build parameters. If you then have the build parameters also defined in the pipeline, the parameters will be overwritten with the ones defined in the pipeline.
However, for that first build, if the build parameters defined in the job configuration and the ones in the pipeline match, the build parameter values will be used in that initial run.
I am trying to build a pipeline that gets triggered by other pipeline and should not be able to be queued by itself. I am unable to find a way to do the same. Any help would be greatly appreciated.
Updated:
Structure i am looking for is PipelineA triggers PipelineB and waits for PipelineB's completion. If i add a trigger saying start when completed it wont trigger PipelineB since A is technically not complete.
Thanks
Assuming you are using Azure DevOps, you can add a pipeline trigger to run your pipeline upon the successful completion of the triggering pipeline.
To prevent triggering two runs of a pipeline, you must remove its own CI trigger or pipeline trigger.
We do not have this build-in feature at present. You need to customize yourself.
Triggering a pipeline can be done via the API and trough PowerShell. You can write your own script file and use the PowerShell tasks.
Then you could use Rest API to query to build result for you have triggered above.
Finally use a task Conditions.
Inside the Control Options of each task, and in the Additional options
for a job in a release pipeline, you can specify the conditions under
which the task or job will run.
Unless the query result of you trigger build PipelineB is completed/succeed. Then you could continue to run left tasks in Pipeline A
I am using scripted jenkins pipeline to run our CI pipeline.
We want to capture the time taken by each stage and store it in mongoDB which gets picked up for further processing.
I had 2 options so far -
Make a call to the pipeline-stage-view-plugin at the end of the pipeline. This API will give me details of all the stages but there is no way I can know what is the end point of my pipeline. THere are so many stages and the pipeline can fail or end at any of the stage.
Make a call to update mongo at the end of each stage and keep updating the collection after each stage.
Is there any better way to capture the time taken & build result of each stage after the stage gets executed ?
I think your best bet is #1. Use the post's section "always" to run a step regardless of the completion status (SUCCESS, FAILURE, UNSTABLE, etc.) of the pipeline or stage run.
For more details: https://jenkins.io/doc/book/pipeline/syntax/#post
I am using the Delivery pipeline plugin for grouping my jobs into stages.
Currently, there seems no mechanism to directly go to a particular older pipeline instance in the view.
I wanted to provide a provide a mechanism(posssibly a link) in the Initial job(JobI) of the pipeline so that whenever I click on a particular build of the JobI, it should redirect me to that particular pipeline instance of the pipeline view directly.
I also tried to achieve the above behavior via some other pipeline plugins i.e Build pipeline etc. but no solution.
The idea is to make the view easy to use for a user,so that he does not have to take the pain of scrolling through all the instances to get to a particular instance.
I want to replicate the behavior of the "builds in the jobs" for the "versions of the view" or similar to that.
Any help/suggestions would be great.
Try Build Graph View Plugin to view the executions of downstream builds.
But this plugin doesn't have a grouping of jobs as stages, it is plain flow graph.
I want to create a Jenkins job ( stage 1) that will gather all parameters needed throughout a build pipeline as i do not want to hard-code each stage individually as they are likely to change regularly.
In the pipeline at stage 3 there will be 5 simultaneous jobs being run with each containing different parameters which will have been got from stage 1.
Is there a way i can gather the parameters i need in stage 1 using a cron job which will be available for subsequent stages ?
I think what is throwing everyone off answering your question is the "cron" part. What has "cron" got to do with any of this?
If we ignore that, there is an answer here that deals with a similar situation:
How to build a pipeline of jobs in Jenkins?
Using the Parameterized Trigger Plugin, you can collect all your parameters in the first job, and then just pass it from one job to another as environment variables, using this plugin.