Giter Site home page Giter Site logo

utilities's Introduction

utilities

Set of utility scripts used by IBM DevOps Services extensions

dra_utils.sh

Purpose: Provide a Deployment Risk Analytics (DRA) utility to register the IDS project with DRA, set the criteria file and new events to DRA, and request decision report from DRA.

logging_utils.sh

Purpose: Provide a common utility to log a message to the console, and send to Logging Service from a bash script

sendMessage.sh

Purpose: Send a notification message.

Description:

A simple bash script to send a notification message. It is currently supported for Slack and HipChat. It requires Slack Webhook URL token to be specified for stack notification. It requires HipChat room name and HipChat token to be specified for HipChat notification.

Synopsis:

./sendMessage.sh [-h ]
./sendMessage.sh [-d] [-l notification_level] -m notification_message

Usage:

    [-d] [-l notification_level] -m notification_message
    [-h]

Options:

    -h      Display this help message and exit
    -m      (required) Use notification massage for user input
            For example: sendMessage.sh -l good -m 'Got 200 response from <http://www.google.com|google> and <http://www.yahoo.com|yahoo>.  Search is alive and well' 
    -l      (recommended) Use notification level for user input. You can set the notification level using the NOTIFICATION_LEVEL environment variable.
            Valid values are 'good', 'info', and 'bad'. 
    -d      (optional) Debug information 

Notes:

The following environment varaiables should be specify before you call this script

    Slack Notification:

            SLACK_WEBHOOK_PATH: Specify the Slack Webhook URL
                    In order to send Slack notification you must specify the Slack Webhook URL
                    in an environment variable called 'SLACK_WEBHOOK_PATH':

                            SLACK_WEBHOOK_PATH=T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX

                    You can use or create a new Slack Webhook URL using the following steps:
                            1. Go to Slack Integration page of your project (https://yourproject.slack.com/services).
                            2. Find the Incoming WebHooks and Click on 'Configured'.
                            3. You can add new Webhook URL or select existing one.

            SLACK_COLOR: Specify the color of the border along the left side of the message. 
                    It is an optional environment variable.
                    The value can either be one of 'good', 'warning', 'danger', or any hex color code (eg. #439FE0).
                    If you set this optional environment, then, you don't need to set '-l notification_level' option when you call this script.

    HipChat Notification:

            HIP_CHAT_TOKEN: Specify the HipChat token
                    In order to send HipChat notification you must specify the HipChat token
                    in an environment variable called 'HIP_CHAT_TOKEN' like this:

                            HIP_CHAT_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXX

                    You can use or create a new HipChat token using the following steps:
                            1. Go to your HipChat account page of your project (https://yourproject.hipchat.com/account/api).
                            2. Create a new token or use existing one."

            HIP_CHAT_ROOM_NAME: Specify the name of the HipChat room.

            HIP_CHAT_COLOR: Specify the color of the border along the left side of the message and background color.
                    It is an optional environment variable.
                    The value can either be one of 'yellow', 'red', 'green', 'purple', 'gray', or 'random'.
                    If you set this optional environment, then, you don't need to set '-l notification_level' option when you call this script.

    NOTIFICATION_COLOR: Specify the color of the border along the left side of the message and background color.
            It is an optional environment variable and it apply to both Slack and HipChat color.  
            The value can either be one of 'good', 'danger', or 'info'.
            If user specify SLACK_COLOR, HIP_CHAT_COLOR and NOTIFICATION_COLOR, then SLACK_COLOR and HIP_CHAT_COLOR will be used for the notification color.
            If you set this optional environment, then, you don't need to set '-l notification_level' option when you call this script.

    NOTIFICATION_FILTER: Specify the message filter level.
            It is an optional environment variable.
            The value can be one of 'good', 'info', and 'bad'.

    NOTIFICATION_LEVEL: Specify the level of the notification message.
            It is an optional environment variable.
            The value can be one of 'good', 'info', and 'bad'.

    The table below show with 'X" when the notification message will be send based on setting notification level and NOTIFICATION_FILTER.

            |--------------------|--------------------------------------|
            |                    |         NOTIFICATION_FILTER          |
            | notification_level |----- ---|---------|--------|---------|
            |                    | unknown |   bad   |  good  |  info   |
            |--------------------|---------|---------|--------|---------|
            |    unknown         |    X    |    X    |    X   |   X     |                     
            |--------------------|---------|---------|--------|---------|
            |    bad             |    X    |    X    |    X   |   X     |
            |--------------------|---------|---------|--------|---------|
            |    good            |    X    |         |    X   |   X     |
            |--------------------|---------|---------|--------|---------|
            |    info            |         |         |        |   X     |
            |--------------------|---------|---------|--------|---------|

utilities's People

Contributors

bsanaei avatar clopatofsky avatar eergun1 avatar jgarcows avatar kkronstainbrown avatar nfritze avatar rjminsha avatar sppatel avatar

Watchers

 avatar

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.