This package has been deprecated

Author message:

Deprecated - use grunt-idra3 instead

grunt-idra

0.0.43 • Public • Published

grunt-idra

Grunt Plugin for IBM Deployment Risk Analyzer (DRA)

Getting Started

This plugin requires Grunt ~0.4.5

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

npm install grunt-idra

Typical use of this plugin in the pipeline is as follows

grunt [--gruntfile=<filename><command>
where:
   command could be one of the following
     -init=<projectKey>
     -eventType=<eventname>
     -decision=<criterianame>
     -decision=dynamic -criteriafile=<filename>
     -isDRAEnabled

init

The first call to this plugin from the pipeline should be init, passing in the projectKey. This step is required for the plugin to work correctly. The call to init should be made from the first job of the first stage of the pipeline.

grunt [--gruntfile=>filename>] -init=<projectKey>

The projectKey is used as an authorization mechanism. A valid projectKey can be obtained using the DRA register API. The plugin needs the projectKey to successfully communicate with the DRA server. The project key needs to be provided only once. The only exception to this is if there are multiple jobs set in the first stage of the pipeline, then in addition to calling this plugin with init option (in the first job in the first stage) the project key should also be set as an environment variable in the first stage of the pipeline. The name of the environment variable should be DRA_PROJECT_KEY

eventType

This option is used to log an event 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 file type is 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 data then this option is ignored.

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

-drilldownUrl This option a valid url. The value of url 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

This option is used 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 is shown below. The important value in the response is the value of "decision" attribute. It could be either "proceed" or "stop"

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

dynamic decision

This option is used 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 is shown below. The important value in the response is the value of "decision" attribute. It could be either "proceed" or "stop"

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

isDRAEnabled

This option is used to determined if the DRA is enabled for the pipeline.

grunt [--gruntfile=>filename>] -isDRAEnabled
Response:
{"enabled"true}

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().

  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');

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)

Readme

Keywords

Package Sidebar

Install

npm i grunt-idra

Weekly Downloads

2

Version

0.0.43

License

none

Last publish

Collaborators

  • umesh.parulekar