Jenkins CI, how to add Importance property to EMail header? - continuous-integration

I would like Jenkins emails to have "Importance" icon (in Outlook)
If I generate the email manually - I can achieve this by adding these properties in the SMTP header:
Priority:High
Importance:high
Is there way to add them into Jenkins email headers? I could not find any plugin or option doing that :(

No, this isn't currently possible, but you could probably add this to the Email-ext plugin, which has configuration options for some other headers.

There's a ticket requesting this feature in the Jenkins emailExt project: https://issues.jenkins.io/browse/JENKINS-69592?jql=labels%20%3D%20email-ext
One user listed a workaround in the comments there:
Code is just adding a presendScript presendScript: '''msg.addHeader("X-Priority", "1")''')

Related

TeamCity REST API - update 'settings' for build configuration

I'm trying to use the TeamCity REST API to update settings against a build configuration. Specifically, the checkoutDirectory that in the UI is in the "Version Control Settings->Additional Options->Checkout directory" textbox...
The documentation talks about updating the "parameters", but not the settings.
If I do a GET on /app/rest/buildTypes/<id>, the results include both settings and parameters...
I've tried various combinations of PUT request to try to update this, but having no luck.
Interestingly, if I do a GET on /app/rest/buildTypes/<id>/parameters, I get this...
Which includes the ID in the URL.
But if I do /app/rest/buildTypes/<id>/settings, I get this...
Which doesn't include the ID. Not sure if that's a bug - or I've completely misunderstood the scope of these settings, and they're global, not per build config - but that's certainly not what I'm seeing in the UI.
Any ideas how to use the REST API to update these settings?

How can I globally specify the From email header for the TeamCity email notifier?

I've set up a gmail account to use when sending email notifications from my TeamCity installation. The emails are being sent correctly, but I want to specify the From: header using their .ftl files. According to this page (under Supported Output Values), I can specify email headers. I've copied their <global#... block directly into a number of their template files, namely common.ftl, build_successful.ftl and it never works.
The block I added looks like this:
<#global headers>
From: Some Test <myteamcitytestnotreal#gmail.com>
</#global>
It doesn't do anything. Neither does their sample headers. Any help is appreciated.
You can specify the From: address via the UI under Administration > Email Notifier -> Send email messages from:.
This updates the value stored in the <TeamCity data directory>/config/_notifications/email/email-config.xml file.
I suspect overriding the From: address at the ftl template level is not a supported approach given that the above is the documented method; it might make for a good feature request in TC 9.0.

How to automatically add email comments to existing JIRA issue

I've done this before but can't remember how to do this anymore.
Let's say I have a JIRA issue# 967 open.
I'm emailing a couple of people with comments on this issue using my Outlook email.
What do I need to do so that this comment automatically gets added as part of the JIRA issue?
See the Atlassian documentation here. Replace JIRA in the URL with the version number you're on if you are using an older version, e.g. JIRA044
Please make sure you're following the guides that fits your Jira version, there is a page for each version. Follow this guide to set up issue and comments creation via email.
Basically you need to :
Configure mail server - use your exchange server or external service as Google.
Configure a mail handler - probably you will want to use one of Jira's built-in mail handlers.
Important notes-
To create a comment for isser key TEST-123 the email's subject has to contain the issue key, e.g. Subject: Re: TEST-123 updates.
Emails without subject line won't be processed.
read this for more tips.

Automatically email the recent changes for a particular build in Hudson

Is there any way to send an email in Hudson which has the list of recent changes in that build?
For example
Trigger a build and if you go recent changes there we have some recent changes. Once it is success, the email should have the list of the changes that happened in that particular build. After this, say the next build fails (build fail email will be triggered), but it records the changes and these change lists also should be included in next successful build.
You'll first need to install the Email-ext plugin for Hudson.
Inside the project configuration, under Post-build Actions click the Email Notification and Editable Email Notification checkboxes. Instead of having the Content be $PROJECT_DEFAULT_CONTENT you'll want to use a different token. Those are described when you click the help icon (?) for Content Token Reference.
Specifically to your example, add (or edit if it exists) the trigger for Success. Change the Content of the success email to use the token ${CHANGES_SINCE_LAST_SUCCESS, reverse, format, showPaths, changesFormat, pathFormat}. The different options are explained in the reference. If you just want the defaults, simply use ${CHANGES_SINCE_LAST_SUCCESS}

how do I include the full url of the ftp location in a husdon email after a build and publishied via the ftp plugin?

I am using the hudson "Publish artifacts to FTP" task after a build to put an installer up to a web site.
I would like to automatically add that link to my email.
unfortunately hudson makes up a directory name based on time and date and places the tile there.
Is there a way to get that value and put it in the build success email or otherwise automatically create the full url?
Hopefully you are using the "Hudson Email Extension" Plugin. This gives you many more customization options over the email support built into the core.
If you are, you might consider putting the token:
${ENV, var} - Displays an environment variable
...into the email. You could set an environment variable in your build script to the FTP link and then insert it into the email. I'm sorry I don't use the Publish Artifacts to FTP plugin myself, but you should be able to mimic the way that plugin sets the FTP destination, and then stick it into an environment variable, which the Email Extension Plugin can then use.

Resources