All Projects → ashwanthkumar → Gocd Slack Build Notifier

ashwanthkumar / Gocd Slack Build Notifier

GoCD (gocd.org) plugin to push build notifications to Slack

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Gocd Slack Build Notifier

Laravel Slack Slash Command
Make a Laravel app respond to a slash command from Slack
Stars: ✭ 215 (+123.96%)
Mutual labels:  slack, notifications
Chronos
📊 📊 📊 Monitors the health and web traffic of servers, microservices, and containers with real-time data monitoring and receive automated notifications over Slack or email.
Stars: ✭ 347 (+261.46%)
Mutual labels:  slack, notifications
Psslack
PowerShell module for simple Slack integration
Stars: ✭ 231 (+140.63%)
Mutual labels:  slack, notifications
Server Monitor App
A PHP application to monitor the health of your servers
Stars: ✭ 141 (+46.88%)
Mutual labels:  slack, notifications
Notify
A dead simple Go library for sending notifications to various messaging services.
Stars: ✭ 727 (+657.29%)
Mutual labels:  slack, notifications
Yfiton
Cross-platform CLI utility command for sending notifications using well-known or modern communication services
Stars: ✭ 142 (+47.92%)
Mutual labels:  slack, notifications
slack-texts
SMS notifications for Slack groups
Stars: ✭ 19 (-80.21%)
Mutual labels:  notifications, slack
Onhold
🔊 Play sounds while and after shell jobs complete
Stars: ✭ 146 (+52.08%)
Mutual labels:  pipeline, notifications
Diun
Receive notifications when an image is updated on a Docker registry
Stars: ✭ 704 (+633.33%)
Mutual labels:  slack, notifications
Laravel Failed Job Monitor
Get notified when a queued job fails
Stars: ✭ 582 (+506.25%)
Mutual labels:  slack, notifications
Tfsnotificationrelay
An extensible plugin for TFS that sends notifications to Slack, HipChat and IRC
Stars: ✭ 120 (+25%)
Mutual labels:  slack, notifications
Synology Notifications
Synology notifications service
Stars: ✭ 47 (-51.04%)
Mutual labels:  slack, notifications
Statusok
Monitor your Website and APIs from your Computer. Get Notified through Slack, E-mail when your server is down or response time is more than expected.
Stars: ✭ 1,522 (+1485.42%)
Mutual labels:  slack, notifications
Uptime Monitor App
A PHP application to monitor uptime and ssl certificates
Stars: ✭ 205 (+113.54%)
Mutual labels:  slack, notifications
Ravenx
Notification dispatch library for Elixir applications
Stars: ✭ 100 (+4.17%)
Mutual labels:  slack, notifications
Alertmanager
Prometheus Alertmanager
Stars: ✭ 4,574 (+4664.58%)
Mutual labels:  slack, notifications
Yii2 Slack Log
Pretty Slack log target for Yii 2
Stars: ✭ 24 (-75%)
Mutual labels:  slack, notifications
Craft Brief
Quick, easy, and customizable user-group notifications for Craft CMS.
Stars: ✭ 47 (-51.04%)
Mutual labels:  slack, notifications
Node Gcm
A NodeJS wrapper library port to send data to Android devices via Google Cloud Messaging
Stars: ✭ 1,286 (+1239.58%)
Mutual labels:  notifications
Slack cleaner2
📝 Python3 module for deleting Slack messages and files using the Slack REST API
Stars: ✭ 92 (-4.17%)
Mutual labels:  slack

Build Status

gocd-slack-build-notifier

Slack based GoCD build notifier

Setup

Download jar from releases & place it in /plugins/external & restart Go Server.

Configuration

All configurations are in HOCON format. Plugin searches for the configuration file in the following order

  1. File defined by the environment variable GO_NOTIFY_CONF.
  2. go_notify.conf at the user's home directory. Typically it's the go user's home directory (/var/go).
  3. go_notify.conf present at the CRUISE_SERVER_DIR environment variable location.

You can find the details on where / how to setup environment variables for GoCD at the documentation.

Minimalistic configuration would be something like

gocd.slack {
  login = "someuser"
  password = "somepassword"
  api-token = "a-valid-token-from-gocd-server"
  server-host = "http://localhost:8153/"
  api-server-host = "http://localhost:8153/"
  webhookUrl = "https://hooks.slack.com/services/...."

  # optional fields
  channel = "#build"
  slackDisplayName = "gocd-slack-bot"
  slackUserIconURL = "http://example.com/slack-bot.png"
  display-console-log-links = true
  displayMaterialChanges = true
  process-all-rules = true
  proxy {
    hostname = "localhost"
    port = "5555"
    type = "socks" # acceptable values are http / socks
  }
}
  • login - Login for a Go user who is authorized to access the REST API.
  • password - Password for the user specified above. You might want to create a less privileged user for this plugin.
  • api-token - Valid GoCD access token. Available starting from v19.2.0 (https://api.gocd.org/current/#bearer-token-authentication). If both login/password and api-token are present, api-token takes precedence.
  • server-host - FQDN of the Go Server. All links on the slack channel will be relative to this host.
  • api-server-host - This is an optional attribute. Set this field to localhost so server will use this endpoint to get PipelineHistory and PipelineInstance
  • webhookUrl - Slack Webhook URL
  • channel - Override the default channel where we should send the notifications in slack. You can also give a value starting with @ to send it to any specific user.
  • display-console-log-links - Display console log links in the notification. Defaults to true, set to false if you want to hide.
  • displayMaterialChanges - Display material changes in the notification (git revisions for example). Defaults to true, set to false if you want to hide.
  • process-all-rules - If true, all matching rules are applied instead of just the first.
  • truncate-changes - If true, displays only the latest 5 changes for all the materials. (Default: true)
  • proxy - Specify proxy related settings for the plugin.
    • proxy.hostname - Proxy Host
    • proxy.port - Proxy Port
    • proxy.type - socks or http are the only accepted values.

Pipeline Rules

By default the plugin pushes a note about all failed stages across all pipelines to Slack. You have fine grain control over this operation.

gocd.slack {
  server-host = "http://localhost:8153/"
  webhookUrl = "https://hooks.slack.com/services/...."

  pipelines = [{
    name = "gocd-slack-build"
    stage = "build"
    group = ".*"
    state = "failed|passed"
    channel = "#oss-build-group"
    owners = ["ashwanthkumar"]
    webhookUrl = "https://hooks.slack.com/services/another-team-hook-id..."
  },
  {
    name = ".*"
    stage = ".*"
    state = "failed"
  }]
}

gocd.slack.pipelines contains all the rules for the go-server. It is a list of rules (see below for what the parameters mean) for various pipelines. The plugin will pick the first matching pipeline rule from the pipelines collection above, so your most specific rule should be first, with the most generic rule at the bottom. Alternatively, set the process-all-rules option to true and all matching rules will be applied.

  • name - Regex to match the pipeline name
  • stage - Regex to match the stage name
  • group - Regex to match the pipeline group name
  • state - State of the pipeline at which we should send a notification. You can provide multiple values separated by pipe (|) symbol. Valid values are passed, failed, cancelled, building, fixed, broken or all.
  • channel - (Optional) channel where we should send the slack notification. This setting for a rule overrides the global setting
  • owners - (Optional) list of slack user handles who must be tagged in the message upon notifications
  • webhookUrl - (Optional) Use this webhook url instead of the global one. Useful if you're using multiple slack teams.

Configuring the plugin for GoCD on Kubernetes using Helm

Creating a Kubernetes secret to store the config file

  • Create a file that has the config values, for example go_notify.conf
  • Then create a Kubernetes secret using this file in the proper namespace
kubectl create secret generic slack-config \
--from-file=go_notify.conf=go_notify.conf \
--namespace=gocd

Adding the plugin

  • In order to add this plugin, you have to use a local values.yaml file that will override the default values.yaml present in the official GoCD helm chart repo.
  • Add the .jar file link from the releases section to the env.extraEnvVars section as a new environment variable.
  • The environment variable name must have GOCD_PLUGIN_INSTALL prefixed to it.
  • Example
env:
  extraEnvVars:
    - name: GOCD_PLUGIN_INSTALL_slack-notification-plugin
      value: https://github.com/ashwanthkumar/gocd-slack-build-notifier/releases/download/v1.3.1/gocd-slack-notifier-1.3.1.jar
    - name: GO_NOTIFY_CONF
      value: /tmp/slack/go_notify.conf
  • Make sure to add the link of the release you want to use.
  • If you want to specify a custom path for the go_notify.conf file you can use the GO_NOTIFY_CONF environment variable as given above.

Mounting the config file

  • Mount the previously secret to a path by adding the following configuration to the local values.yaml
persistence:
  extraVolumes:
    - name: slack-config
      secret:
        secretName: slack-config
        defaultMode: 0744

  extraVolumeMounts:
    - name: slack-config
      mountPath: /tmp/slack
      readOnly: true
  • If you want to use a custom config location by specifying GO_NOTIFY_CONF, then you can use the above mountPath. If not, change the mountPath to /var/go as it is the default go user's home directory.
  • Then applying the local values.yaml that has these values added to it will result in a new Go Server pod being created that has the plugin installed and running.

Screenshots

License

http://www.apache.org/licenses/LICENSE-2.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].