/jira-tool

Jira Java Client Tool

Primary LanguageJava

JIRA Tools

Table of Contents

Introduction

This project has been designed to investigate different technology able to manage the creation, update or deletion of the JIRA tickets as documented under the table of content. They could be used to automate Job's action or for your own personal needs to get a Jira issue, change the status, ...

Java Atlassian Jira client

REMARK: The Aphrodite project don t manage all the CRUD operations but a few and don`t support to create or clone an issue !

References:

Instructions:

  • Move to the atlassian folder and compile the java client
cd atlassian
mvn clean package 

Create an issue

java -jar target/uber-atlassian-1.0-SNAPSHOT.jar \
    -user JIRA_USER \
    -password JIRA_PWD \
    -cfg etc/release.yaml \
    -action create \
    -url https://issues.redhat.com

Get an issue

java -jar target/uber-atlassian-1.0-SNAPSHOT.jar \
    -user JIRA_USER \
    -password JIRA_PWD \
    -url https://issues.redhat.com \
    -cfg etc/release.yaml \
    -action get \
    -issue ENTSBT-xxx

Delete an issue

java -jar target/uber-atlassian-1.0-SNAPSHOT.jar \
    -user JIRA_USER \
    -password JIRA_PWD \
    -url https://issues.redhat.com \
    -cfg etc/release.yaml \
    -action delete \
    -issue ENTSBT-xxx

Delete bulk issues

java -jar target/uber-atlassian-1.0-SNAPSHOT.jar \
    -user JIRA_USER \
    -password JIRA_PWD \
    -url https://issues.redhat.com \
    -cfg etc/release.yaml \
    -action delete-bulk \
    -issue ENTSBT-xxx ENTSBT-yyy ENTSBT-zzz

Java Prod client

Instructions:

  • Move to the atlassian folder and compile the java client
cd atlassian-prod
mvn clean package 

Create JIRA "Component/starter" issues

To create a bulk of issues for a component/starter which are blocking a JIRA Issue release, use the following command:

java -jar target/uber-atlassian-prod-1.0-SNAPSHOT.jar \
    -user JBOSS_JIRA_USER \
    -password JBOSS_JIRA_PWD \
    -cfg etc/release.yaml \
    -action create-component \
    -url https://issues.redhat.com

IMPORTANT: If the release.yaml includes a jiraKey field, then the newly component issue created will be linked to the Release Issue !

Link JIRA issues to a parent

To Link different issues to a JIRA issue using as relation type Is Blocked By, then execute the following command:

java -jar target/uber-atlassian-prod-1.0-SNAPSHOT.jar \
    -user JBOSS_JIRA_USER \
    -password JBOSS_JIRA_PWD \
    -url https://issues.redhat.com \
    -cfg etc/release.yaml \
    -action link \
    -issue ENTSBT-xxx \
    -to_issue EAP-yyy 

The to_issue parameter represents the issue which currently blocks the release issue referenced by the parameter issue.

Clone a JIRA Release issue and their subtasks

To clone a Release issue and their sub-tasks

 java -jar target/uber-atlassian-prod-1.0-SNAPSHOT.jar \
    -user JBOSS_JIRA_USER \
    -password JBOSS_JIRA_PWD \
    -url https://issues.redhat.com \
    -cfg etc/release.yaml \
    -action clone \
    -issue ENTSBT-ddd

Java Aphrodite client

See the Set Aphrodite project for more information

  • Move to the aphrodite folder and compile the java client
cd aphrodite
mvn clean compile 
mkdir etc && touch etc/aphrodite.json
  • Launch it to get JIRA issues
mvn clean package 
java -jar target/uber-aphrodite-1.0-SNAPSHOT.jar \
            -cfg ./etc/aphrodite.json \
            -url https://issues.redhat.com \
            -issue ENTSBT-343

Nodejs client

  • Create a ~/.jiracli.yml file with the following information
host:
 name: JIRA_HOST // jira.jboss.org
 user: JIRA_USER
 pwd: JIRA_PASSWORD
  • Install the node packages/modules needed
cd nodejs
npm install && npm link
  • Execute this command to get a ticket
jira get SB-869

Key         : SB-869
Title       : Contact Atomist support
Status      : New
Type        : Task
Author      : claprun
Description :
- Admin delegation
- Bug (?) on team admin: an invite is still pending even though a team member with that email has already been accepted. What happens if that invite is rescinded since the error message makes it sound like all references to that email would be deleted?
Sprint Name : SB-2018-09-14, state : CLOSED
Sprint Name : SB-2018-09-28, state : ACTIVE
  • Update the status
// To move a new ticket to status needed to Hand Over for Development
jira update SB-869 HandOver

// To move the ticket to the In Progress column of a sprint
jira update SB-869 InProgress

// To resolve/close it
jira update SB-869 ResolveIssue|CloseIssue

HTTP Request to get or create JIRA tickets

Atlassian REST API v2 doc: https://docs.atlassian.com/software/jira/docs/api/REST/8.10.0/

Get

http --verify=no --follow --auth user:pwd https://issues.jboss.org/rest/api/2/issue/SB-889

Post

http --verify=no --follow  --auth user:pwd POST https://issues.jboss.org/rest/api/2/issue/ < jira.json