From 7ff896142436e25b3f0013c68a82b97eb4b6277d Mon Sep 17 00:00:00 2001 From: Mark Mercado Date: Sat, 17 Dec 2022 12:36:37 -0500 Subject: [PATCH] Bump jira to 3.4.1 --- CHANGES.md | 4 ++ README.md | 109 ++++++++++++++++++++++++++++++----------------- pack.yaml | 2 +- requirements.txt | 3 +- 4 files changed, 77 insertions(+), 41 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index a23b7e1..f184ce4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # Change Log +## 2.0.0 + +- [#48](https://github.com/StackStorm-Exchange/stackstorm-jira/issues/48) Update `jira==3.4.1` + ## 1.1.0 - Add PAT-based authentication (PR #47) diff --git a/README.md b/README.md index 4d3a477..2c9c355 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,14 @@ -# JIRA integration pack +# Jira integration pack -This pack consists of a sample JIRA sensor and a JIRA action. +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. +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` @@ -14,7 +17,7 @@ Then install this pack with: `st2 pack install jira` Copy the example configuration in [jira.yaml.example](./jira.yaml.example) to `/opt/stackstorm/configs/jira.yaml` and edit as required. -* ``url`` - URL of the JIRA instance (e.g. ``https://myproject.atlassian.net``) +* ``url`` - URL of the Jira instance (e.g. ``https://myproject.atlassian.net``) * ``poll_interval`` - Polling interval - default 30s * ``project`` - Key of the project which will be used as a default with some of the actions which don't require or allow you to specify a project (e.g. ``STORM``). @@ -22,16 +25,19 @@ to `/opt/stackstorm/configs/jira.yaml` and edit as required. * ``auth_method`` - Specify either `basic`, `oauth` or `PAT` authentication Include the following settings when using the `oauth` auth_method: + * ``rsa_cert_file`` - Path to the file with a private key * ``oauth_token`` - OAuth token * ``oauth_secret`` - OAuth secret * ``consumer_key`` - Consumer key Include the following settings when using the `basic` auth_method: + * ``username`` - Username * ``password`` - Password Include the following settings when using the `PAT` auth_method: + * ``token`` - PAT token If using the `oauth` auth_method, take a look at the OAuth section below for further setup instructions. @@ -47,49 +53,74 @@ You can also use dynamic values from the datastore. See the ### Disclaimer -This documentation is written as of 06/17/2014. JIRA 6.3 implements OAuth1. Most of this doc would need to be revised when JIRA switches to OAuth2. +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 - ``` - # This will create a 2048 length RSA private key - $openssl genrsa -out mykey.pem 2048 - ``` - - ``` - # Now, create the public key associated with that private key - openssl rsa -in mykey.pem -pubout - ``` -2. 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 - >>> - ``` - -3. Configure JIRA for external access: - * Go to AppLinks section of your JIRA - https://JIRA_SERVER/plugins/servlet/applinks/listApplicationLinks - * Create a Generic Application with some fake URL - * Click Edit, hit IncomingAuthentication. Plug in the consumer key and RSA public key you generated. -4. Get access token using this [script](https://github.com/lakshmi-kannan/jira-oauth-access-token-generator/blob/master/generate_access_token.py). 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](https://github.com/lakshmi-kannan/jira-oauth-access-token-generator/blob/master/README.md) file for more information. - The access token is printed at the end of running that script. Save these keys somewhere safe. -5. 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. + +```shell +$ openssl genrsa -out stackstorm-jira.pem 4096 +``` + +2. Create the public key associated with that private key + +```shell +$ openssl rsa -in stackstorm-jira.pem -pubout +``` + +3. Generate a consumer key. You can use python uuid.uuid4() to do this, for example: + +```shell +$ 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 +>>> +``` + +4. 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. + +5. Get access token using this [script](https://github.com/lakshmi-kannan/jira-oauth-access-token-generator/blob/master/generate_access_token.py). + 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](https://github.com/lakshmi-kannan/jira-oauth-access-token-generator/blob/master/README.md) file for more information. + The access token is printed at the end of running that script. + Save these keys somewhere safe. + +6. 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 -### JiraSensor +* ``JiraSensor`` - Sensor which monitors JIRA for new tickets. +* ``JiraSensorForAPIv2`` - Sensor which monitors JIRA for new tickets. The sensor monitors for new tickets and sends a trigger into the system whenever there is a new ticket. ## Actions -* ``create_issue`` - Action which creates a new JIRA issue. -* ``get_issue`` - Action which retrieves details for a particular issue. +* ``add_field_value`` - Add a field to a particular JIRA issue. +* ``assign_issue`` - Assigning an issue to a user. +* ``attach_file_to_issue`` - Attach a file to JIRA issue / ticket. +* ``attach_files_to_issue`` - Attach multiple files to JIRA issue / ticket. +* ``comment_issue`` - Comment on a JIRA issue / ticket. +* ``create_issue`` - Create a new JIRA issue / ticket. +* ``get_issue`` - Retrieve information about a particular JIRA issue. +* ``get_issue_attachments`` - Retrieve attachments for a particular JIRA issue. +* ``get_issue_comments`` - Retrieve comments for a particular JIRA issue. +* ``link_issue`` - Link one JIRA issue to another JIRA issue. +* ``search_issues`` - Search JIRA issues with a JQL query. +* ``transition_issue`` - Do a transition on a JIRA issue / ticket. +* ``transition_issue_by_name`` - Do a transition on a JIRA issue / ticket. +* ``update_field_value`` - Update a field in a particular JIRA issue. diff --git a/pack.yaml b/pack.yaml index 5229220..0e7e31f 100644 --- a/pack.yaml +++ b/pack.yaml @@ -6,7 +6,7 @@ keywords: - issues - ticket management - project management -version: 1.1.0 +version: 2.0.0 python_versions: - "3" author : StackStorm, Inc. diff --git a/requirements.txt b/requirements.txt index 556428b..53e577a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ -jira==2.0.0 +jira==3.4.1 +pyjwt==2.6.0