Send build artifacts in an email via TeamCity - email

Is there any way of sending TeamCity build artifacts which include execution report (*.html) via email when the build is successfully executed?
Thanks in Advance.

Unfortunately it's not possible to send any attachments - you can vote for this issue TW-7318
However you can list/link to the build artifacts but this is also not fully recommended. See the TeamCity Docs

Related

How to send SonarQube report to developers whenever the Azure DevOps build succeeded or failed

I have integrated the SonarQube tasks in Azure DevOps build pipeline. I can be able to successfully the scan my application source code using SonarQube.
I want to share the SonarQube report to Developers whenever the Sonar build succeeded or failed.
For notification settings, first of all, you need to have mail server or you can use popular ones (Gmail and etc.). Have a look at the below article for the every step you need to perform ;
https://www.fosstechnix.com/sonarqube-email-notifications/
Another possible way is if you have limitations in the Sonarqube server;
Create quality gate in Sonarqube based on your profile
https://docs.sonarqube.org/latest/user-guide/quality-gates/
Use following plugin to break your pipeline in case of code were not passed the gate
https://marketplace.visualstudio.com/items?itemName=SimondeLang.sonar-buildbreaker
Create mail notification in Azure Devops to send notification when build failed because of Sonarqube quality gate;
https://learn.microsoft.com/en-us/azure/devops/notifications/about-notifications?view=azure-devops#team-and-project-level-notifications
And as shown below you will see the reason about why pipeline build failed in the mail

Azure Devops Pipelines Test Attachments for successful tests

As noted here:
https://learn.microsoft.com/en-us/azure/devops/pipelines/test/review-continuous-test-results-after-build?view=azure-devops#tests-tab
If you use the Visual Studio Test task to run tests, diagnostic output logged from tests (using any of Console.WriteLine, Trace.WriteLine or TestContext.WriteLine methods), will appear as an attachment for a failed test.
How can I enforce Azure Devops pipelines to publish attachments for successful tests?
Update
riQQ pointed to the another stackoverflow question:Azure DevOps: Console output for green tests is missing
Proposed solution doesn't help me, because they solved using TestContext. We are using xUnit, and there is no TestContext for xUnit.
How can I enforce Azure Devops pipelines to publish attachments for
successful tests?
Sorry but as I know this is not supported behavior for VSTest Task. It's by design that only failed tests should have the log as attachment. And after my check, no extensions in Marketplace extends this kind of option.
So if you do want this option, you may consider using rest api like what riQQ suggests above. Or you can post a new feature request in DC forum, it it gets enough votes, the team would consider it seriously.
Hope it helps :)

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

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.

TeamCity: Best Practices to deploy produced installers (artifacts)

We got a TeamCity server which produces nightly deployable builds. We want our beta tester to have access these nightly builds.
What are the best practices to do this? TeamCity Server is not public, it is in our office, so I assume best approach would be pushing artifacts via FTP or something like that.
Also I have no clue how to trigger a script when an artifact created successfully. Does TeamCity provide a way to do that?
I don't know of a way to trigger a script, but I wouldn't worry about that. You can retrieve artifacts via a URL. Depending on what makes sense for your project, you could have a script set up on a scheduler (cron or Windows Scheduling) that pulls the artifact and sends it to the FTP site for the Beta testers. You can configure it to pull only the latest successful artifact. If you set up the naming right, if the build fails they beta testers won't notice because the new build number just won't be there, no bad builds would be pushed to them.
Read the following help page from the documentation. It shows how you send commands from your build script to tell teamCity to publish the artifacts to a given path.
In TeamCity 7.0+ you can use Deployer plugin. Installation steps can be found here. It also allows to upload artifacts via SMB and SSH.
I suggest you start looking at something like (n)Ant to handle your build process. That way you can handle the entire "build artifacts" -> "publish artifacts" chain in an automated manner. These tools are dependency based, so the artifacts would only be published if the build succeeded.