StackStorm-Exchange / stackstorm-jira

st2 content pack containing jira integrations
https://exchange.stackstorm.org/
Apache License 2.0
15 stars 35 forks source link

Jira integration pack

This pack consists of a sample Jira sensor and a Jira action.

Installation

You will need to have gcc installed on your system. For Ubuntu systems, run sudo apt-get install gcc. For Redhat/CentOS systems, run sudo yum install gcc libffi-devel python-devel openssl-devel. To build the python cryptography dependency (part of the following st2 pack install command) 2GB of RAM is recommended. In some cases adding a swap file may eliminate strange gcc compiler errors.

Then install this pack with: st2 pack install jira

Configuration

Copy the example configuration in jira.yaml.example to /opt/stackstorm/configs/jira.yaml and edit as required.

Include the following settings when using the oauth auth_method:

Include the following settings when using the basic auth_method:

Include the following settings when using the PAT auth_method:

Include the following settings when using the api_token auth_method:

If using the oauth auth_method, take a look at the OAuth section below for further setup instructions.

You can also use dynamic values from the datastore. See the docs for more info.

Note : When modifying the configuration in /opt/stackstorm/configs/ please remember to tell StackStorm to load these new values by running st2ctl reload --register-configs

OAuth

Disclaimer

This documentation is written as of 06/17/2014. Jira 6.3 implements OAuth1. Most of this document would need to be revised when Jira switches to OAuth2.

Steps

  1. Generate RSA public/private key pair
$ openssl genrsa -out stackstorm-jira.pem 4096
  1. Create the public key associated with that private key
$ openssl rsa -in stackstorm-jira.pem -pubout
  1. Generate a consumer key. You can use python uuid.uuid4() to do this, for example:
$ python
Python 2.7.10 (default, Jul 30 2016, 19:40:32)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import uuid
>>> print uuid.uuid4()
210660f1-ca8a-40d5-a6ee-295ccbf3074d
>>>
  1. Configure Jira for external access:

    • Go to AppLinks section of your Jira at https://{jira_server}/plugins/servlet/applinks/listApplicationLinks
    • Create a Generic Application with some fake URL
    • Click Edit, choose IncomingAuthentication, plug in the consumer key and RSA public key you generated.
  2. Get access token using this script. You may need to install additional libraries to run that script, and you will need to edit the script to use your file locations. Check the README file for more information. The access token is printed at the end of running that script. Save these keys somewhere safe.

  3. Plug in the access token and access secret into the sensor or action. You are good to make Jira calls. Note: OAuth token expires. You'll have to repeat the process based on the expiry date.

Sensors

The sensor monitors for new tickets and sends a trigger into the system whenever there is a new ticket.

Actions

Maintainers

Active pack maintainers with review & write repository access and expertise with JIRA: