Sort by Topics, Resources
Clear
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Salto for

Jira

Articles

SHARE

Simplifying Jira Tasks with CLI: Practical Use Cases and Tips

Gal Fatal

October 31, 2023

10

min read

Introduction

A Command Line Interface (CLI) provides a method for interacting with a computer program or operating system through text-based commands entered into a terminal or command prompt window.

In a CLI, users input commands using a specific syntax, and the program provides text-based feedback in response. This method can be an efficient way for users comfortable with text-based interfaces to perform tasks, especially for system administrators, developers, and advanced users.

Popular CLI interfaces include the Windows Command Prompt, PowerShell, and the Linux/Unix terminal. Many software development tools, databases, and networking devices also offer their own command-line interfaces for advanced configuration and automation.

Atlassian does not provide an out-of-the-box CLI. However, there is an app available in the Atlassian marketplace that supports CLI for Jira, as well as other Atlassian tools like Confluence and Bitbucket.

The most popular app in the Atlassian marketplace for a command-line interface is the Jira Command Line Interface (CLI) by Appfire. This app provides a user-friendly CLI with about 1000 actions you can perform, supporting both Data Center and Cloud versions of Jira, Confluence, Bitbucket, and Bamboo.

The app enables Jira admins and users to interact with Jira via a command-line interface, allowing for tasks such as creating and updating issues, performing searches, generating reports, and managing workflows, attachments, comments, and more—all from the command line.

It is particularly beneficial for automating repetitive tasks, integrating with other tools, and for users who prefer working in a command-line environment.

Command Line Interface (CLI) is a way to interact with a computer program or operating system through text-based commands entered into a terminal or command prompt window.

CLI vs Other Automation Options

One way to automate tasks in Jira is through the Command Line Interface (CLI). However, other methods are available, such as Automation Rules and Scripts.

Jira Automation Rules

Jira automation is a powerful tool streamlining your workflow by automating everyday tasks. With Jira automation, you can set up custom rules and triggers to perform actions such as assigning issues, updating fields, and sending notifications. This feature is included with both Jira Cloud and Data Center at no additional cost.

Using Jira automation saves time, reduces errors, and improves team efficiency. By automating routine tasks, your team can focus on more complex work. For strategies on building, testing, and maintaining Jira Automation Rules, see "10 Strategies for Building, Testing, and Maintaining Jira Automation Rules."

Why Consider Using CLI Instead or in Parallel with Jira Automation Rules?

  • Jira automation rules have limitations, such as a limited number of monthly runs in the cloud.
  • Specific tasks can’t be accomplished using Jira automation rules but can be accomplished using CLI.
  • For one-time automations, there may be more efficient options than building a Jira automation rule.
  • CLI can be a faster and more accessible alternative to building a Jira automation rule.

Automations by Apps (Using Scripts)

When creating complex automations, Jira automation rules may not suffice. In these cases, apps that support scripting, such as ScriptRunner for Jira, can be considered.

ScriptRunner for Jira is a comprehensive tool that allows users to tailor Jira to their specific needs, automate workflows, and perform complex operations that might not be achievable through Jira's native features alone. It is widely used by Jira administrators, developers, and power users to enhance the capabilities of their Jira instances.

Why Consider Using CLI Instead or in Parallel with Using Scripts?

  • Scripts can be complex and require development skills, while CLI is more straightforward to understand and operate.
  • Writing scripts can be time-consuming, while CLI commands are quick and concise, making them more efficient.

For a comprehensive review of Jira automation options—including automation rules, scripts, and CLI—see "Simplifying Jira Tasks: Review of Automation Apps and Tools."

Experience the Ease & Confidence of NetSuite Customizations with Salto

Automate the way you migrate Jira configurations from sandbox to production

STAY UP TO DATE

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Getting Started

To start using the Jira Command Line Interface (CLI) as an administrator, install the app from the Atlassian marketplace. Like many other applications, it’s free for up to ten users.

Note that you can use CLI to automate other Atlassian products as well. See the Confluence Command Line Interface (CLI), Bitbucket Command Line Interface (CLI), and Bamboo Command Line Interface (CLI) (available for the Data Center version only).

Refer to the Installation Guide for complete installation and configuration instructions.

Please note that you need to install a client on your local machine, and it’s recommended to share the Jira user accounts with this client installation so they will be able to use the CLI as well.

For a step-by-step guide on getting started, including numerous examples, see the User Guide.

Use Cases

Copying Attachments Between Issues

Imagine you have two Jira issues, PROJ-1 and PROJ-2, and you want to copy all ten attachments from PROJ-1 to PROJ-2. This task is cumbersome to perform manually through the Jira UI, but with CLI, you can accomplish it quickly using a single command:

-a copyAttachments –issue <source issue key> –toIssue <target issue key>

The command prompt assists in building your action quickly, providing all the options and a short description as you type and specifying in which Atlassian project the action can be used.

Actions option while writing the prompt

Choosing the action and seeing a short description

Relevant Jira issues to choose from

The complete prompt and the result:

Copying all attachments from issue PROJ-1 to issue PROJ-2

Adding Attachments to All Issues

There are times when you need to run an action on multiple issues, a task typically performed by Jira administrators.

You can do this by performing a Bulk Change operation. It gives you the ability to edit issues, move issues, transition issues, delete issues, watch, and stop watching issues. While Bulk Change operations provide the ability to edit, move, transition, and delete issues, as well as manage watch status on issues, they may not cover all needs.

Multiple changes to Jira issues by Bulk Operation

For instance, if you need to add an attachment, such as a Word file with instructions, to all issues in a specific project, Bulk Operations can't help. Manually adding the file to each issue is not feasible at scale.

With CLI, you can perform this task in a single line of action using the runFromIssueList action.

Let’s see the complete prompt and the results:

Adding instructions.doc to all issues in the PROJ Jira project

Jira Data Center App Extension

If you are using the Jira Data Center platform, it is recommended also to install the "Run CLI Actions" app. This app adds an Administrator UI and provides a simple way to run CLI actions from within Jira, adding the option to create conditions and workflow post functions that include CLI actions.

Adding validator to workflow transition with CLI action

Run CLI actions within Jira UI

STAY UP TO DATE

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Tips

It's crucial to use a test server or sandbox to test changes before implementing them in a live environment. For more information on sandboxes and how to use them for testing, see "Navigating the Atlassian Cloud Sandbox."

When making changes to Jira configuration using CLI, such as DeleteFilter, it's critical to use tools that help you merge those changes and create DevOps processes.

For example, Salto is a configuration tool that allows you to merge all your configuration changes on a test environment in one go. Salto helps you check dependencies, provides the option to roll back changes, and tracks all the modifications that you've made. By using Salto, you can easily manage your configuration changes, ensuring they are safe and efficient.

Summary

The Command Line Interface is a powerful tool for automating tasks in Jira. In certain situations, it provides a quick and efficient solution that cannot be achieved through other means. The best part about using CLI is that it doesn't require development skills, making it accessible to everyone.

With over 1000 available actions, CLI offers practically limitless potential for automating tasks in Jira. Explore CLI examples to discover all available actions.

If you're looking for CLI video training, check out this excellent CLI Master Class, which includes step-by-step training across nine sessions.

WRITTEN BY OUR EXPERT

Gal Fatal

Atlassian expert & Community leader

Gal Fatal has over ten years of experience in DevOps, ALM solutions, and Agile development using Atlassian solutions. Gal is a recognized expert in Atlassian tools, holding five different Atlassian certifications. He is leading the Atlassian community in Israel, where he has made significant contributions to the development and growth of the community in Israel over the past five years.

Sort by Topics, Resources
Clear
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Salto for

Jira

Jira

SHARE

Simplifying Jira Tasks with CLI: Practical Use Cases and Tips

Gal Fatal

October 31, 2023

10

min read

Introduction

A Command Line Interface (CLI) provides a method for interacting with a computer program or operating system through text-based commands entered into a terminal or command prompt window.

In a CLI, users input commands using a specific syntax, and the program provides text-based feedback in response. This method can be an efficient way for users comfortable with text-based interfaces to perform tasks, especially for system administrators, developers, and advanced users.

Popular CLI interfaces include the Windows Command Prompt, PowerShell, and the Linux/Unix terminal. Many software development tools, databases, and networking devices also offer their own command-line interfaces for advanced configuration and automation.

Atlassian does not provide an out-of-the-box CLI. However, there is an app available in the Atlassian marketplace that supports CLI for Jira, as well as other Atlassian tools like Confluence and Bitbucket.

The most popular app in the Atlassian marketplace for a command-line interface is the Jira Command Line Interface (CLI) by Appfire. This app provides a user-friendly CLI with about 1000 actions you can perform, supporting both Data Center and Cloud versions of Jira, Confluence, Bitbucket, and Bamboo.

The app enables Jira admins and users to interact with Jira via a command-line interface, allowing for tasks such as creating and updating issues, performing searches, generating reports, and managing workflows, attachments, comments, and more—all from the command line.

It is particularly beneficial for automating repetitive tasks, integrating with other tools, and for users who prefer working in a command-line environment.

Command Line Interface (CLI) is a way to interact with a computer program or operating system through text-based commands entered into a terminal or command prompt window.

CLI vs Other Automation Options

One way to automate tasks in Jira is through the Command Line Interface (CLI). However, other methods are available, such as Automation Rules and Scripts.

Jira Automation Rules

Jira automation is a powerful tool streamlining your workflow by automating everyday tasks. With Jira automation, you can set up custom rules and triggers to perform actions such as assigning issues, updating fields, and sending notifications. This feature is included with both Jira Cloud and Data Center at no additional cost.

Using Jira automation saves time, reduces errors, and improves team efficiency. By automating routine tasks, your team can focus on more complex work. For strategies on building, testing, and maintaining Jira Automation Rules, see "10 Strategies for Building, Testing, and Maintaining Jira Automation Rules."

Why Consider Using CLI Instead or in Parallel with Jira Automation Rules?

  • Jira automation rules have limitations, such as a limited number of monthly runs in the cloud.
  • Specific tasks can’t be accomplished using Jira automation rules but can be accomplished using CLI.
  • For one-time automations, there may be more efficient options than building a Jira automation rule.
  • CLI can be a faster and more accessible alternative to building a Jira automation rule.

Automations by Apps (Using Scripts)

When creating complex automations, Jira automation rules may not suffice. In these cases, apps that support scripting, such as ScriptRunner for Jira, can be considered.

ScriptRunner for Jira is a comprehensive tool that allows users to tailor Jira to their specific needs, automate workflows, and perform complex operations that might not be achievable through Jira's native features alone. It is widely used by Jira administrators, developers, and power users to enhance the capabilities of their Jira instances.

Why Consider Using CLI Instead or in Parallel with Using Scripts?

  • Scripts can be complex and require development skills, while CLI is more straightforward to understand and operate.
  • Writing scripts can be time-consuming, while CLI commands are quick and concise, making them more efficient.

For a comprehensive review of Jira automation options—including automation rules, scripts, and CLI—see "Simplifying Jira Tasks: Review of Automation Apps and Tools."

What if Zendesk was 4x less work?

Request a Demo Get started with Salto

Getting Started

To start using the Jira Command Line Interface (CLI) as an administrator, install the app from the Atlassian marketplace. Like many other applications, it’s free for up to ten users.

Note that you can use CLI to automate other Atlassian products as well. See the Confluence Command Line Interface (CLI), Bitbucket Command Line Interface (CLI), and Bamboo Command Line Interface (CLI) (available for the Data Center version only).

Refer to the Installation Guide for complete installation and configuration instructions.

Please note that you need to install a client on your local machine, and it’s recommended to share the Jira user accounts with this client installation so they will be able to use the CLI as well.

For a step-by-step guide on getting started, including numerous examples, see the User Guide.

Use Cases

Copying Attachments Between Issues

Imagine you have two Jira issues, PROJ-1 and PROJ-2, and you want to copy all ten attachments from PROJ-1 to PROJ-2. This task is cumbersome to perform manually through the Jira UI, but with CLI, you can accomplish it quickly using a single command:

-a copyAttachments –issue <source issue key> –toIssue <target issue key>

The command prompt assists in building your action quickly, providing all the options and a short description as you type and specifying in which Atlassian project the action can be used.

Actions option while writing the prompt

Choosing the action and seeing a short description

Relevant Jira issues to choose from

The complete prompt and the result:

Copying all attachments from issue PROJ-1 to issue PROJ-2

Adding Attachments to All Issues

There are times when you need to run an action on multiple issues, a task typically performed by Jira administrators.

You can do this by performing a Bulk Change operation. It gives you the ability to edit issues, move issues, transition issues, delete issues, watch, and stop watching issues. While Bulk Change operations provide the ability to edit, move, transition, and delete issues, as well as manage watch status on issues, they may not cover all needs.

Multiple changes to Jira issues by Bulk Operation

For instance, if you need to add an attachment, such as a Word file with instructions, to all issues in a specific project, Bulk Operations can't help. Manually adding the file to each issue is not feasible at scale.

With CLI, you can perform this task in a single line of action using the runFromIssueList action.

Let’s see the complete prompt and the results:

Adding instructions.doc to all issues in the PROJ Jira project

Jira Data Center App Extension

If you are using the Jira Data Center platform, it is recommended also to install the "Run CLI Actions" app. This app adds an Administrator UI and provides a simple way to run CLI actions from within Jira, adding the option to create conditions and workflow post functions that include CLI actions.

Adding validator to workflow transition with CLI action

Run CLI actions within Jira UI

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Tips

It's crucial to use a test server or sandbox to test changes before implementing them in a live environment. For more information on sandboxes and how to use them for testing, see "Navigating the Atlassian Cloud Sandbox."

When making changes to Jira configuration using CLI, such as DeleteFilter, it's critical to use tools that help you merge those changes and create DevOps processes.

For example, Salto is a configuration tool that allows you to merge all your configuration changes on a test environment in one go. Salto helps you check dependencies, provides the option to roll back changes, and tracks all the modifications that you've made. By using Salto, you can easily manage your configuration changes, ensuring they are safe and efficient.

Summary

The Command Line Interface is a powerful tool for automating tasks in Jira. In certain situations, it provides a quick and efficient solution that cannot be achieved through other means. The best part about using CLI is that it doesn't require development skills, making it accessible to everyone.

With over 1000 available actions, CLI offers practically limitless potential for automating tasks in Jira. Explore CLI examples to discover all available actions.

If you're looking for CLI video training, check out this excellent CLI Master Class, which includes step-by-step training across nine sessions.

WRITTEN BY OUR EXPERT

Gal Fatal

Atlassian expert & Community leader

Gal Fatal has over ten years of experience in DevOps, ALM solutions, and Agile development using Atlassian solutions. Gal is a recognized expert in Atlassian tools, holding five different Atlassian certifications. He is leading the Atlassian community in Israel, where he has made significant contributions to the development and growth of the community in Israel over the past five years.