Module: SozoMagento2::Slack

Defined in:
lib/capistrano/sozo_magento2/slack.rb

Overview

Slack message template

Instance Method Summary collapse

Instance Method Details

#message_hashString

Slack message template

Returns:

  • (String)

    the template hash



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/capistrano/sozo_magento2/slack.rb', line 11

def message_hash
    {
        "channel" => fetch(:slack_channel), 
        "username" => "SOZO Deploy Bot", 
        "icon_emoji" => ":satellite:", 
        "color" => "good", 
        "text" => "#{fetch(:url)} Deployment Process Begun",
        "blocks" => [
            {
                "type" => "header", 
                "text" => {
                    "type" => "plain_text", 
                    "text" => "Deployment Process Begun"
                }
            }, 
            {
                "type" => "divider"
            }, 
            { 
                "type" => "section", 
                "text" => {
                    "type" => "mrkdwn", 
                    "text" => "#{fetch(:url)} is being Deployed"
                }, 
                "accessory" => {
                    "type" => "button", 
                    "style" => "primary", 
                    "text" => {
                        "type" => "plain_text", 
                        "text" => "Visit Site", 
                        "emoji" => true
                    },
                    "value" => "click_me_123", 
                    "url" => fetch(:url), 
                    "action_id" => "button-action"
                }
            }, 
            {
                "type" => "section", 
                "fields" => [
                    {
                        "type" => "mrkdwn", 
                        "text" => "*Branch:*\n#{fetch(:branch)}"
                    }, 
                    {
                        "type" => "mrkdwn", 
                        "text" => "*Developer:*\n#{fetch(:local_user)}"
                    }, 
                    {
                        "type" => "mrkdwn", 
                        "text" => "*Environment:*\n#{fetch(:environment)}"
                    }
                ]
            }
        ]
    }
end