Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom fields to be passed into the slack_fields payload #31

Merged
merged 1 commit into from
Jul 25, 2016

Conversation

mikespokefire
Copy link
Contributor

@mikespokefire mikespokefire commented Jul 25, 2016

Currently, you can only use the built in slack fields of:

['status', 'stage', 'branch', 'revision', 'hosts']

This change allows custom fields to be passed through by defining a
mapping of how to display them. e.g.

set :slack_fields, ['status', 'environment', 'docker_image']
set :slack_custom_field_mapping, -> {
  {
    'environment' => {
      title: 'Environment',
      value: -> {
        if fetch(:stage) == :production
          'production'
        else
          "staging-#{fetch(:staging_name)}"
        end
      },
      short: true,
    },
    'docker_image' => {
      title: 'Docker image',
      value: fetch(:docker_image),
      short: false,
    },
  }
}

@mikespokefire mikespokefire force-pushed the feature/custom-slack-fields branch 2 times, most recently from c316e24 to e14a9da Compare July 25, 2016 10:30
Currently, you can only use the built in slack fields of:

```
['status', 'stage', 'branch', 'revision', 'hosts']
```

This change allows custom fields to be passed through by defining a
mapping of how to display them. e.g.

```
set :slack_fields, ['status', 'environment', 'docker_image']
set :slack_custom_field_mapping, -> {
  {
    'environment' => {
      title: 'Environment',
      value: -> {
        if fetch(:stage) == :production
          'production'
        else
          "staging-#{fetch(:staging_name)
        end
      },
      short: true,
    },
    'docker_image' => {
      title: 'Docker image',
      value: fetch(:docker_image),
      short: false,
    },
  }
}
```
@mikespokefire mikespokefire force-pushed the feature/custom-slack-fields branch from e14a9da to ede6991 Compare July 25, 2016 10:36
@seenmyfate seenmyfate merged commit 264c4ca into master Jul 25, 2016
@seenmyfate seenmyfate deleted the feature/custom-slack-fields branch July 25, 2016 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants