Atlassian JIRA Command-Line (CLI)
Jamira is a command-line API for Atlassian JIRA using the Tomitribe CREST library.
Installation
Jamira can be downloaded as a ready-to-go executable from Maven Central
curl https://repo1.maven.org/maven2/org/tomitribe/jamira/jamira-cli/0.1/jamira-cli-0.1.sh > /usr/local/bin/jamira chmod 755 /usr/local/bin/jamira
Installation using JBang
Jamira can be installed and run with jbang - it will even setup java for you if you do not have that available.
curl -Ls sh.jbang.dev | bash -s app install jamira@tomitribe/jamira jamira ---
Completion
Additionally, if you want command completion you can add the following to your ~/.bash_profile
, ~/.bashrc
or similar environment setup scripts:
source "$(jamira _completion -f)"
Setup
Jamira has accounts in a similar way git has remotes. An account can be setup using the account add
command
Usage: account add Name Username Password URI
The Name
value should be any short identifier with no spaces and all lowercase. Any other command that has an --account
flag can use that identifier to locate the login information and URL of your desired JIRA server.
Example setup:
$ jamira account add apache elmerfudd "GetTh3Rabb1t" https://issues.apache.org/jira $ jamira account list name username serverUri -------- ----------- -------------------------------- apache elmerfudd https://issues.apache.org/jira
Commands
$ jamira Commands: account bulk-create create help list
List
$ jamira list Usage: list [subcommand] [options] Sub commands: components favourite-filters fields groups issue-link-types issue-types priorities project-roles projects resolutions statuses subtasks users versions
List Priorities
For example to list all of the priorities setup in the JIRA install:
$ ./jamira-cli/target/jamira list priorities id name description ------- ---------- -------------------------------------------------------------------------------------------------------------- 1 Blocker Blocks development and/or testing work, production could not run 10000 Urgent This issue should block release until it is resolved, and trigger immediate release once resolved. 2 Critical Crashes, loss of data, severe memory leak. 10001 High 3 Major Major loss of function. 10002 Normal 4 Minor Minor loss of function, or other problem where easy workaround is present. 10003 Low 5 Trivial Cosmetic problem like misspelt words or misaligned text. 10100 P0 Outage blocking development and/or testing work; requires immediate and continuous attention 10101 P1 Critical bug: data loss, total loss of function, or loss of testing signal due to test failures or flakiness 10102 P2 Default priority. Will be triaged and planned according to community practices. 10103 P3 Non-urgent bugs, features, and improvements 10104 P4 Trivial items, spelling errors, etc.
List Subtasks
To list all of the subtasks for a specific issue
$ jamira list subtasks OPENEJB-142 issueKey summary status.name -------------- ------------------------------------------------------ ------------- OPENEJB-145 iTest: StatelessRemoteJndiTests Closed OPENEJB-146 iTest: StatelessLocalJndiTests Closed OPENEJB-147 iTest: StatelessHomeIntfcTests Closed OPENEJB-148 iTest: StatelessEjbHomeTests Closed OPENEJB-149 iTest: StatelessEjbObjectTests Closed OPENEJB-150 iTest: StatelessEjbLocalHomeTests Closed OPENEJB-151 iTest: StatelessEjbLocalObjectTests Closed OPENEJB-152 iTest: StatelessRemoteIntfcTests Closed OPENEJB-153 iTest: StatelessLocalIntfcTests Closed OPENEJB-154 iTest: StatelessHomeHandleTests Closed
Create
Can create issues, versions and components. For common issue types there are convenience commands; bug, improvement, new-feature, task, subtask.
$ jamira create Missing sub-command Usage: create [subcommand] [options] Sub commands: bug component improvement issue new-feature subtask task version wish
Create Sub-Task
Sub-tasks can be created by simply specifying the parent issue key and supplying a text summary to use for the new issue
$ jamira create subtask Missing argument: IssueKey Usage: create subtask [options] IssueKey String Options: --account=<Account> Shortname of the JIRA server (default: default) --affected-version=<String[]> The names of the versions affected by the issue --assignee=<String> Username of the person to which the issue should be assigned --component=<String[]> The component names relating to the issue --description=<String> Long description of the issue --fix-version=<String[]> The names of the versions affected by the issue --priority=<String> The name of the priority for the issue --reporter=<String> Username of the person who is the reporter of the issue
For example:
jamira create subtask TOMEE-3002 "Test caching"
Bulk-create
When you have several issues you need to create it’s advised to use the bulk API.
$ jamira bulk-create Missing sub-command Usage: bulk-create [subcommand] [options] Sub commands: issues subtasks
Bulk-create Subtasks
Subtasks can be created in bulk using the following command. The summary for each subtask is read from the piped input stream. This allows several lines of text to be generated on the command line and each line becomes a subtask.
$ jamira bulk-create subtasks Missing argument: IssueKey Usage: bulk-create subtasks [options] IssueKey Options: --account=<Account> The shortname of the jira install configured via the `setup` command (default: default) --affected-version=<String[]> The names of the versions affected by the issue --assignee=<String> Username of the person to which the issue should be assigned --component=<String[]> The component names relating to the issue --fix-version=<String[]> The names of the versions affected by the issue --priority=<String> The name of the priority for the issue --reporter=<String> Username of the person who is the reporter of the issue
For example:
$ echo -e "Bulk insert"{1..10}"\n" Bulk insert1 Bulk insert2 Bulk insert3 Bulk insert4 Bulk insert5 Bulk insert6 Bulk insert7 Bulk insert8 Bulk insert9 Bulk insert10 $ echo -e "Bulk insert"{1..10}"\n" | jamira bulk-create subtasks TOMEE-3002 TOMEE-3021 TOMEE-3022 TOMEE-3023 TOMEE-3024 TOMEE-3025 TOMEE-3026 TOMEE-3027 TOMEE-3028 TOMEE-3029 TOMEE-3030