Skip to content

Commit 1fcebdd

Browse files
committed
Fixing issue with override parameter, and added a new one for stopping post all together.
1 parent faa48cb commit 1fcebdd

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

CHANGELOG.markdown

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 4.4.0
2+
* Added support for teamcity configuration parameter "system.POST_TO_SLACK" to supress posts from config level instead of project level by setting it to false or 0. Fixed bug with existing system.SLACK_CHANNEL param name for overwriting settings at the config level.
3+
14
# 4.3.0
25
* Bumped up Teamcity library versions to 2018
36

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ apply plugin: 'java'
1111

1212

1313
sourceCompatibility = 1.8
14-
version = '4.3.0'
14+
version = '4.4.0'
1515

1616
configurations {
1717
deploy

src/main/java/com/tapadoo/slacknotifier/SlackServerAdapter.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ public SlackServerAdapter(SBuildServer sBuildServer, ProjectManager projectManag
4242
this.projectSettingsManager = projectSettingsManager ;
4343
this.buildServer = sBuildServer ;
4444
this.slackConfig = configProcessor ;
45-
4645
}
4746

4847
public void init()
@@ -74,6 +73,13 @@ public void buildStarted(SRunningBuild build) {
7473
public void buildFinished(SRunningBuild build) {
7574
super.buildFinished(build);
7675

76+
77+
String postToSlack = build.getParametersProvider().get("system.POST_TO_SLACK");
78+
79+
if(postToSlack != null && (postToSlack.equals("false") || postToSlack.equals("0") )) {
80+
return ;
81+
}
82+
7783
if( !build.isPersonal() && build.getBuildStatus().isSuccessful() && slackConfig.postSuccessful() )
7884
{
7985
processSuccessfulBuild(build);
@@ -167,7 +173,7 @@ private void postToSlack(SRunningBuild build, String message, boolean goodColor)
167173
iconUrl = slackConfig.getLogoUrl() ;
168174
}
169175

170-
String configuredChannel = build.getParametersProvider().get("SLACK_CHANNEL");
176+
String configuredChannel = build.getParametersProvider().get("system.SLACK_CHANNEL");
171177
String channel = this.slackConfig.getDefaultChannel();
172178

173179
if( configuredChannel != null && configuredChannel.length() > 0 )

teamcity-plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<info>
55
<name>slackNotifier</name> <!-- the name of plugin used in teamcity -->
66
<display-name>Slack Notifier</display-name>
7-
<version>4.3.0</version>
7+
<version>4.4.0</version>
88
<description>Post build success notifications to Slack</description>
99
<vendor>
1010
<name>Tapadoo</name>

0 commit comments

Comments
 (0)