GithubHelp home page GithubHelp logo

simspace / concourse-slack-alert-resource Goto Github PK

View Code? Open in Web Editor NEW

This project forked from arbourd/concourse-slack-alert-resource

0.0 1.0 0.0 737 KB

A structured Slack notification resource for Concourse

Home Page: https://hub.docker.com/r/arbourd/concourse-slack-alert-resource/

License: MIT License

Go 98.03% Dockerfile 1.97%

concourse-slack-alert-resource's Introduction

Build Status Go Report Card

concourse-slack-alert-resource

A structured and opinionated Slack notification resource for Concourse.

The message is built by using Concourse's resource metadata to show the pipeline, job, build number and a URL.

Installing

Use this resource by adding the following to the resource_types section of a pipeline config:

resource_types:

- name: slack-alert
  type: docker-image
  source:
    repository: arbourd/concourse-slack-alert-resource

See the Concourse docs for more details on adding resource_types to a pipeline config.

Source Configuration

  • url: Required. Slack webhook URL.
  • channel: Optional. Target channel where messages are posted. If unset the default channel of the webhook is used.
  • concourse_url: Optional. The external URL that points to Concourse. Defaults to the env variable ATC_EXTERNAL_URL.
  • username: Optional. Concourse local user (or basic auth) username. Required for non-public pipelines if using alert type fixed or broke
  • password: Optional. Concourse local user (or basic auth) password. Required for non-public pipelines if using alert type fixed or broke
  • disable: Optional. Disables the resource (does not send notifications). Defaults to false.

Behavior

check: No operation.

in: No operation.

out: Send a message to Slack.

Sends a structured message to Slack based on the alert type.

Parameters

  • alert_type: Optional. The type of alert to send to Slack. See Alert Types. Defaults to default.
  • channel: Optional. Channel where this message is posted. Defaults to the channel setting in Source.
  • channel_file: Optional. File containing text which overrides channel. If the file cannot be read, channel will be used instead.
  • message: Optional. The status message at the top of the alert. Defaults to name of alert type.
  • message_file: Optional. File containing text which overrides message. If the file cannot be read, message will be used instead.
  • text: Optional. Additional text below the message of the alert. Defaults to an empty string.
  • text_file: Optional. File containing text which overrides text. If the file cannot be read, text will be used instead.
  • color: Optional. The color of the notification bar as a hexadecimal. Defaults to the icon color of the alert type.
  • disable: Optional. Disables the alert. Defaults to false.

Alert Types

  • default

  • success

  • failed

  • started

  • aborted

  • errored

  • fixed

    Fixed is a special alert type that only alerts if the previous build did not succeed. Fixed requires username and password to be set for the resource if the pipeline is not public.

  • broke

    Broke is a special alert type that only alerts if the previous build succeed. Broke requires username and password to be set for the resource if the pipeline is not public.

Examples

Out

Using the default alert type with custom message and color:

resources:
- name: notify
  type: slack-alert
  source:
    url: https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX

jobs:
  # ...
  plan:
  - put: notify
    params:
      message: Completed
      color: "#eeeeee"

Using built-in alert types with appropriate build hooks:

resources:
- name: notify
  type: slack-alert
  source:
    url: https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX

jobs:
  # ...
  plan:
  - put: notify
    params:
      alert_type: started
  - put: some-other-task
    on_success:
      put: notify
      params:
        alert_type: success
    on_failure:
      put: notify
      params:
        alert_type: failed
    on_abort:
      put: notify
      params:
        alert_type: aborted
    on_error:
      put: notify
      params:
        alert_type: errored

Using the fixed alert type:

resources:
- name: notify
  type: slack-alert
  source:
    url: https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
    # `alert_type: fixed` requires Concourse credentials if pipeline is private
    username: concourse
    password: concourse

jobs:
  # ...
  plan:
  - put: some-other-task
    on_success:
      put: notify
      params:
        # will only alert if build was successful and fixed
        alert_type: fixed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.