diff --git a/README.md b/README.md index 3dd43aa..006fe44 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ See the [Included Plugins | Rundeck Documentation](http://rundeck.org/docs/plugi ## Download jarfile -1. Download jarfile from [releases](https://github.com/higanworks/rundeck-slack-incoming-webhook-plugin/releases). +1. Download jarfile from [releases](https://github.com/rundeck-plugins/slack-incoming-webhook-plugin/releases). 2. copy jarfile to `$RDECK_BASE/libext` ## Build diff --git a/build.gradle b/build.gradle index b0983d3..91cd0b7 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,12 @@ +plugins { + id 'java' + id 'pl.allegro.tech.build.axion-release' version '1.7.1' +} + apply plugin: 'java' +apply plugin: 'pl.allegro.tech.build.axion-release' + sourceCompatibility = 1.6 -project.version = 1.0 defaultTasks 'clean', 'build' configurations{ @@ -13,6 +19,32 @@ configurations{ } } +scmVersion { + ignoreUncommittedChanges = false + tag { + prefix = 'v' + versionSeparator = '' + def origDeserialize=deserialize + + //apend .0 to satisfy semver if the tag version is only X.Y + deserialize = { config, position, tagName -> + println("config:" + config) + println("position:" + position) + println("tagName:" + tagName) + def orig = origDeserialize(config, position, tagName) + println("orig:" + orig) + if (orig.split('\\.').length < 3) { + orig += ".0" + } + println("orig2:" + orig) + orig + } + } +} + +println("scmVersion.version:" + scmVersion.version) +project.version = scmVersion.version + repositories { mavenCentral() } diff --git a/src/main/java/com/bitplaces/rundeck/plugins/slack/SlackNotificationPlugin.java b/src/main/java/com/bitplaces/rundeck/plugins/slack/SlackNotificationPlugin.java index 209d521..d531826 100644 --- a/src/main/java/com/bitplaces/rundeck/plugins/slack/SlackNotificationPlugin.java +++ b/src/main/java/com/bitplaces/rundeck/plugins/slack/SlackNotificationPlugin.java @@ -63,14 +63,21 @@ public class SlackNotificationPlugin implements NotificationPlugin { private static final Configuration FREEMARKER_CFG = new Configuration(); - @PluginProperty(title = "WebHook Base URL", description = "Slack Incoming WebHook Base URL", required = true, defaultValue = "https://hooks.slack.com/services") + @PluginProperty(title = "WebHook Base URL", + description = "Slack Incoming WebHook Base URL", + defaultValue = "https://hooks.slack.com/services", + scope=PropertyScope.Instance) private String webhook_base_url; @Password - @PluginProperty(title = "WebHook Token", description = "WebHook Token, like T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX", required = true) + @PluginProperty(title = "WebHook Token", + description = "WebHook Token, like T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX", + scope=PropertyScope.Instance) private String webhook_token; - @PluginProperty(title = "Slack Channel", description = "Slack Channel, like #channel-name (optional)") + @PluginProperty(title = "Slack Channel", + description = "Slack Channel, like #channel-name (optional)", + scope=PropertyScope.Instance) private String slack_channel; /** @@ -107,6 +114,10 @@ public boolean postNotification(String trigger, Map executionData, Map config) { throw new IllegalArgumentException("Unknown trigger type: [" + trigger + "]."); } + if(this.webhook_base_url.isEmpty() || this.webhook_token.isEmpty()){ + throw new IllegalArgumentException("URL or Token not set"); + } + String webhook_url=this.webhook_base_url+"/"+this.webhook_token; String message = generateMessage(trigger, executionData, config, this.slack_channel); diff --git a/src/main/resources/resources/icon.png b/src/main/resources/resources/icon.png new file mode 100644 index 0000000..8d0871f Binary files /dev/null and b/src/main/resources/resources/icon.png differ