alexkvak / teamcity-slack Goto Github PK
View Code? Open in Web Editor NEWTeamCity Slack plugin
License: MIT License
TeamCity Slack plugin
License: MIT License
We want to use slack notification configs in build templates. This could be done by moving configuration into the build settings at build feature section.
This solution will make possible to copy build config with notification configs inside.
Hi,
Version used: 1.1.5
I've configured slack according to the documentation, including the oAuth token.
It even seems to be connected with slack, since when i'm entering a non existing channel, i get an error, and if the channel exist, i'm able to save the configuration.
But when the build is executed, no message is sent to slack.
When i press the "Try it" button, which most likely should send a default message to the configured slack channel, it just spins forever:
Any hints what's wrong here?
Do not report "Something went wrong", always answer with detailed information.
When attempting to setup the plugin any attempts by the modify the plugin's setting/access the Slack tab in the project tries to access the wrong IP address. When trying to submit plugin settings I get redirected to the wrong IP (plugin attempts to connect to 10.1.2.55 when my IP is 10.1.2.134).
I was able to modify the form action (pictured below) using Chrome Dev Tools to correct the IP address and the form submitted correctly.
Looking at the network calls when selecting the Slack tab in a project and it appears that they are also using the same incorrect IP address.
I attempted to restart the TeamCity service in hopes that this was just an odd Java environment issue, but this did not help.
TeamCity version used: 2017.2.2
Maybe I do not understand the set up enough but when using the following template the {users} field is not populated when builds fail and the 'personal' slack notification is not sent.
<{link}|{name} - #{number}>
Status: {status}
{users}
{reason}
Notes:
Branch is a required field. Why?
We have TeamCity configurations without any repository behind.
They are set up as nightly test runs based on some artifact dependencies from other builds.
Case
There are feature branches in project. It's needed to notify feature developer about failed builds.
Solution
Let's add checkbox in build settings that allows plugin to notify code authors according to those settings rules. Additionally channel name become non-required.
Note that global setting "Personal notifications enabled (only if build fails)" will also work and not duplicate notifications about build failures.
First off, thank you for making this plugin. My team loves it.
I was wondering if it is possible to allow alerting for build tasks that do not have vcs roots configured. For example, one of our TeamCity build projects does not have a vcs root. It just performs one or more tasks.
Thanks!
The settings page will not post to the proper url when teamcity is installed on a path other than root. For example on server.com/tc/app/...
The form to save config posts to "/app". I believe changing the action of this form to include the Server Global Setting "Server URL" would fix the issue.
I could be wrong, but i don't think this project builds properly in windows because of some funky lineendings in the MessageBuilderTest. Three in total. I ran into this when trying to package it on my dev-machine after making some additions. Looked strange as i hadn't touched these classes. :)
In windows the multiline strings seem to create other line-endings than regular strings. (Using regular strnigs resolves the problem)
Example of a failing test
"MessageBuilder.compile" should "compile template with artifactsRelUrl placeholders" in {
implicit val build = stub[SBuild]
build.getFullName _ when() returns "Full name"
build.getBuildNumber _ when() returns "2"
build.getBuildStatus _ when() returns Status.NORMAL
build.getContainingChanges _ when() returns mockChanges
build.getArtifactsDirectory _ when() returns new File("/full/artifacts/path/my/build/folder/")
val messageTemplate = """{name}
|{artifactsRelUrl}
""".stripMargin
messageBuilder(artifactsPath = "/full/artifacts/path/").compile(messageTemplate) shouldEqual
SlackAttachment(
s"""Full name
|my/build/folder
""".stripMargin.trim, MessageBuilder.statusNormalColor)
}
The failing tests in Maven
MessageBuilder.compile
- should compile template with changes placeholders *** FAILED ***
SlackAttachment(Full name
- Did some changes Second line [name1]
- Did another changes [name2],#ed2c10) did not equal SlackAttachment(Full name
- Did some changes Second line [name1]
- Did another changes [name2],#ed2c10) (MessageBuilderTest.scala:121)
- should compile template with artifactsRelUrl placeholders *** FAILED ***
SlackAttachment(Full name
fullartifactspathmybuildfolder,#02c456) did not equal SlackAttachment(Full name
my/build/folder,#02c456) (MessageBuilderTest.scala:197)
- should compile template with artifactLinks placeholder *** FAILED ***
SlackAttachment(Full name
https://team.city/download/directory/artifact.txt
https://team.city/download/directory/folder/artifact2.txt,#02c456) did not equal SlackAttachment(Full name
https://team.city/download/directory/artifact.txt
https://team.city/download/directory/folder/artifact2.txt,#02c456) (MessageBuilderTest.scala:302)
Getting this below error.
403 Forbidden: Responding with 403 status code due to failed CSRF check: request's "Origin" header value "null" does not match Host/X-Forwarded-Host header values or server's CORS-trusted hosts, consider adding "Origin: http://<my_teamcity_server>.ca.com" header.
I'm not sure if I'm misunderstanding the instructions, but I can't get this to work. When I click "Try" I get the message "Something went wrong".
I followed the instructions for Slack, making sure that I'm using the bot key, and the channel without the "#".
Is the public artifact URL necessary? I tried mydomain.com/system/artifacts but I get nothing. I'm using the newest version of TeamCity running on AWS.
Result: Unable to create session by config
Hi there
After setting up the application and bot, I wanted to test my configuration with "Try it" on a build configuration, the "Sending..." pop up box hangs and the stack trace below is output in teamcity-server.log
Seems to be during compilation of a regex (I used ".*")
Of note: I am using svn as a repo and it's unclear to me what "branch" means in svn, which is why i used ".*"
ERROR - jetbrains.buildServer.SERVER - Error java.lang.NullPointerException while processing request: POST '/app/slackIntegration/buildSettingTry.html?id=XXXX', from client X.X.X.X:55244, authenticated as 'xxxx' {id=1}
java.lang.NullPointerException
at com.fpd.teamcity.slack.MessageBuilder.$anonfun$compile$9(MessageBuilder.scala:59)
at scala.Option.map(Option.scala:146)
at com.fpd.teamcity.slack.MessageBuilder.$anonfun$compile$8(MessageBuilder.scala:59)
at scala.util.matching.Regex.$anonfun$replaceAllIn$1(Regex.scala:491)
at scala.collection.Iterator.foreach(Iterator.scala:929)
at scala.collection.Iterator.foreach$(Iterator.scala:929)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1406)
at scala.util.matching.Regex.replaceAllIn(Regex.scala:491)
at com.fpd.teamcity.slack.MessageBuilder.compile(MessageBuilder.scala:56)
at com.fpd.teamcity.slack.controllers.BuildSettingsTry.$anonfun$handle$4(BuildSettingsTry.scala:31)
at scala.Option.flatMap(Option.scala:171)
at com.fpd.teamcity.slack.controllers.BuildSettingsTry.$anonfun$handle$2(BuildSettingsTry.scala:30)
at scala.Option.flatMap(Option.scala:171)
at com.fpd.teamcity.slack.controllers.BuildSettingsTry.$anonfun$handle$1(BuildSettingsTry.scala:29)
at scala.Option.flatMap(Option.scala:171)
at com.fpd.teamcity.slack.controllers.BuildSettingsTry.handle(BuildSettingsTry.scala:28)
at com.fpd.teamcity.slack.controllers.SlackController.doHandle(SlackController.scala:17)
at com.fpd.teamcity.slack.controllers.SlackController.doHandle$(SlackController.scala:15)
at com.fpd.teamcity.slack.controllers.BuildSettingsTry.doHandle(BuildSettingsTry.scala:14)
at jetbrains.buildServer.controllers.BaseController.handleRequestInternal(BaseController.java:75)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:147)
at
[...]
Any idea what I'm doing wrong? I followed your setup instructions and it's all working except the bot is posting with a username of 'TeamCity' and with an icon of the Slack 'bots' integration.
The screenshot below shows that the display name and icon I've set isn't being used, any idea what to do?
Hello again!
Is there a way to provide conditional logic for the slack alert messages?
For example:
If build status is "started", then show "Triggered by" field in message.
After setup the OAuth access token, click save and the next message appears:
"Unable to create session by config"
Team city version ->
TeamCity 2017.1.5 (build 47175), effective release date 2017-Apr-10, currently running in the ...
In our case we have slack channels with cyrillic chars in it like ит
. It worked like charm before we restarted server. After server restart we got a plugin load error. Manually removing cyrillic chars from plugin's json config is a current solution.
Traceback:
[2017-12-26 09:03:07,796] WARN - inLoader$TeamCityPluginContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.fpd.teamcity.slack.pages.BuildPage#0' defined in Byte array resource [plugin: Slack Integration#slackIntegration-server-1.0.0.jar!/META-INF/build-server-plugin-slackIntegration.xml]: Unsatisfied dependency expressed through constructor parameter 3; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.fpd.teamcity.slack.ConfigManager#0' defined in Byte array resource [plugin: Slack Integration#slackIntegration-server-1.0.0.jar!/META-INF/build-server-plugin-slackIntegration.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.fpd.teamcity.slack.ConfigManager]: Constructor threw exception; nested exception is org.json4s.ParserUtil$ParseException: parsing failed
[2017-12-26 09:03:07,803] ERROR - gins.spring.SpringPluginLoader - Error loading plugin 'Slack Integration': Failed to initialize spring context: Error creating bean with name 'com.fpd.teamcity.slack.pages.BuildPage#0' defined in Byte array resource [plugin: Slack Integration#slackIntegration-server-1.0.0.jar!/META-INF/build-server-plugin-slackIntegration.xml]: Unsatisfied dependency expressed through constructor parameter 3; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.fpd.teamcity.slack.ConfigManager#0' defined in Byte array resource [plugin: Slack Integration#slackIntegration-server-1.0.0.jar!/META-INF/build-server-plugin-slackIntegration.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.fpd.teamcity.slack.ConfigManager]: Constructor threw exception; nested exception is org.json4s.ParserUtil$ParseException: parsing failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.fpd.teamcity.slack.pages.BuildPage#0' defined in Byte array resource [plugin: Slack Integration#slackIntegration-server-1.0.0.jar!/META-INF/build-server-plugin-slackIntegration.xml]: Unsatisfied dependency expressed through constructor parameter 3; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.fpd.teamcity.slack.ConfigManager#0' defined in Byte array resource [plugin: Slack Integration#slackIntegration-server-1.0.0.jar!/META-INF/build-server-plugin-slackIntegration.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.fpd.teamcity.slack.ConfigManager]: Constructor threw exception; nested exception is org.json4s.ParserUtil$ParseException: parsing failed
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:189)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1193)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1095)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
at jetbrains.buildServer.plugins.spring.SpringPluginLoader.pluginClassesLoaded(SpringPluginLoader.java:102)
at sun.reflect.GeneratedMethodAccessor75.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at jetbrains.buildServer.util.EventDispatcher$3.run(EventDispatcher.java:126)
at jetbrains.buildServer.util.NamedThreadFactory.executeWithNewThreadName(NamedThreadFactory.java:71)
at jetbrains.buildServer.util.EventDispatcher.dispatch(EventDispatcher.java:120)
at jetbrains.buildServer.util.EventDispatcher$2.invoke(EventDispatcher.java:70)
at com.sun.proxy.$Proxy25.pluginClassesLoaded(Unknown Source)
at jetbrains.buildServer.plugins.PluginManagerImpl$2.visitPlugin(PluginManagerImpl.java:140)
at jetbrains.buildServer.plugins.PluginsCollection$6.run(PluginsCollection.java:261)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.fpd.teamcity.slack.ConfigManager#0' defined in Byte array resource [plugin: Slack Integration#slackIntegration-server-1.0.0.jar!/META-INF/build-server-plugin-slackIntegration.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.fpd.teamcity.slack.ConfigManager]: Constructor threw exception; nested exception is org.json4s.ParserUtil$ParseException: parsing failed
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:279)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1193)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1095)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
... 28 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.fpd.teamcity.slack.ConfigManager]: Constructor threw exception; nested exception is org.json4s.ParserUtil$ParseException: parsing failed
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:154)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:122)
at jetbrains.buildServer.spring.InstantiationStrategySelector$1.instantiate(InstantiationStrategySelector.java:77)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:271)
... 41 more
Caused by: org.json4s.ParserUtil$ParseException: parsing failed
at org.json4s.native.JsonParser$.parse(JsonParser.scala:134)
at org.json4s.native.JsonParser$.parse(JsonParser.scala:80)
at org.json4s.native.JsonMethods.parse(JsonMethods.scala:13)
at org.json4s.native.JsonMethods.parse$(JsonMethods.scala:9)
at org.json4s.native.JsonMethods$.parse(JsonMethods.scala:63)
at com.fpd.teamcity.slack.ConfigManager.readConfig(ConfigManager.scala:28)
at com.fpd.teamcity.slack.ConfigManager.<init>(ConfigManager.scala:25)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142)
... 44 more
Caused by: java.nio.charset.MalformedInputException: Input length = 1
at java.nio.charset.CoderResult.throwException(CoderResult.java:281)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:339)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at java.io.BufferedReader.fill(BufferedReader.java:161)
at java.io.BufferedReader.read1(BufferedReader.java:212)
at java.io.BufferedReader.read(BufferedReader.java:286)
at org.json4s.ParserUtil$Buffer.read(ParserUtil.scala:165)
at org.json4s.ParserUtil$Buffer.next(ParserUtil.scala:113)
at org.json4s.native.JsonParser$Parser.nextToken(JsonParser.scala:271)
at org.json4s.native.JsonParser$.$anonfun$astParser$1(JsonParser.scala:186)
at org.json4s.native.JsonParser$.$anonfun$astParser$1$adapted(JsonParser.scala:143)
at org.json4s.native.JsonParser$.parse(JsonParser.scala:131)
... 55 more
If I run personal build and it fails plugin sends notification into channel.
But it's better to send it as private message if global setting "Personal notifications enabled" enabled.
Hi.
I changed Slack OAuth Access Token in Administration and it throws TeamCity error when I click Save button.
my server has 50% memory usage (more than 200MB free memory)
TeamCity Diagnostics shows 100MB memory increases after the crisis.
Do you have any idea?
Trace: java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:3332)
at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:124)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:448)
at java.lang.StringBuilder.append(StringBuilder.java:136)
at ch.qos.logback.core.pattern.FormattingConverter.write(FormattingConverter.java:40)
at ch.qos.logback.core.pattern.PatternLayoutBase.writeLoopOnConverters(PatternLayoutBase.java:119)
at ch.qos.logback.classic.PatternLayout.doLayout(PatternLayout.java:149)
at ch.qos.logback.classic.PatternLayout.doLayout(PatternLayout.java:39)
at ch.qos.logback.core.encoder.LayoutWrappingEncoder.doEncode(LayoutWrappingEncoder.java:134)
at ch.qos.logback.core.OutputStreamAppender.writeOut(OutputStreamAppender.java:194)
at ch.qos.logback.core.OutputStreamAppender.subAppend(OutputStreamAppender.java:219)
at ch.qos.logback.core.OutputStreamAppender.append(OutputStreamAppender.java:103)
at ch.qos.logback.core.UnsynchronizedAppenderBase.doAppend(UnsynchronizedAppenderBase.java:88)
at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:48)
at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:273)
at ch.qos.logback.classic.Logger.callAppenders(Logger.java:260)
at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:442)
at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:396)
at ch.qos.logback.classic.Logger.debug(Logger.java:503)
at com.ullink.slack.simpleslackapi.impl.SlackJSONSessionStatusParser.parse(SlackJSONSessionStatusParser.java:67)
at com.ullink.slack.simpleslackapi.impl.SlackWebSocketSessionImpl.connectImpl(SlackWebSocketSessionImpl.java:313)
at com.ullink.slack.simpleslackapi.impl.SlackWebSocketSessionImpl.connect(SlackWebSocketSessionImpl.java:285)
at com.fpd.teamcity.slack.SlackGateway.$anonfun$sessionByConfig$2(SlackGateway.scala:97)
at com.fpd.teamcity.slack.SlackGateway$$Lambda$1919/892078448.apply$mcV$sp(Unknown Source)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
at scala.util.Try$.apply(Try.scala:209)
at com.fpd.teamcity.slack.SlackGateway.sessionByConfig(SlackGateway.scala:97)
at com.fpd.teamcity.slack.controllers.ConfigController.$anonfun$handle$1(ConfigController.scala:33)
at com.fpd.teamcity.slack.controllers.ConfigController$$Lambda$2198/1736282298.apply(Unknown Source)
at scala.Option.map(Option.scala:146)
at com.fpd.teamcity.slack.controllers.ConfigController.handle(ConfigController.scala:27)
at com.fpd.teamcity.slack.controllers.SlackController.doHandle(SlackController.scala:17)
Hi. I have several slack teams for several projects in teamcity.
How can i setup URL for each team per project?
Hello.
All notification has no preview - [no preview available]. I using default text from your example.
Is it fixable by my side?
I installed the plug-in and enabled personal notifications. I also set up the Slack notifier on my profile to send a notification on any build, default branch, whenever the build starts, just as a test. But I don't get any notifications on Slack. Just wondering if I'm missing something.
The Slack notifications for specific build configurations, as outlined in the documentation, work fine.
Hi, I'm trying to use your plugin for slack notifications from team city, but I can't seem to get the configure to work successfully. The plugin installed correctly (I used your prebuilt 1.0 release, uploaded the zip to teamcity and restarted). As directed by the instructions, I went to Administration -> Slack, and checked the Enabled button, which presented me with the OAuth token field. I entered my xoxp-******* token, and clicked Submit. Every time, I get the error "Unable to create session by config" returned to me. I've tried numerous times, verified the app install and OAuth token (another plugin can use it to post to my build channel successfully), and restarted TeamCity multiple times. It would be great to get this plugin working, as I prefer the customization options over the alternatives.
Thank you,
Graham
specifically I want var.buildShortStatusDescription so the number of tests is highly visible
Hi!
Great plugin! I have a quick question:
How does plugin determine Slack user name so it work with message?
{mentions} - Slack users mentions only if build fails. Unknown users will be skipped.
Also - in the global notification rules I specified notify if failed build is assign to me... And I have yet to receive any notification in my tests... I am sure it has something to do with TeamCity to Slack user names...
Thanks!
Andrew
Given.
One configuration for several branches and several slack notification configurations for each branch.
At least one slack notification configurations triggers only if build status changed.
Problem.
In this case plugin should look up through the history and apply branch from current build to find the previous build properly.
I have set up several projects now and they all have unknown master branches in this plugin. When I look in bitbucket I see that they in fact are named "master".
Given.
Slack notifications is set for branch dev.
Last successful build was on master branch.
User click Try it and becomes message about master branch's build.
Expected.
User becomes message about dev branch's build.
Hello,
I just installed this plugin and it's functionality works ok for channels. However it is not sending any private notifications. Are there any prerequisites or additional configuration to set?
Cheers,
Martyna
Hi, we're using TeamCity Professional 2018.1.2 (build 58537)
Has two branches for build:
default branch name: refs/heads/master and refs/heads/dev with no branch specification filled
With branch in slack config: master, refs/heads/master,
when I'm try — previous build not found, but there is a lot of them.
Can you add possibility to notify each build step to more than one slack channel? Now plugin can notify to the one channel only.
By default plugin sends messages as app with "TeamCity".
We need to give an ability to change this name is global settings page.
I'm having trouble in configuring the plugin in TeamCity: I inserted all the parameters required included the OAuth Access token, but when try to save, it returns a message "Param oauthKey is missing".
Is there any additional configuration to do?
I am getting an error when saving the settings in Administration > Slack. It is possible that my TeamCity is quite out-dated (version 10), is there any fix without upgrading?
Unable to create session by config: missing_scope
Hi. If i check "only trigger when build changes" first status is ignored for success and failed build.
For example, i have wildcard autobuild for any branch. When developer create new branch and build failed there is no notify.
When i add to message template Triggered by: {%teamcity.build.triggeredBy.username%}
ant try to test notification ("try it") i got server error 500 with Error: java.lang.NullPointerException
Trace: java.lang.NullPointerException
at com.fpd.teamcity.slack.MessageBuilder$MessageBuilderContext.$anonfun$getBuildParameter$1(MessageBuilder.scala:112)
at com.fpd.teamcity.slack.MessageBuilder.$anonfun$compile$8(MessageBuilder.scala:77)
at scala.util.matching.Regex.$anonfun$replaceAllIn$1(Regex.scala:491)
at scala.collection.Iterator.foreach(Iterator.scala:929)
at scala.collection.Iterator.foreach$(Iterator.scala:929)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1406)
at scala.util.matching.Regex.replaceAllIn(Regex.scala:491)
at com.fpd.teamcity.slack.MessageBuilder.compile(MessageBuilder.scala:64)
at com.fpd.teamcity.slack.controllers.BuildSettingsTry.$anonfun$handle$1(BuildSettingsTry.scala:46)
at scala.util.Try$.apply(Try.scala:209)
at com.fpd.teamcity.slack.controllers.BuildSettingsTry.handle(BuildSettingsTry.scala:36)
at com.fpd.teamcity.slack.controllers.SlackController.doHandle(SlackController.scala:17)
at com.fpd.teamcity.slack.controllers.SlackController.doHandle$(SlackController.scala:15)
at com.fpd.teamcity.slack.controllers.BuildSettingsTry.doHandle(BuildSettingsTry.scala:21)
at jetbrains.buildServer.controllers.BaseController.handleRequestInternal(BaseController.java:101)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:174)
at jetbrains.buildServer.controllers.BaseController.handleRequest(BaseController.java:80)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:50)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at jetbrains.buildServer.maintenance.TeamCityDispatcherServlet.processedByMainServlet(TeamCityDispatcherServlet.java:8)
at jetbrains.buildServer.maintenance.TeamCityDispatcherServlet.service(TeamCityDispatcherServlet.java:4)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at jetbrains.buildServer.web.jsp.JspPrecompilerFilter.doFilter(JspPrecompilerFilter.java:161)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at jetbrains.buildServer.web.DisableSessionIdFromUrlFilter.doFilter(DisableSessionIdFromUrlFilter.java:8)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:107)
at jetbrains.buildServer.diagnostic.web.DiagnosticFilter.doFilter(DiagnosticFilter.java:46)
at org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:112)
at jetbrains.buildServer.web.DependencyParametersCalculationContextFilter.doFilter(DependencyParametersCalculationContextFilter.java:10)
at org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:112)
at jetbrains.buildServer.web.ContentSecurityPolicyFilter.doFilter(ContentSecurityPolicyFilter.java:2)
at org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:112)
at jetbrains.buildServer.web.CSRFFilter.doFilter(CSRFFilter.java:100)
at org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:112)
at org.springframework.web.filter.CompositeFilter.doFilter(CompositeFilter.java:73)
at jetbrains.buildServer.web.DelegatingFilter.doFilter(DelegatingFilter.java:37)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at jetbrains.buildServer.web.ResponseFragmentFilter.doFilter(ResponseFragmentFilter.java:9)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:677)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Hi,
I wasn't able to make this plugin work. When I apply Slack configuration it just goes back to "disabled" state with message: Unable to create session by config
Below catalina.out:
17:29:18.535 [TC: 17:29:18 POST '/app/slackIntegration/config?enabled=1&oauthKey=MY_TOKEN&senderName=&publicUrl=', from client 192.168.252.3:57842, authenticated as 'MY_USER' (MY_USER) {id=1}; http-nio-8111-exec-2] INFO c.u.s.s.i.SlackWebSocketSessionImpl - connecting to slack
17:29:19.328 [TC: 17:29:18 POST '/app/slackIntegration/config?enabled=1&oauthKey=MY_TOKEN&senderName=&publicUrl=', from client 192.168.252.3:57842, authenticated as 'MY_USER' (MY_USER) {id=1}; http-nio-8111-exec-2] DEBUG c.u.s.s.i.SlackWebSocketSessionImpl - HTTP/1.1 200 OK
17:29:19.328 [TC: 17:29:18 POST '/app/slackIntegration/config?enabled=1&oauthKey=MY_TOKEN&senderName=&publicUrl=', from client 192.168.252.3:57842, authenticated as 'MY_USER' (MY_USER) {id=1}; http-nio-8111-exec-2] DEBUG c.u.s.s.i.SlackJSONSessionStatusParser - parsing session status : {"ok":false,"error":"missing_scope","needed":"rtm:stream","provided":"identify,incoming-webhook"}
17:29:19.329 [TC: 17:29:18 POST '/app/slackIntegration/config?enabled=1&oauthKey=MY_TOKEN&senderName=&publicUrl=', from client 192.168.252.3:57842, authenticated as 'MY_USER' (MY_USER) {id=1}; http-nio-8111-exec-2] ERROR c.u.s.s.i.SlackWebSocketSessionImpl - Error during authentication : missing_scope
Thanks!
Hi,
I'm trying to get the APK link to sent to Slack by using https://github.com/alexkvak/teamcity-slack#artifactlinks
But the URL format sent to Slack is invalid, it sent like this:
http://<TeamCity_host_url>/repository/download/<BuildName>/<Environment>/<buildid>/my.apk
but the correct link format should be like this:
http://<TeamCity_host_url>/repository/download/<BuildName>_<Environment>/<buildid>:id/my.apk
Hi!
Thank you for this plugin.
Is it possible to attach the artifacts from TeamCity? URL link is fine but we have a lot of users in build chat who doesn't have access to TeamCity.
Kindly Regards
When build settings is set only for private notification, Try it should send probe message to current TeamCity user's Slack account.
I have set up this plugin in teamcity, and it should post to slack when the build succeeds or fails. If I click the "Try it" link, it posts a message to the correct channel with the correct status, name and build number. The branch is set as unknown:
----------------
MyProject :: master - 79
Branch: Unknown
Status: succeeded
But when the build actually succeeds or fails, nothing happens in slack.
I have the following settings:
Branch: master
Slack channel: techfeed
And/or notify commiters: [x]
Message template: the default template
Trigger when build is successful: [x]
Trigger when build is failed: [x]
What am I supposed to put in the branch-field? I only want to trigger slack notifications for the master branch.
{mentions} doesn't show the users if their slack name is not the same name that teamcity reports. It would be helpful if we could still see the name, but not tag them.
I've followed the steps to make a slack app, activated incoming webhooks etc...
When I go to enter Bot User OAuth Access Token in the teamcity admin slack page, I click submit, but after about 15 seconds I get ERR_CONNECTION_TIMED_OUT page on chrome.
Have you run into this? Any guidance?
I'm using Teamcity 2017.1.3 along with v1.1.8 of your build
Thanks so much for your help.
I'm trying to setup the plugin and I believe I'm following the instructions correctly. When I press "Submit" the plugin is not enabled and it shows the following message: "Unable to create session by config"
What am I doing wrong?
Hi @alexkvak
I/ using Teamcity version 2018.1.3
, I installed the plugin as per the instructions in the README but for some reason I keep getting the error shown below upon checking the enabled box, saving credentials etc:
Is there a log in Teamcity/logs
that might lend some additional information? I've tried all fields etc and nothing seems to get me to any other state. Thanks for your help!
Would be nice to have a post to slack when a build starts so people know the build has kicked off before the failure message.
First of all, thanks for the great plugin.
#15 reported that icon is displayed in default bot icon, and so do I.
Even though I properly set bot profile image, Teamcity-sent message is shown in default bot icon.
Could you provide icon_url
field for the message?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.