Fail/pass Jenkins job by email notification - email

We have an in-company system for creating production builds, and I need to create a Jenkins job to automate those builds.
There is a way to automate the launch of production build. But you can only know the results of the build by an email notification. Furthermore, you can only subscribe to notification using your personal domain credentials, i.e. the same login/pass that you use to log into your computer (and the password changes every month).
So now, Jenkins job is considered "pass" as soon as the build launches, and not when it actually finishes.
I wonder how to make Jenkins pass/fail the job with the given restrictions.
Additionally, I want to avoid:
hardcoding my personal credentials anywhere,
depending on my or anyone else's personal computer being turned on.
Ideas?

I'm not aware of any Jenkins plugin that is capable of receiving e-mails.
If you can manage to store the notifications' content in a file you could use the
Text-finder Plugin in the Post-build Actions of an additional monitor job that runs on a regular basis.
Have a look at Monitoring external jobs, too, whether this is useful for you.
UPDATE:
There is actually a plugin that receives e-mails: the poll-mailbox-trigger-plugin. Install it and do the following:
Create a new Freestyle project named e.g. Build Status Mail Monitor
Build Triggers → [✔] [Poll Mailbox Trigger] - Poll an email inbox
configure as desired
Build → Add build step → Execute Groovy script
◉ Groovy command: add code to change build launcher job's status

Related

Can Jenkins build code to remote servers when triggered by GitHub webhook?

I have a 'master' server (docker container actually) where I want to install Jenkins in order to link it (with webhook) with a github repo, so every time a developer pushes code, jenkins will auto-pull and build the code.
The thing is that there are an arbitrary number of extra 'slave' servers that need to have the exact same code as the master.
I am thinking of writing an Ansible playbook to be executed by Jenkins everytime the webhook runs and send the code to the slaves.
Can Jenkins do something like this?
Do I need to make the same setup to all the slaves with Jenkins and webhooks?
EDIT:
I want to run a locustio master server on the server that is going to have jenkins. My load tests are going to be pulled from Github there, but the same code needs to reside in the slaves in order to run in distributed mode.
The short answer to your question is that Jenkins certainly has the ability to run Ansible playbooks. You can add a build-step to the project that is receiving the web hook that will run the playbook.
jenkins could trigger another job even on slaves. Then if i get correctly your issue , you just need something like that. https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Remote+Trigger+Plugin
You could build your job by name trigger. Also there is another useful plugin called artifactory. This manages your packages and serves. This mean , you can build your code for once and share to slave and slaves could access your build and runs job.

how to send email notification to developer for build failure in Jenkins

I have a continuous integration setup and integrated selenium scripts in jenkins. In case of failure in build, mail notifications should be sent to the developer who commited the changes. I run selenium scripts in jenkins to verify the status of the build. The problem is that if there is any failure, email notifications are sent to the selenium script developer instead of the application developer. It assumes that build is getting failed due to the changes made in selenium script but the actual issue is with the application code.
Is there any way to send mail to application developers for build failure instead of selenium script developer ?
I would have preferred to write this response as comment rather than answer, but due to insufficient rep, am posting it anyways.
If you want to send email notifications to particular email address, check out Email-ext plugin. With this you can add post build action of Editable Email Notifications and control which email address you send notifications and when(if your job fails or success)
First of all, use email-ext plugin as mentioned above. Secondly, ensure you select 'upstream committers' option. As per its own description: "Sends email to the list of users who committed changes in upstream builds that triggered this build." If your application build triggers a selenium build, this is what you need.

Need help to configure jenkins to send report links on mail

I am using Jenkins to trigger my build., Jenkins is hosted on AmazonEC2. The complete build process is mentioned below:
1. Jenkins checkouts the latest build from GiTHub.
2. Jenkins run the complete build & I am getting Build Success Message.
3. After the process is completed jenkins creates some HTML reports in the jenkins user on Amazon EC2.
Now I need to send that particular report link in mail, how would I do that? Is there any plugins available by which I can manage all the reports generated for a single day and can keep the reports of last 15 builds or something.
What I can think of is, whenever a build completes, there should be a process or shell script should run which will copy the reports from jenkins user to some apache available sites and then that report can be sent on email.
please let me know, If I am thinking in the right direction or there is any other way to do the same?
Any help would be appreciated.
You can use Jenkins plugin "Email-ext plugin" to send emails.
If you can get the report into your workspace. then, you can
write a mime message something like this in the plugin.
msg.setSubject("Mail Subject");
def reportPath = build.getWorkspace().child("report.html")
msg.setContent(reportPath.readToString(), "text/html; charset=utf-8");

How to remove a user from recipients of Jenkins build failure email

I'm receiving daily "Jenkins build is unstable" emails for a project I'm no longer working on.
I can see from the build result (build.xml) that I'm in the list of "culprits", because of a commit I made some time ago, and since the build has been unstable for weeks, the list of culprits hasn't been cleared.
Since I'm no longer working on this project, I want to stop receiving email notifications from this Jenkins job. How can I remove myself from the recipients? Should I edit the build.xml of the last build? (EDIT: apparently this approach doesn't work)
It is possible, but a little complicated. First, you need to stop Jenkins or send it to quiet mode to avoid further builds.
As the actual list of culprits is calculated at runtime from all recently failed builds, you need to remove your ID from the culprits list in the build.xml of all failed builds (since the last successful one) where it is listed.
Finally restart Jenkins so the internal data structure is updated from the modified build.xmls.
So, if build 10 was the last successful one, you need to remove the ID from builds/11/build.xml, builds/12/build.xml, etc.
Could you just spam filter/block the email by title in your email client? Most Jenkins build emails will have a common title (with different only in status, build number). Builds from different jobs will have different common titles. So block the "offending" email by title.
To get Jenkins to 'release' you from the culprits, the build has to succeed. If you have access to the job configuration, you can make a fake success build (a simple "exit 0" in the command line will suffice), but this will clear all other culprits too.

Jenkins sending emails for manual builds

Does anyone know of a Jenkins plugin or script that would send out emails when someone does a manual build? We currently have a scheduled daily build for our dev env, but once in a while we need to do a manual build and I would like Jenkins to send an email out when this happens to warn our team that a build is in progress. But I don't want Jenkins to send out emails for the daily build because I think we all can agree that we get too many system emails.
Thanks
You can use the extended email plugin to send an email at the start of a build.
Obviously this means you will have to have separate manual and daily build jobs, but it's the best solution I've been able to come up with so far. If you use downstream job chains, you can still chain the same jobs to the manual and scheduled build so that the workflow remains the same and you don't need duplicates of all jobs in the chain.