Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This article explains the steps to how you can update the acli.properties file to work with different environments using Atlassian using Atlassian Command Line Interface (CLI).

If you want to use CLI to work with multiple environments, the To work with multiple environments using CLI, the acli.properties file needs to must be updated with the details of the environmentthe environment(s).A  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  This CLI distribution folder contains properties files for both Cloud and Server. 

Instructions

  1. Go Navigate to the CLI installation directory.
  2. Rename the example properties file (acli-cloud or acli-server) to acli.properties appropriately as properties as per your environment.
  3. Update the acli.properties file, as shown below:

    To work with multiple Cloud sites and/

    or Server

    or Server sites,

    you need to update

    you must update the acli.properties

    file as shown in the below example where

    file where different environments like Prod,Stage,

    QA etc.

    or, QA  are targeted, as follows:

    Code Block
    languagebash
    titleExample: acli.properties
    linenumberstrue
    # 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}


    Info
    • Each instance can be given a unique name that points to the respective Atlassian instance. Use this name to execute the CLI commands against the respective instance. 
    • In the above properties file, myjira is a name pointing to your Jira Cloud instance and myconfluence is the name pointing to your Confluence Cloud instance. Similarly, the other names are pointing to their respective instances.
    • A credential specifies the username and password/token for the respective instance. Please provide your user ID in user parameter and API token data in token parameter as shown:  
      credentials       = --user automation@example.com --token xxxxxxxxxxxxxxxxxxxxxxxx


  4. Save the file and run the

    below

    following commands as per your requirement:

    Code Block
    languagebash
    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"


Info

You can also use -a instead of --action for all CLI actions. For example: 

No Format
acli -a getServerInfo
Info
  • Each instance can be given a unique name, which will point to the respective Atlassian instance. You can use this name, when you want to execute the cli commands against the respective instance. 
  • In the above properties file, myjira is a name pointing to your Jira cloud instance and myconfluence is the name pointing to your Confluence cloud instance. Similarly the other names are pointing to other respective instances.
  • The credentials will have the username and password/token for the respective instance. Please provide your userid in user parameter and API token data in token parameter as shown below:  
    credentials       = --user automation@example.com --token xxxxxxxxxxxxxxxxxxxxxxxx