Octopus cannot send an email - CreatedBy.EmailAddress is empty

Hi All,
I want to implement a very simple notification step (inspired by Azure Devops) which gives an email feedback to the requestor.

Background
This is a simple ASP.NET deployment
I have a Jenkins CI system which is pushing a package to Octopus server on premise and then kicking off a release on Octopus.

Configuration of the email step
I am using the variable Octopus.Deployment.CreatedBy.EmailAddress in the To field

Does it work with hard coded email addresses?
Yes.

The email task fails. The error message in the log file is "The parameter ‘addresses’ cannot be an empty string (Parameter ‘addresses’) .

Any suggestions?

Thanks,
Sau

Hi there @saurabh_dasgupta,

Thanks for reaching out and sorry to hear you’re experiencing issues.

The system variable Octopus.Deployment.CreatedBy.EmailAddress has the value of the email address of the user who initiated the deployment.
It appears from the error message you’ve provided that this variable is not populated on the deployment that has failed.

Are you able to check the Audit Log (Configuration → Audit), please?
Filtering on the left for the project in question should allow you to see the previous deployment creation event and who initiated it.

Usually, there is an account attached to any action taken by a user.
Does the user who initiated this deployment have an e-mail address attached to their user account (Configuration → Users) within Octopus?

Would you be able to send over a task log for a failed deployment, please?
You can upload the task log to our secure file upload site: Support Files.

Hopefully, we can get to the bottom of the issue quickly for you.

Kind Regards,
Adam

Hello Adam,

Thanks for taking a look.

Log file uploaded. (ServerTasks-40246.log.txt) to your secure link.

When I see the Audit log, the user column shows “system”.

Please bear in mind that this was a release triggered via Jenkins.

Thanks,
Sau

Hi @saurabh_dasgupta,

Thanks for getting back to me.

It looks like from your screenshot that the notification of the task failing was by the system account.
Is there an Audit entry for the task being started? Something similar to this:

If there isn’t, the best way of confirming if the error lies in an e-mail not being supplied is to check the user account that holds the API key used to authenticate Jenkins with Octopus.
If the system variable is going to work for this method, an e-mail must be populated in that user account.

Please let me know if you’re able to find any further information with the above in mind.

Kind Regards,
Adam

Hi Adam,

This is what I can see

The account used is svc-jenkins. This is a Windows service account .

Hi @saurabh_dasgupta,

Thanks for confirming, it does look like the account in question is a service account.

As service accounts cannot have an e-mail address attached to it, it may be better to modify the Display Name of the service account and use the variable Octopus.Deployment.CreatedBy.DisplayName.

If you modify the display name of the account “svc-jenkins” within Octopus (Configuration → Users → svc-jenkins) to the e-mail address that you wish to send the notification to, the variable Octopus.Deployment.CreatedBy.DisplayName should work for your use case.

I hope this helps! Please let me know the outcome if you decide to test the above.

Kind Regards,
Adam

Apologies for the immediate follow-up but I understand the suggestion above may not be what you were looking for in terms of: “The e-mail address of the person who started the deployment.”
As the e-mail will never change, always coming from the service account.

It may be worth setting a prompted variable on the project, which you can then populate with a value inside Jenkins(inside the variables field) when you wish to deploy the release.

i.e.
If you create a prompted variable on the project within Octopus named “prompted_email”.
The variables section of the Jenkins “Deploy Release” step could look like this:
prompted_email="test.email@test.com"

Kind Regards,
Adam

Thanks Adam.
I understand your solution.

Does the OCTOPUS CLI have a provision for passing user information when invoked from Jenkins? This would give us a more dynamic system.

Developer A and Deveoper B would get their respective emails - without spamming the entire team.

Hi Sau,

I just wanted to confirm that you received my last reply as I sent two messages close together. I believe that it may be what you’re looking for. Unfortunately, it wouldn’t automatically retrieve any user information and your developers would have to specify the notification e-mail via prompted variable.

If you did give it a look over and it’s not ideal, I’ll ask around internally to see if there’s a method to do this automatically. At the moment, to my knowledge, it may not be possible but I very well could be wrong!

Kind Regards,
Adam

I will give this a try. Looks promising.

1 Like