alexkvak / teamcity-slack

TeamCity Slack plugin
MIT License
124 stars 23 forks source link

TeamCity build parameters (system or otherwise) arent being translated #99

Closed JustinGol closed 4 years ago

JustinGol commented 4 years ago

I built a new notification thats meant to read TeamCity parameters but this isnt working for me. Im using TC 2018.2.1. I tried both system and configuration parameters and tried different variations of:

I looked into the code below and cant see a reason why it doesnt convert the parameter to its real value, assuming the build object works as expected.

MessageBuilder line to read parameters

alexkvak commented 4 years ago

Hi,

Does your parameter presents at build Parameters tab?

JustinGol commented 4 years ago

Hi Alex, it does, see below. It was called slack-notification-target-database which I created for testing purposes but I also had a system parameter that I tried too unsuccessfully.

This was my message format: <{link}|{name}> {%slack-notification-target-database%} Status: {status}

image

alexkvak commented 4 years ago

I guess the reason of this behavior is that your parameter name contains dashes and this symbol is absent in the regex on https://github.com/alexkvak/teamcity-slack/blob/af520013b3b2ea0ec1109ea97f44e688b48db769/slackIntegration-server/src/main/scala/com/fpd/teamcity/slack/MessageBuilder.scala#L68

I'll fix it in couple of days.

JustinGol commented 4 years ago

I guess the reason of this behavior is that your parameter name contains dashes and this symbol is absent in the regex on

https://github.com/alexkvak/teamcity-slack/blob/af520013b3b2ea0ec1109ea97f44e688b48db769/slackIntegration-server/src/main/scala/com/fpd/teamcity/slack/MessageBuilder.scala#L68

I'll fix it in couple of days.

I tested the regex but was only testing against the % and didnt add a hyphen. I see now it doesnt work. Appreciate it Alex.

alexkvak commented 4 years ago

By the way I did so while teamcity always separates words in parameters with dots :)

But it does not matter, it's still bug.

JustinGol commented 4 years ago

Thats a good point, I never noticed that before. We always had a convention to use hyphen. On their docs they recommend the following: [a-zA-Z0-9._-*]

TeamCity Parameter Name Restrictions

JustinGol commented 4 years ago

Thanks for fixing this and for doing it so quickly