Retrieve console log from a nested job in jenkins - jenkins

I have a Matrix job (Job A) with that call build sub job (B) using Jenkins Parameterized Trigger plugin.
In the Parent Job (Mtrix) i use Editable Email Notification to trigger each configuration.
I want to get 15 lines from child job (B) build log for each configuration to add it in the email (if the build fails).
How can I do such thing ?

This plugin allows you to configure every aspect of email notifications. You can customize when an email is sent, who should receive it, and what the email says.
here is the link : https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin

Related

Jenkins: no email to recipients (integration with GitLab)

I'm using Jenkins (with Email Extension plugin ... ), integrated with GitLab.
For my job in my post build actions configuration, I see this (note that the recipients list is empty ...)
When the job fails I see this in the console output
15:29:50 New run name is '#25'
15:29:51 Sending e-mails to: name1.surname1#mydomain.com name2.surname2#mydomain.com
name3.surname3#mydomain.com
and emails are sent.
Where are these names found/are coming?
Any suggestion will be appreciated.
Your E-mail Notification is configured with the Send separate e-mails to individuals who broke the build option enabled. This makes the Mailer Plugin send a notification to each e-mail address involved in committing Changes for the build in case the build failed.
Changes and their authors are shown at each job page.
For example, there are 4 Git commits from 4 different authors (identified by email). Those commits gets pushed to the Git server and Jenkins job gets started. The job picks all those new commits and fails. The plugin then picks all distinct emails from the commits and sends an email to each commit author assuming at least one of them broke the build.

Jenkins Email notification for multiple builds

I need suggestion for Jenkins project (multi-conf or pipeline) and plugins that will fit my work.
I have 10 "flavors" of the product, so I must build 10 times every time I commit to the repository (all in the same workspace, run in sequentially). Today I have 10 jobs (freestyle) and a "master" job that trigger the rest. I tried to add Email notification (using Email Extension Plugin) but I want only one Email report for all the builds, not 10 Emails.
I understand that I should change to one multi-configuration project or one pipeline project that will handle all the builds, so it will be easier to trigger only one Email, but what is the best practice to get only one Email report on multiple builds?
This is the exact scenario which we can achieve using Pipeline job(Jenkinsfile) from which you can trigger all those freeStyle build-jobs in parallel and collect the build-url and build-status of those and store in some file, then use the email plugin in the post-build task to send the status of your complete flow.
You can use the following link to find how to access build variable post calling that inside your pipeline.
How to I get the url of build triggered with build step on Jenkins?

Build Jenkins Job based on voting result

I have a scenario where on commit to repository branch let say UAT triggers a jenkins job or send email to multiple users. So when all of them click button in email or link Then is It should trigger the jenkins job build.
Can it be done if So then how. I tried to search but could not find a solution.
You could use a Promoted Builds Plugin
Your job could includes an email notification to the person/group responsible for approval. The email contains a link for promotion and an optional comment for approval notes:
Once approved, the next job will run.
I suggest you, using it with a pipeline strategy.
Sources :
https://blogs.perficient.com/2017/06/14/jenkins-delivery-pipeline-and-build-promotion-2/
https://www.cloudbees.com/blog/another-look-jenkins-promoted-builds-plugin
https://www.cloudbees.com/blog/continuous-integration-mobile-apps-jenkins-promoted-builds-qa-process-and-beta-distribution

Jenkins Global Email Notification Setting

I have a Jenkins configuration with ~100 jobs. Whenever any of those jobs fails I want an email notification to be sent to a particular email address. How can I do this without adding a post-build action for every individual job?
There is something like Configuration Slicing Plugin https://wiki.jenkins.io/display/JENKINS/Configuration+Slicing+Plugin. It enables global configuration different aspects

Executing Jenkins email-ext plugin not as last post-build action

I am using the email-ext plugin v.2.38.1 (post-build action "Editable Email Notification") on Jenkins v.1.566 to send e-mails after the build when certain conditions are met.
When using multiple post-build actions, I got the impression that the email-ext plugin always comes last and is executed after all other actions, no matter how I put the order of actions in the configuration. Other plugins respect the order and are executed accordingly as described in this issue.
Is there any possibility to execute another post-build action after sending the e-mails? In my case, I would like to run a shell script doing some clean-up in the workspace which cannot run before because it will delete a file that is part of the e-mail body.
One could work around this by defining an extra clean-up job which is triggered after the main job is completed, however, I would prefer having everything defined in one job only.
The emailing is a publishing action which occures always after build and post build actions ..
Additionally I think you should clean something before running the job (at startup eventually) but never at the end.
How can you study your issues if you destroy all materials that should enable you to do so ?
The step Editable Email Notification is always executed at last in the post-build actions, but you can use a Editable Email Notification Templates step which can be executed in the order you specified in post-build actions

Resources