Attaching zip file in Jenkins Editable Email Notification is not working - email

I am trying to add report.zip file (which is present in workspace) in Jenkins Email notification attachment, but not receiving emails whereas When I attach report.html file(which is also present in Jenkins workspace), I am able to receive the emails and attachment.
Zip File size : 334KB
I tried report.zip, **/.zip, /.zip. But nothing works. Can anyone please help!
In Jenkins console, not seeing any failures, seeing the success message.
Archiving artifacts
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
Email was triggered for: Always
Sending email for trigger: Always
Sending email to: abc#gmail.com
Finished: SUCCESS

Related

How to restrict build failure emails to only a CRON JOB in travis CI?

I have email and slack notifications configured for travis build failures. Currently It sends notifications for build failure of every branch. Since every developer does creates lot of branches, the mails come in a large number which sound like spam. I would want to restrict the mails only for failures of CRON Jobs.
My configuration in .travis.yml is something like this.
notifications:
email:
recipients:
- xyz#abc.com
on_success: change
on_failure: always
I tried adding a condition i.e. if type = cron, but did not work.

Sending test result mail through jmeter

I have incorporated a simple HTTP Request sampler in a test plan. And, viewing the result through "View Result Tree" and writing the same results to a file. I want this file to send through mail Sampler.
Issue is, once I execute the test-case, it sends mail first and then append new test results to the file. So, in mail I got the previous run results instead of the new one.
How can I incorporate this?
Reference Article - Send JMeter Test Reports Automatically in Email
If you use 'View Results Tree' or 'Summary Report' Listeners, you won't be able to send the current report, through mail via SMTP Sampler, even if you use tearDown Thread Group.
Reason : JMeter writes the data to these report files, only after the test is finished completely. You can verify this by adding a tearDown Thread Group and adding a delay before running the SMTP Sampler. Keep an eye on the file size, it is created once the test is started, but data is written when the last thread (SMTP Sampler, in this case) is finished execution.
Hence, only an empty file would be attached with your email.
Solution -
1. Find and modify (or add, if not present) the following section in the 'user.properties' file, setting the autoflush parameter to true:
# AutoFlush on each line written in XML or CSV output
# Setting this to true will result in less test results data loss in case of Crash
# but with impact on performances, particularly for intensive tests (low or no pauses)
# Since JMeter 2.10, this is false by default
jmeter.save.saveservice.autoflush=true
Use a batch script, and send the mail using some other utility after your JMeter Test, as suggested by Ashish.
Problem with this approach is, there is a dependency on another utility. Also, we would require to write different scripts for different platforms (Windows/Linux).
Instead of using default in-built JMeter plugins, we can use jp#gc JMeter Plugins, which provides very powerful reporting elements.
In this case, what we need is a 'Flexible File Writer' Plugin. It provides you powerful customization to configure what data you want to write to your report file, and also it would allow you to include complete report file to be sent via SMTP Sampler.
I was able to achieve this using Flexible File Writer Listener, and tearDown Thread Group. Here is the structure of my Test Plan -
Test Plan
--- Thread Group
-------Sampler
-------jp#gc- Flexible Filw Writer
---tearDown Thread Group
------SMTP Sampler
Here is a snapshot of my File Writer Plugin's configuration :
You may want to add some delay before sending the mail from tearDown Thread Group.
You can download the Flexible File Writer plugin using in-built Jmeter's Plugin Manager, or from JMeter Plugins Site - jp#gc Flexible File Writer Plugin
I observe that JMeter first sends the Email with either blank or old run report when doing it using the SMTP Sampler.
To overvome it, this is what I tried:
I created a batch file to call the Jmeter from command line as:
call jmeter -n -t "script path" -l "JTL report path"
I used a utility called sendEmail which is available in below location:
http://caspian.dotconf.net/menu/Software/SendEmail/
as:
sendEmail -f Sender_Email -t Receiver_Email -cc CC_Email -s Mail_Server -u "Subject" -m "Email body" -a "Path of JTL Report attachment"
What it is doing that it executes the JMeter script, generate the report in path specified in first step and then send Email with the report using step 2.
It might help.
I would suggest sending your email in tearDown Thread Group which is designed for post processing purposes and seems to be exactly what you're looking for.
Also make sure that you wait for reasonable amount of time via Test Action sampler as JMeter doesn't update results file on the fly, it periodically flushes chunks of results.
If you don't want "old" data you can use setUp Thread Group with i.e. OS Process Sampler to delete old results file or move it somewhere else.
For more JMeter email tips and tricks see Load Testing Your Email Server: How to Send and Receive E-mails with JMeter

SQL Server - send email task on job failure

we have a job that runs several times a day making incremental backups.
We have added a step 'Send email on Job failure' that uses T-SQL to send an email to the admins team if the first step (Incremental backup) has failed.
Unfortunately we must have configured the Advanced options in the second step incorrectly, as we are getting an email even when the first step has succeeded.
The email is being sent successfully by the second step.
We have configured the options for the first step as follows:
On success quit reporting success
On failure goto Step 2 - Send email
We have configured the options for the second step as below:
On success quit reporting success
On failure goto Step 2 - Send email
Now, when the task, step 1 succeeds, we don't expect to receive an email. When step 1 fails we expect an email.
So what are we doing wrong?
Not sure if what you have written is truly the step, if it is then this is the reason you are always getting an email.
Step 1 = Fail => Go To step 2. Send Email
Step 1 = Success => Go To step 2. Send Email
You should have the Notifications "tab" configured to sent an email "When Job Fails"

windows task scheduler send an e-mail with result

I am trying to send an email from windows task scheduler with Action tab. But How can I include the Last run result in this mail. I am not getting any option along with it. There is an option of attaching the files to the mail. So if an one could help me is there any logs files generated by the task scheduler when a task is being run? if so where can I find the log ?
You might have to redirect the result into a log file.And then send that log as an attachment.
For send as email , there is definitely an attach button.

How to prevent hudson from sending multiple emails for cron job failures

I have a job in Hudson which monitors the environment.
The requirement is the job should get built periodically and send a mail when the env is down.
But it should stop sending mails if the status of the job in last run is fail and an email has already been sent. How to setup this trigger in Hudson?
First, if you aren't already doing so, you should be using email-ext plugin for sending emails.
Once that is installed, in your post-build actions, use "Editable Email Notification".
In there, click "Advanced..." button to setup triggers that control when (and to whom) and email is sent.
You need at least 2 triggers: Failure and Still Failing.
"Failure" will be triggered when the job fails for the first time. Send the email to everyone whom you want to include.
"Still Failing" will be triggered if there are subsequent failures. In this case, leave the recipient list unchecked (or send only to admin).
You can also use the Fixed trigger. This will send the email after the build recovers from failure (but not on subsequent successes)