vsts detailed notification after build or test fail - azure-devops

I am trying to make vsts email me with a detailed transcript of why a test or build fails. At the moment all I am getting is te following email:
All this mail tells me that a test has failed but not what test or what the problem is. It does give me a link to open the build report in web access which has all the information about the type of error and even the stacktrace.
Is there a way to get this detailed information (error message and stack trace) into the email or can i make vsts send a custom email with this information?

It seems you are using VSTS default notification template (as a build fails template).
For now, there is no way to custom the notification template. And there has an user voice Customise VSTS email templates which suggest this feature. You can vote and follow up.
The workarounds for now as below:
Option 1: Click the link "Open Build Report in Web Access" for detail build logs.
Option 2: Add Send Email task at the end of your build definition, and select "Only when a previous task has failed" for run this task option, so that email will be sent if the build fails. And you can custom the email body as your need.

Related

Best way to send email notification in an Azure DevOps build pipeline? Do not want to use "Notifications Module"

I would like to send email notifications as a task in my Azure DevOps build so that I can copy the build to other team projects and have it work automatically. I don't want to setup notifications for every new project I create. Thanks!
You can install the Send Email task from the marketplace, and add it to your build pipline.
The extension takes care of sending email within your build or release pipeline.
But better way is configure a global notification settings for the builds.
I tried to use "Send Email" to send something from my gmail but it didn't work out. I got the error message below
The SMTP server requires a secure connection or the client was not
authenticated.
If you have a similar problem, I recommend you using SendGrid. It's more easier.
Just create a resource "SendGrid" on Azure Portal.
Create an API Key from SendGrid.
Configure the pipeline with the key.
That's it. You don't have to config any SMTP setting and figure out what it is.
For an alternative solution, you can try CatLight notification tool.
It will show desktop alerts about build and release problems, as well as new PRs and work items.
You can configure a shared dashboard for the team, and select all relevant projects and pipelines there. After that, the team members will be notified about failed builds and releases. Team members can also update those monitoring settings themselves at any time.
Azure DevOps can send too many notifications, and when developers check their inbox, many of those notifications are outdated. So, after a while they configure filters to hide them, defeating the purpose of notifications in the first place. CatLight has a dashboard that will show a summary of active alerts, and they will disappear from it as soon as alert is resolved. So it will be less noisy, and harder to ignore than emails.
The tool is free for small teams and open-source, and their is paid version for companies.

Send JUnit HTML report to Slack using Jenkins

I am trying to send JUnit HTML report to Slack channel using Jenkins.
I used 'Slack Notifications' step in Jenkins.
Add HTML report link to Custom Message.
file://192.168.185.54/c$/Program%20Files%20(x86)/Jenkins/workspace/ExternalBookingProvider/Results/HTML/ConnectEnterpriseConnector.html
This link successfully send to Slack Channel.
The problem is only users which have access to this server can able to view this Report. I want this should be access by any user who has this link.
How can i do this.
Should i use powershell script to upload it to Online Drive and provide that link?

Is it possible to generate build emails in Visual Studio Team Services for a successful build ONLY if the previous build was a failure?

As far as I can tell from the current interface provided for setting up e-mail alerts for builds in visual studio team services, there is no way to set a condition on the status of the previous build.
I expect this is relevant to many development teams as teams will typically have a build server churning out builds frequently throughout the day and will want e-mail alerts of a failure. Following a failed build, it is useful to also have a success email for the next build. However, you don't want an e-mail for every successful build as you are only interested in this after a failure, the rest is just white noise.
So is there any way to create alerts conditional upon the previous build in visual studio team services, or more specifically to just get success e-mails after a failed build?
There isn't any way to do this with the alerts feature in VSTS for now. You can submit a feature request on VSTS User Voice.
And the alternative way to achieve this feature would be create an application/service to track the build event and send out email notification base on the build status you want via VSTS Rest API or TFS API.

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");