I am running Xcode Server Bots on my local iMac but the email notifications are not being sent.
I have followed many tutorials and have postfix
setup and working. I can successfully send emails using the command
sudo echo "Test sending email from Postfix" | mail -s "Test Postfix" [email protected]
and my email is received.
Under Xcode
> Preferences
> Server & Bots
> Mail
I have left everything blank as per all the tutorials.
For my Bot, under Triggers
I have a Periodic Email Report
with Schedule
set to After each integration
and set my from
, reply-to
and To
fields and have every Notify On
ticked.
I monitor the smtp
and smtp
process using the command
sudo log stream --predicate '(process == "smtpd") || (process == "smtp")' --info
and when I send an email using the above test, I get a log line showing.
However when my Xcode Bot completes, I get absolutely nothing.
The Bot logs show
Feb 2 13:47:16 [596] <Info>: Executing trigger 'Periodic Email Report'
Feb 2 13:47:16 [596] <Info>: Executing trigger 'New Issue Email'
So the email report is not triggering any kind of smtp
. Is it even using postfix? Can I log something else to see whether it is hitting postfix
at all?
EDIT ——
I have found some sendmail
logs that seem to show Xcode doesn’t have the right permission to use postdrop
:
kernel Sandbox: sendmail(48548) deny(1) forbidden-exec-sugid
sendmail fatal: execvp /usr/sbin/postdrop: Operation not permitted
sendmail warning: command "/usr/sbin/postdrop -r" exited with status 1
sendmail fatal: xcode@<redacted>.com(450): unable to execute /usr/sbin/postdrop -r: Undefined error: 0
My postdrop
permissions seem to be correct compared to what I can find online:
-rwxr-xr-x 1 root wheel 570448 1 Jan 2020 postalias
-rwxr-xr-x 1 root wheel 466416 1 Jan 2020 postcat
-rwxr-xr-x 1 root wheel 823488 1 Jan 2020 postconf
-rwxr-sr-x 1 root _postdrop 588624 1 Jan 2020 postdrop
-rwxr-xr-x 1 root wheel 431904 1 Jan 2020 postfix
-rwxr-xr-x 1 root wheel 432032 1 Jan 2020 postkick
-rwxr-xr-x 1 root wheel 449424 1 Jan 2020 postlock
-rwxr-xr-x 1 root wheel 431872 1 Jan 2020 postlog
-rwxr-xr-x 1 root wheel 569632 1 Jan 2020 postmap
-rwxr-xr-x 1 root wheel 465872 1 Jan 2020 postmulti
-rwxr-sr-x 1 root _postdrop 588448 1 Jan 2020 postqueue
-rwxr-xr-x 1 root wheel 466784 1 Jan 2020 postsuper
I have the _postdrop
user in my /etc/group
file as:
_postdrop:*:28:
Or am I reading this wrong? Does sendmail
user need permission to use postdrop
?
EDIT 2 ——-
It seems this might be an issue with Big Sur
making the root partition read only. sudo postfix set-permissions
can’t do it’s thing.
So I guess the question now is, how to install/use a different method for Xcode Server to send emails?
3
Answers
After a lot of research, asking questions elsewhere and trial and error it seems it's just not going to work. Somewhere along the line, Xcode server doesn't have the right permissions to send email automatically. This could possibly be a bug in Xcode Server, or even Big Sur.
sendmail
in itself is quite a beast to setup, but if you have got it working from the command line as suggested in many tutorials, then there is a way you can get emails from Xcode server.After the suggestion from a member on the Apple forums, it seems that using a
Post Integration Script
you can in fact callsendmail
directly. So i've come up with the following scripts:Add this as a Post Integration Script: changing the path to where you save the 2 files below.
email.html
mail.sh Edit the 4 variables as needed. You might need to
chmod +x mail.sh
this file.You will now get emails like these:
If anyone knows he we can add the actual failure reasons or errors that would be awesome. There's a list of variables we can use here and I think it might involver looking at the actual build paths.
I’m not too familiar with Xcode, but the problem as you describe it clearly seems to be the communication between the Xcode application and your Postfix SMTP server.
I would try the following:
Obtain Xcode logs.
Obtain Postfix logs.
Hopefully by doing this you be able to see if your configured mail updates are making it out of Xcode and reaching your Postfix server.
Your process is completely true but just for one exception. As you pointed and log said, There is a problem with permissions.
It would be nice sharing by
rpm -qV postfix
orpostfix check
full log to figure out the problem deeply but you have already some log which declared Xcode have no permission.Also you can use your email bot to figure out "Manage Bots in the Xcode Report Navigator". Here is the Apple Document.
I think this will work to set the permissions:
After run this to clear postprop for double check
EDIT1:
Or it will be good idea try this commands if not still work
sets the rights and permissions:
restart postfix:
At the final stage, it is supposed to be get an email like that :
FINAL EDIT:
My first and Edit1 Answer doesn’t work for PO.
There are some old threads indicate that could be a bug for different MacOS versions. It seems an issue with Big Sur in terms of postfix.
Thread1
Thread2