I have a jenkins pipeline which I have written using Declarative pipeline syntax. The pipeline is running fine. I am able to view steps and detailed steps.
Now, the client has a requirement where they want to see these steps in a report fashion. They want to show/handover these reports to their audit firm. The thing is they don't want to give their audit firm jenkins access. The audit firm should be able to view whatever is going on in the pipeline.
So, I made the console output of the build in a pdf file. Now, they want to see the steps too.
First is the simple pipeline steps view,
Second is the detailed pipeline steps view,
Now I have to display this in another file.
Is there a plugin to export these steps in a visual format?
If not using a plugin, is there an API from which I can extract the text of these steps? I see they are not available in the /api/json endpoint of a build.
Anything else that can be done?
Thanks.
BlueOcean API has the info you need at
${YOUR_JENKINS_URL}/blue/rest/organizations/jenkins/pipelines/${JOB_NAME}/runs/${BUILD_ID}/nodes/"
Related
I am new to Jenkins. I am working on a project where I need to frequently check if there are any steps failed in the Jenkins pipeline steps area (attached to the image).
I am not able to find anything appropriate on google. Any suggestions or links to the documentation will help me to work on this. Here in the attached I want to apply a filter of the status column where I can apply a filter for error/success steps.
I've imported a dataflow job as a Data Pipeline in the Dataflow Job's UI
been able to set schedule to this pipeline but i can't see the pipeline details
Is there something wrong or maybe i lack permission in the project?
Thanks.
Edit:
Yes I'm able to see the Pipeline on the Main Page, and the individual Pipeline also works and i can see it.
And i can confirm it is indeed triggered by the Data Pipeline schedule.
What permissions do you have on the project? I don't believe it is a permissions issue as you are able to access/view other details in the UI.
Can you view this pipeline on the main page? Also, on the individual Pipeline Details page, what all information can you view?
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.
Is there a way where to store some metadata from Jenkins pipeline job, e.g:
We have a Jenkinsfile which builds a gradle project, creates docker image and pushes it to google cloud
Then a "Subjob" is launched which runs integration tests (IT) on that docker image. Subjob receives a couple of parameters (one of them - the generated docker image name)
Now sometimes that IT job fails, and I would like to re-run it from the main job view, so idealy:
we have a plugin which renders a custom button in blue ocean UI on the main job
By clicking that button a subjob is invoked again with the same parameters (plugin queries the jenkins api, get params of this job, and resubmits the subjob).
The problem ? How to get/set those parameters. I could not seem to find a mechanism for that, expect artifact storage. I could get away with that by creating a simple json/text file and uploading it as artifact, and then retrieving it in my plugin, but maybe there is a better way?
Stage restart is not coming to Scripted Pipelines so that does not look like ant option.
Maybe you can use the Jenkins API to get the details of the build?
https://your_jenkins_url.com/job/job_name/lastBuild/api/json?pretty=true
Instead of lastBuild you can also use the build number or one of lastStableBuild, lastSuccessfulBuild, lastFailedBuild, lastUnstableBuild, lastUnsuccessfulBuild, lastCompletedBuild
There is a parameters key there with all parameter names and values used in the build.
More details on https://your_jenkins_url.com/job/job_name/api/
Also, any reason you can't use the replay button in the IT job?
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.