Anyone know how to attach an artifact (text file) to a Slack service message notification? Or at least a URL to the artifact?

In the Team City Administration's Slack settings, there's a "Public artifacts URL".  But I can't find any documenation of what that is, how it should be formatted, etc… does anyone know?

I've been trying, with no success, to attach an artifact file to a Slack Message using Services Messages.  I can't even attach a link to the artifact.

I am including a URL to an artifact, but the notifications log says “Found external domains that are not allowed by configuration: [packagingErrors.txt]”.

The url that I am actually including looks something like this when I print it out in the log:

https://<our server>//repository/download/<our build configuration>/2506:id/packagingErrors.txt

Why does it think the artifact is in an external domain?  Has anyone used urls to artifacts in Slack messages?
 

 

0
8 comments
Hi,

The Slack notifications are generally non-customizable, so I would recommend the following workaround.
1. Use email notifications to send notifications from TeamCity, as these notifications are customizable and can include much more detailed information: https://www.jetbrains.com/help/teamcity/customizing-notification-templates.html.
2. Slack allows setting up an email address for the channel. This way, all emails sent to this address will appear as messages on the channel: https://slack.com/intl/en-gb/help/articles/206819278-Send-emails-to-Slack.
So, when sending email notifications to the channel's email address, you will get much more detailed, customizable notifications.
Would such a notification method work for you?

Best regards,
Anton
0

possibly - I will look into it, though it is kind of a circuitous workaround…
although I was thinking the bigger problem was it not allowing me to reference a URL to the artifact.  Would email not have this same problem?  I don't understand why Slack rejects the URL when I try to include it (using a service message to make the slack).  

Do you know what the “Public artifacts URL” in the Slack administration is for?  I cannot find any documentation of why that is there or how to use it.

0
Hi,

The list of allowed hostnames can be set up in Administration > Email Notifier. It looks like the Slack notifier uses it as well. By default, it is limited to the TeamCity server address specified in Administration > Global Settings. Please check if adding the hostnames will help.

I checked the Slack notifier build feature settings, and there is no “Public artifacts URL”. Could you provide a screenshot of the page with this setting?

Best regards,
Anton
0

I just want to list a URL to an artifact generated by a build step, a simple file called “packagingErrors.txt”.  It would be on the server right?  So the default settings should be fine?

Here is the screenshot of the Slack plugin page in Administration for our Team City.  I have “packagingErrors.txt” here just because I had already tried everything else, I know that probably isn't what should go there…
 

0
Hi,

Thank you for the provided screenshot. This is not a built-in Slack integration; it is a Slack integration provided by a third-party plugin: https://github.com/alexkvak/teamcity-slack. This is why you can't find information on these settings in our documentation.
JetBrains does not support this plugin. Please check the plugin's documentation and see if it suits your needs. If you have any questions regarding the plugin's functionality, please contact the plugin's maintainer.

Best regards,
Anton
0

I see. Thanks -  I am not using the build-in Slack notifications that happen on build succeed, fail etc.  I am sending them using Service Messages.  Would that use this plugin?  I cannot seem to attach a link URL to any attachment with these service message - based Slacks.  The notifcation log always says “Found external domains that are not allowed by configuration”

0

The link you provided to the email notifications indicates that it also is unable to provide links to artifacts… hard to understand how this could be….


Listing Build Artifacts

There is no default way of listing build artifacts in an email template at the moment. See a related issue with a simple plugin allowing you to list artifacts via a relevant API.

0
Hi,

I can't answer whether service messages will work with this plugin. However, for the built-in Slack notifications, service messages should work as they are documented functionality. And regarding external domain errors, you could try specifying all the possible domains in the related setting field to see if it'll help.

It looks like the plugin you are using is capable of providing artifact links out-of-the-box; please check the plugin's documentation and see if it'll work for you.

For build artifacts in email templates, the workaround is available in the linked issue's comment: https://youtrack.jetbrains.com/issue/TW-50431/Allow-to-use-enums-within-email-Freemarker-templates#focus=Comments-27-2266647.0-0.
Sorry for not noticing this issue earlier.

Best regards,
Anton
0

Please sign in to leave a comment.