How to work with different environments using Atlassian Command Line Interface (CLI)
This article explains how you can update the acli.properties file to work with different environments using Atlassian Command Line Interface (CLI).
To work with multiple environments using CLI, the acli.properties file must be updated with the details of the environment(s). A new feature with CLI version 9.0 provides the required configuration in the form of a standard property file. This is an alternative for defining unique start scripts or customizing the Atlassian start script with credentials and URLs. This CLI distribution folder contains properties files for both Cloud and Server.
Instructions
Navigate to the CLI installation directory.
To work with multiple Cloud sites and/or Server sites, you must update the acli.properties file where different environments like Prod,Stage, or, QA are targeted, as follows:
Example: acli.properties
# Example Cloud configuration - customize and rename this file to acli.properties # Cloud requires an email address and a corresponding API token from Atlassian. # Use an existing token or create one at https://id.atlassian.com/manage/api-tokens (requires an Atlassian account login). cloudcredentials = --user automation@example.com --token xxxxxxxxxxxxxxxxxxxxxxxx myjira = jiracloud -s https://issues.example.com ${cloudcredentials} myconfluence = confluencecloud -s https://mydocs.example.com ${cloudcredentials} # Example Server configuration: prodservercredentials = --user admin --password admin jiraserver = jira -s https://prodjira.examplegear.com ${prodservercredentials} confluenceserver = confluence -s https://prodconfluence.examplegear.com ${prodservercredentials} qacredentials = --user qauser --password qapass qajira = jira -s https://qajira.example.com ${qacredentials} qaconfluence = confluence -s https://qaconfluence.example.com ${qacredentials} # This defines the default client for actions, choose the most likely used client default = ${myjira}Save the file and run the following commands as per your requirement:
acli qajira --action getServerInfo acli myconfluence --action addPage --space "demo" --title "This is title" --parent "@home" acli myjira --action cloneIssue --issue "JIRACLI-4" --summary "clone summary" --comment "comment for cloned issue"
You can also use -a instead of --action for all CLI actions. For example:
acli -a getServerInfo