How to fix the triggering of email with attachments using concourse pipelines - email

I am trying to get the email triggers with attachments. Which concourse resource to be used?
I have used the below question to get the email trigger working.
How to send email via Concourse CI pipeline?
I would like to get the logs as attachment with the email.

It appears that the email-resource doesn't have the option for attachments. Even if it did, I'm not sure how you could get the logs from the job/task. The log would probably have to be a task output. Seems complicated.
Easiest thing to do is just linking to the build in your email, like in the example in the README
- put: send-an-email
params:
subject_text: "Build finished: ${BUILD_PIPELINE_NAME}/${BUILD_JOB_NAME}/${BUILD_NAME}"
body_text: "Build finished: ${ATC_EXTERNAL_URL}/teams/main/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}"
Sorry my answer isn't better. Hope this helps!

This issue got fixed with help from the below URL
https://github.com/pivotalservices/concourse-pipeline-samples/blob/master/pipelines/notifications/email-with-attachments/README.md

Related

Notification for ’A pull request is created or updated‘ is not working when application-tier is Simplified-Chinese

- Version:
azure devops Dev17.M153.5
sql server 15.0.2000
- Reproducible Steps:
Install the azure devops 2019 1.1
Configure the application-tier as Simplified-Chinese
Finish the installation
Create the team notification for ’A pull request is created or updated‘
Check the mailbox
Information:
PR notification email was not received
Follow the instruction and we got the following message:
"messages":[{"level":1,"time":"11:23:40.2682787","message":
"设置电子邮件格式时出错。将改为发送一条错误消息。
MustacheExpressionInvalidException:对于表达式“stringFormat“在 {0} 中打开”event.secondaryToolName”找不到帮助程序“stringFormat“在”
#MustacheTemplatedExpression..ctor:0
#MustacheExpression.Parse:0
#ContributedTemplateServiceBase`1.ParseFieldToken:0
#ContributedTemplateServiceBase`1.ParseFieldToken:0
#ContributedTemplateServiceBase`1.ParseFieldToken:0
#ContributedTemplateServiceBase`1.ParseFieldToken:0
"
- We have tried :
Double-check the Why am I not getting an email ---- No issue is against the rules in the guidance
Try another notification type, such as "Work item is created" or "A build completes" ---- We can receive the related email
Remove the application-tier which has been initialized as Simplified-Chinese, and re-initialize the new application-tier as English-----The expected PR notification email was RECEIVED !!!
In order to narrow down the issue, you could try the following items:
Check whether you have the latest patch installed: https://learn.microsoft.com/en-us/azure/devops/server/release-notes/azuredevops2019u1?view=azure-devops
If you configure the application-tier as Simplified-Chinese again, would you be able to see the issue agine?
Check in other team projects to see whether you can reproduce this issue.
Create a new team project collection, and create a new team project in it, to see whether you can reproduce this issue.
Check the event log in Event Viewer, to see whether there is useful information.

Email upstream job artifact in jenkins

I have two jenkins jobs - JobA(upstream) and JobB(downstream). JobA generates the artifact TestReport.zip. I want to take TestReport.zip artifact in JobB and send it as an attachment in an email sent from JobB. I tried copy artifact plug in, but no luck. Can somebody please help with some steps how to do it?
Are you facing issue to passing TestReport.zip to Job B or facing issue to send email from Job B. I am assuming, you are facing issue to pass artifact to job B. As copy artifact plugin you tried and not worked, there is some alternative, you can try. So if both job A and Job B are running from same jenkins slave, then you can store artifact in some common place from where Job B can also access that and Job B can copy that from own workspace and initiate email using that as attachment. Please refer this article on how to pass parameter from one job to another.
https://itisatechiesworld.wordpress.com/jenkins-related-articles/jenkins-configuration/jenkins-passing-a-parameter-from-one-job-to-another/

Jenkins email plugin doesn't send email to user who broke the build

I've setup Jenkins to send emails only to users who broke the build using email-ext plugin, but I'm getting this error:
Not sending mail to unregistered user user#example.com because your SCM claimed this was associated with a user ID ‘John Smith' which your security realm does not recognize; you may need changes in your SCM plugin
I don't really understand what this error means, is the problem in our SCM, or in the email plugin? The emails are taken from the commit history, should I register them somewhere so Jenkins will start working?
For reference, this is the code around the error message in the plugin's source code:
} catch (UsernameNotFoundException x) {
if (SEND_TO_UNKNOWN_USERS) {
listener.getLogger().printf("Warning: %s is not a recognized user, but sending mail anyway%n", userAddress);
} else {
listener.getLogger().printf("Not sending mail to unregistered user %s because your SCM"
........
How do I enable SEND_TO_UNKNOWN_USERS?
The error message is also mentioned in this bug report.
For version V2.61 or above this can be configured via a radio button.
Go to
Manage Jenkins -> Configure System -> Extended E-mail Notification
and tick the radio button for Allow sending to unregistered users
Edit: If this does not work, see https://stackoverflow.com/a/45353810/492336 for another solution.
OK, after some experiments this is what I found out:
Jenkins takes the email part of the committer (not the author). For example for a commit message that looks like that:
Author: John Smith <author1#example1.com> 2017-07-27 17:15:39
Committer: John Doe <committer1#example2.com> 2017-07-27 17:15:39
Parent: 9c3ff18dda8ca6f7b7ac4ebab4c76d3c85891a33 (commit)
Branch: master
Jenkins will take "committer1", and create a brand new user under People with User ID "committer1" and email "". Unless that user has a password however, it will be considered unregistered so you need to go to Configure for that user and add a password field to it:
So this is one way to fix the error, but you have to do it for every user and in a big team it can be tedious.
Put the line bellow in your jenkins startup script
-Dhudson.tasks.MailSender.SEND_TO_UNKNOWN_USERS=true
The newest Jenkins security directive only allow sending mail to registered user. The line above bypass this configuration.
Given jenkins takes the first part of the email address and creates a user, I made my team have their jenkins user name be the first part of their email address. This removed any overhead of having to maintain two separate users.

How do i programatically set the email recipients for a jenkins job

I am trying to update the email recipients for loads of jenkins job with new set of email lists, I am unable to find the right API to do so. Although this could be updated in the config file directly but wanted to use Jenkins APIs if available any
Edit : I am referring to the below field
Post-build Actions: E-mail Notification > Recipients
Well. Currently I do not have the code but I have the thoughts.
1st step:
You can use whatever jenkins API (REST, python wrapper,etc...) to dump all your job names into a txt file, saying job_list.txt.
Below is an example. And you can find the useage from This link.
import jenkins
j = jenkins.Jenkins('http://your_url_here', 'username', 'password')
j.get_jobs()
2nd step:
As you can see, each job has an config file with path like $JENKINS_HOME/jobs/job_name/config.xml. This can also be accessed from your browser. From browser it looks like this:
So your question can be simplified into either:
"How to update the recipients value of config.xml from each job folder under $JENKINS_HOME/jobs directory".
Or:
"How to update the recipients value of config.xml from each job url like http://your_jenkins_url/job/each_job_name/config.xml".
So this can be done by any script language like python,ruby,shell,vb or whatever http-like lib like 'urllib2', 'requests' etc...
3rd step:
After all the config.xml file updated, don't forget to restart your jenkins to take effects.
Good luck, buddy!
Edited(2015-05-27)
There is an existing Groovy script written by #edalquist which can update the email address in a programatically way. https://github.com/jenkinsci/jenkins-scripts/blob/master/scriptler/updateEmailAddress.groovy

Change URL in email sent by SSRS

I have a reportserver that is succesfully able to send out subscriptions as emails.
However, if I include the link to the report, the link is 'local'.
The reportserver can be reached using
http://reporting.mycompany.com
OR internally through our VPN.
The link in the email added by SSRS looks like
- http://HOST_NAME/ReportServer/PATH_TO_REPORT
I have looked, tried, searched but I cannot find as solution.
In the RS Configuration Manager two URL's have been added for the Web Service URL:
- http://reporting.mycompany.com:80/ReportServer
- http://HOST_NAME:80/ReportServer.
If I remove the second I can no longer connect, internally OR externally.
The Report Manager URL is set up as
- http://reporting.mycompany.com:80/Reports
The only thing I want is to have the URL in the emails to look like
- http://reporting.mycompany.com:80/ReportServer/PATH_TO_REPORT
I have been looking at the RS Configuration Manager, the RSconfig file, IIS but for the love of me, I cannot find a way to change the link in the email......
Who can point me in the right direction?
Thanks for thinking with me!
Instructions on this didn't help either :s
The instructions in this link are correct;
http://www.sqlservercentral.com/Forums/Topic673108-162-1.aspx
The fault actually was in the certificate that was being used.....
The link also worked for me but I had to use ReportServer instead of Reports in the
Correct url: "http://myserver.mydomain.com/ReportServer
^
Incorrect url: "http://myserver.mydomain.com/Reports
^
The location on SSRS 2019 is C:\Program Files\Microsoft SQL Server Reporting Services\SSRS\ReportServer\rsreportserver.config
Look for <UrlRoot> and enter http://<youralias>/ReportServer