JIRA command line client - adding users to a group

megha jayaswal July 10, 2014

I have Jira Command Line client installed on my Ubuntu linux system. I am running a script which reads users from a file and then add each user to a particular grp. my script goes like this:

#!/bin/bash

while read -r user

do

echo $user

./jira.sh --action addUserToGroup --userId "$user" --group "group1"

done < users.txt

where I have a text file "users.txt" containing about 2872 users. The scipt is running fine, except for the fact it is taking a lot of time. It is taking almost 1.5 minute to add a single user o the group. so, if we talk about 2872 users it will need about 30 hrs. so, wanted to ask that is there a poblem with my scrip that it is taking to long or is it ok for the script to take this much of a time.

4 answers

2 votes
Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 10, 2014

From an efficiency and ease of use perspective, I would recommend using runFromCsv . For that you will need to add a userId column header as the first row of the file and then something like the following will work directly:

jira --action runFromCsv --common "--action addUserToGroup --group \"group1\" "

Of course it could still be slow if JIRA is taking a lot of time to add the user to the group. However, this is more efficient from a CLI perspective.

How to use runFromCsv has more information.

megha jayaswal July 10, 2014

Hi Bob,

Thanks for the suggestion. But there is no need for the run from CSV because my file "users.txt" contain no other parameter other than the user IDs so that the scipt reads each userid only when it goes from one line to another and nothing else.

Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 10, 2014

There are still efficiencies using the run approach especially over a slow network as it reduces the number of network transactions. However, it is still not going to help with the JIRA side slowness.

0 votes
Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 10, 2014

So, does it also take a long time to add from the UI?

0 votes
megha jayaswal July 10, 2014

Hi Bob,

1. It takes about 1.5 minutes only to run for the single user.

2. yes, the group already have a large number of users.

3. Jira version: 6.1.4

4. It is a server

5. slow network

0 votes
Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 10, 2014
  1. How long does it take running a single addUserToGroup action (outside the script) to the group?
  2. Does the group already have a large number of users? In other words, does it take longer if the group is larger?
  3. What version of JIRA?
  4. Is it server or cloud?
  5. Local server or slow network?

Suggest an answer

Log in or Sign up to answer