0.0.18 • Published 8 years ago

grunt-idra2 v0.0.18

Weekly downloads
2
License
MIT
Repository
-
Last release
8 years ago

grunt-idra2

Grunt Plugin for IBM Deployment Risk Analyzer (DRA)

Getting Started

This plugin requires Grunt ~0.4.5

This plugin is used to instrument the IDSv2 pipeline to send events and logs to the Deployment Risk Analyzer and to get a decision/risk score from it. This plugin will not work in IDSv1 pipeline. You may install this plugin with this command:

npm install grunt-idra2

Typical use of this plugin in the pipeline is as follows

grunt [--gruntfile=<filename>] <command>
where:
   command could be one of the following
     -eventType=<eventname>
     -decision=<criterianame>
     -decision=dynamic -criteriafile=<filename>
     -statusCheck=<servicenames>

eventType

Use this option to log an event (typically test result) to the DRA server. The name of the event is passed to the option. Few additional options can be provided to append more data to the event log. -file This option takes a file name including the path. Only JSON and YAML file types are supported. The contents of the file is sent to the DRA server and logged along with the event data. If the file contains invalid JSON or YML data then the file is ignored and only event data is logged. If YAML file is provided, it is parsed into JSON and logged with event data.

grunt [--gruntfile=>filename>] -eventType=<some event Name> -file=<path to JSON/YAML file name>

-drilldownUrl The value for this option should be a valid url. The value of this option is sent to the DRA server and logged along with the event data. If the url is invalid then this option is ignored.

grunt [--gruntfile=>filename>] -eventType=<some event Name> -file=<path to JSON file name> -drilldownUrl=<URL>
grunt [--gruntfile=>filename>] -eventType=<some event Name> -drilldownUrl=<URL>

decision

Use this option to get a decision from the DRA based on the logged data and a criteria whose name is provided as the value of this option. The response of this call is a JSON data (sample shown below). The important value in the response is the value of "decision" attribute. It could be either "Proceed", "Stop" or "Stop - Advisory"

grunt [--gruntfile=>filename>] -decision=<A criteria name>

dynamic decision

Use this option to get a decision from the DRA based on the logged data and a dynamic criteria. A dynamic criteria is criteria that is provided to DRA at the time of decision. in other words this criteria is not available (created) in DRA before the decision is called. A JSON file containing the criteria is sent in this decision call. The response of this call is a JSON data (sample shown below). The important value in the response is the value of "decision" attribute. It could be either "Proceed", "Stop" or "Stop - Advisory"

grunt [--gruntfile=>filename>] -decision=dynamic -criteriafile=<path to file name containing the criteria JSON>
Response of a decision
{"criteriaName":"DRABuildTest",
...,
"score":"100%",
"decision":"Proceed",
...,
"timestamp":"2015-09-08T13:57:38.203Z"}

Status Check

Use this option to check the status of Bluemix services. The comma separates list of services to be checked are passed to this option. The status is checked by the plugin itself, in other words the plugin does not communicate with the DRA server for this purpose. The response is a one line text indicating success only if all the services mentioned are up and running. A failure is indicated if any of the mentioned services are down.`js grunt --gruntfile=>filename> -statusCheck="activedeploy,Auto-Scaling,CloudIntegration"

The names of the services should match the names used in http://estado.ng.bluemix.net/

### Connecting to different Deployment Analytics Server
By default the plugin connects to the production deployment analytics server. Use the environment variable **DRA_SERVER** to change the default server. 

## The "idra" task

### Overview
In your Gruntfile, add a section named `idra` to the data object passed into `grunt.initConfig()`.

```js
  grunt.initConfig({
    idra: {
      config :{
        deployAnalyticsServer: 'http://localhost:3999',  // optional
        events: {
          eventname: {   // optional
            attr1: 'somevalue',
            attr2: 'somevalue',
            file: 'path to a json file',
          }
        }
      }
    },
  });

  grunt.loadNpmTasks('grunt-idra');

A default Gruntfile named idra.js is provided in the npm module which can be used as shown below

grunt --gruntfile=node_modules/grunt-idra2/idra.js (...followed by options)

deployAnalyticsServer:

This value is optional, the plugin connects to a the production Deployment Analytics Server by default, if this value is not provided

events:

The entries here are optional. The entries here provides a way to specify additional attributes to be passed for an event. Each event can have an attribute named file, which when set sends the contents of that file along with the event. Only JSON data type is supported for file. There is no limit to the number of events that can be set here. It is not necessary to specify the event here to use it.

Release History

(Nothing yet)

0.0.18

8 years ago

0.0.17

8 years ago

0.0.16

8 years ago

0.0.15

8 years ago

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago