Mail Triggering In Jenkins - jenkins

I want to setup a Jenkins in a such a way that it should trigger an email when test case fails. I have some 1000+ test cases, if anyone of the test case fails, it should trigger email.

Use customized robot listeners as part of the framework, so that they trigger an email everytime for failure

Related

Testing Mails queued with Sidekiq

Because we need to have the ability to schedule email delivery, we have migrated to using Sidekiq to send emails with the deliver_later method. Under the old regime that used deliver_now, our testing could use
ActionMailer::Base.deliveries[index]
to inspect the recipient, subject, body, attachments, etc...
For testing purposes, is there an equivalent mechanism to inspect the contents of queued email when using Sidekiq and deliver_later?
For testing contents of the email, you have to render the email template for which the job needs to be executed. I suggest you should separate unit tests:
Job spec to check if email is getting enqueued with correct parameters.
Email spec to check the email contents.
If you want to go the end-to-end style, use Sidekiq::Testing.inline! to execute the job and then use ActionMailer::Base.deliveries[index] like before.
The solution turned out to be to execute perform_enqueued_jobs after all emails were queued. After this, all of the existing testing mechanisms worked.
See https://api.rubyonrails.org/v7.0.4/classes/ActiveJob/TestHelper.html for additional information.

Jenkins-Poll Mailbox Trigger

Can we add(restrict) emailids who can only send emails to trigger jenkins job using jenkins Poll Mailbox Trigger plugin.
As of now any body can send email who knows the subject and job gets triggered.
you can use job restriction plugin to restrict the jobs that who can trigger.
please see for yourself
Job restriction plugin

How to modify the Webhook Step Plugin in Jenkins to meet my pipeline needs

I Currently have a Pipeline built in Jenkins to run my newman Test Cases. So the definition for it is in three steps
Call the Async Test cases.
Register a Webhook and Wait for it to respond back to continue forward.
Call the remaining Test cases.
I'm using the existing "Webhook Step Plugin" to register and wait for my Webhook in Jenkins.
Definition:
Pipeline Definition
Problem:
This resgisterWebhook() method is returning a random URL everytime because it is using the UUID logic to generate a random token. And since its random everytime, my external System cannot know it.
Question:
So i'm looking for a way, where the hook URL will be constant always, so that it can be hardcoded in my external System and called once the Async Operation is completed.
Don't use the webhook step, either use the webhook trigger plugin, or use the generic webhook trigger inside pipeline. (these may be the same thing - I may have just stuttered. Sorry if so!).
Anyway, that lets you set up a static URL you can use to trigger builds.

Send multiple email messages using email-ext plugin in Jenkins

I am using Jenkins email-ext plugin to send email messages. I would like to send 2 email messages - one with 1 attachment that is sent to 1 person and a second email with another attachment sent to another person.
Is that possible using this plugin? From what I have found in the documentation it seems that only one email can be sent.
Thanks in advance.
You could modify your process to use three Jenkins jobs; one for the build, and two for emailing.
Use the Jenkins Parameterized Trigger Plugin to have the build job start the email jobs when it's done. You can either pass in the location to the zip files or some other parameter to know what zip file to use in the email jobs. In "Projects to build" you put the name of your email job. You will add two triggers; one for each email job, passing in unique parameters to each.
If you setup multiple triggers, multiple emails will be sent out. You can have multiple triggers of the same type as well, so if you want to send out two emails for failure, just add the failure trigger twice and setup different recipient lists. Each trigger can generate a separate email.

Is there a way in Testdroid to email test reports?

Is there a way in Testdroid to email test-reports automatically?
Ideally I would like to set up a configuration where after every test run, we can send everyone on a team the test results.
Test finished hook:
Test finished hook: If you set hook URL, POST call will be sent to that URL when test run is finished.
But you will need to implement a web service etc for the mailing function.
Testdroid Cloud integration API
http://help.testdroid.com/customer/portal/topics/810087-testdroid-cloud-integration-api/articles

Resources