How to automate export and load of complete projects


You'll need version 2.1.3 or higher of Project Configurator.



This section explains how to drive Project Configurator from the command line, so that you can create scripts that export or load complete projects. The method is based on interacting with the JIRA server by issuing http requests to concrete URLs. You need a tool that lets you issue http requests from the command line, as wget or curl. If you are not familiar with wget or curl, it is recommended you have a look first at the manual for these products.

Some examples are provided. Remember that the export and load operations require a user with system administrator permission.

These examples have been tested on Ubuntu Linux 16.04 and they use curl and xmllintBoth programs must be installed on the system where you are going to run the scripts, you can install them with the following commands:

    apt get update

    apt get install curl

    apt get install libxml2-utils

In order to execute the scripts provided, copy them to a folder included in your machine's path for executable files and make them executable.


Auxiliary scripts

The export and import scripts will need the following scripts to work:

wait-task-script
# Usage: $ wait-task-script response-html-file jira-host-url jira-context-path cookies-auth-file

HOST=$2
CONTEXT=$3
BASE_URL="$2/$3"
COOKIES=$4

RESULT_URL=`xmllint --html --xpath '//p[@id="finalURLholder"]/text()' $1 2>> error.txt`
echo "Destination URL $HOST$RESULT_URL"
while [ $RESULT_URL ]
do
 sleep 0.5
 if status-checker-script $1 "-L -b $COOKIES -o $1 $HOST$RESULT_URL"; then
  RESULT_URL=`xmllint --html --xpath '//p[@id="finalURLholder"]/text()' $1 2>> error.txt`
  echo "Destination URL $HOST$RESULT_URL"
 else
  break
 fi
done
echo "Task has finished"

status-checker-script
# Usage: $ status-checker-script response-html-file curl-command

RESPONSE=$1
CURL_CMD=$2
RED='\e[1;31m'
COLOR_END='\e[0m'

CODE=$(curl $CURL_CMD -w "%{http_code}") 

if [ "$CODE" == "200" ] ; then
 exit 0
else
 echo -e ${RED}
 echo "  Something went wrong, http status: $CODE"
 case $CODE in
  "400") echo "  Error in load, please check $RESPONSE";;
  "401") echo "  The user is not logged in or it's not an administrator";;
  "403") echo "  The plugin does not have a valid license";;
  "500") echo "  Error in export, please check $RESPONSE";; 
  *)     echo "  Please check $RESPONSE";; 
 esac
 echo -e ${COLOR_END}
 exit 40
fi


Export script

This is an executable script that exports complete projects. 

export-project-script
# Usage export-project-script jira-host-url jira-context-path admin-user admin-password export-file-name project-key [project-key2 ...] [-O export-options ...]

RESPONSE_HTML="response.html"
COOKIES_FILE="cookies.txt"

USER=$3
PASSWD=$4

HOST=$1
CONTEXT=$2
BASE_URL="$1/$2"
EXPORT_FILE_NAME=$5

PROJECT_PARAMETERS="-F selectedProjectKeys=$6"
MODE=PROJECTS
OPTION_STRING=""

shift 6
while (( "$#" ))
do
    if [ "$MODE" = PROJECTS ]
    then
        if [ "$1" != "-O" ]
        then
            PROJECT_PARAMETERS="$PROJECT_PARAMETERS -F selectedProjectKeys=$1"
        else
            MODE=OPTIONS            
        fi
    else
        OPTION_STRING="$OPTION_STRING -F $1"
    fi
    shift
done

echo "projects param: $PROJECT_PARAMETERS"
echo "options: $OPTION_STRING"

curl  -u "$USER:$PASSWD" --cookie-jar $COOKIES_FILE "$BASE_URL/secure/Dashboard.jspa?os_authType=basic" --head

if status-checker-script $RESPONSE_HTML "-b $COOKIES_FILE -o $RESPONSE_HTML "$BASE_URL/secure/project-export!export.jspa" $PROJECT_PARAMETERS -F "exportScope=FULL_PROJECT" -F "fileName=$EXPORT_FILE_NAME" $OPTION_STRING"; then
    wait-task-script $RESPONSE_HTML $HOST $CONTEXT $COOKIES_FILE
else
    echo "Task has stopped"
fi

Command and options

It is launched with the following command:

export-project-script jira-host-url jira-context-path admin-user admin-password export-file-name project-key [project-key2 ...] [-O export-options ...]
  • jira-host-url: Host part of the exporting instance base URL, including port if needed (for example http://my-server:2990).
  • jira-context-path: Context part of the exporting instance base URL (for example "jira").  Note that jira-host-url + "/" + jira-context-path equals "JIRA base URL" (for example, http://my-server:2990/jira)
  • admin-user: Admin's username.
  • admin-password: Admin's password.
  • export-file-name: Name of the exported file, remember it will be left in "projectconfigurator" folder under directory $JIRA_HOME/export (for example 'exported-projects-10-04-2017-zip').
  • project-key [project-key2 ...]: Keys of the projects to export, at least one must be provided.
  • export-options: Additional export options, see this link for details. Each export option must be specified as key=value, preferrably enclosed in double quotes.


Import script

This is an executable script that imports complete projects. 

import-project-script
# Usage import-project-script jira-host-url jira-context-path admin-user admin-password import-file-name [-O import-options ...]

RESPONSE_HTML="response.html"
COOKIES_FILE="cookies.txt"

USER=$3
PASSWD=$4

HOST=$1
CONTEXT=$2
BASE_URL="$1/$2"
IMPORT_FILE_NAME=$5

OPTION_STRING=""

shift 5

if [ "$1" == "-O" ]
then
    shift
    while (( "$#" ))
    do
        OPTION_STRING="$OPTION_STRING -F $1"
        shift
    done
fi

echo "options: $OPTION_STRING"

curl  -u "$USER:$PASSWD" --cookie-jar $COOKIES_FILE "$BASE_URL/secure/Dashboard.jspa?os_authType=basic" --head

if status-checker-script $RESPONSE_HTML "-b $COOKIES_FILE -o $RESPONSE_HTML "$BASE_URL/secure/full-project-upload!stepZero.jspa" -F "projectFile=$IMPORT_FILE_NAME" $OPTION_STRING" ; then
    # as this script follows redirects, it can go through the three import steps
    wait-task-script $RESPONSE_HTML $HOST $CONTEXT $COOKIES_FILE
else
    echo "Task has stopped"
fi

Command and options

It is launched with the following command:

import-project-script jira-host-url jira-context-path admin-user admin-password import-file-name [-O import-options ...]


  • jira-host-url: Host part of the importing instance base URL, including port if needed.

  • jira-context-path: Context part of the importing instance base URL.
  • admin-user: Admin's username.
  • admin-password: Admin's password.
  • import-file-name: name of the file to be imported, remember it must be placed before importing in "projectconfigurator" folder under directory $JIRA_HOME/import.
  • import-options: additional import options, see this link for details. Each import option must be specified as key=value, preferrably enclosed in double quotes.

Temporary files and error handling

Take into account that...

  • These scripts create two temporary files in the same directory where they have been invoked. These files are "cookies.txt" (it holds the authentication cookie for the session in JIRA) and "response.html" (it keeps the last HTML response received from JIRA).
  • Scripts include a basic level of error handling. If any of the interactions with the server returns an error HTML status, the script will stop and display the error status with its intended meaning. The last HTML response (that came with the error HTML status) will be left in the "response.html" file. For example, if you try to run the export script in a version previous to 2.1.3, the response.html will show the trace of a NullPointerException.


Examples

Export example

export-project-script 10.0.2.2:2990 jira admin admin scriptfile.zip LOREM IPSUM

We're exporting the projects LOREM and IPSUM from the JIRA server located in 10.0.2.2:2990 into a file called scriptfile.zip, using the account admin:admin.

Results
export-project-script 10.0.2.2:2990 jira admin admin automatescriptfile.zip LOREM IPSUM
projects param: -F selectedProjectKeys=LOREM -F selectedProjectKeys=IPSUM
options: 
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-AREQUESTID: 859x230x3
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
X-ASEN: SEN-500
Set-Cookie: JSESSIONID=3FE380E75727D8BA0397C9B42980C69E; Path=/jira/; HttpOnly
X-Seraph-LoginReason: OK
Set-Cookie: atlassian.xsrf.token=BWP3-NZB2-6EDY-6C7K|a547613084ffb9a2cfa76dca5c55779f17412814|lin; Path=/jira
X-ASESSIONID: 1qdqhfg
X-AUSERNAME: admin
X-Content-Type-Options: nosniff
X-Accel-Buffering: no
Content-Type: text/html;charset=UTF-8
Transfer-Encoding: chunked
Date: Tue, 11 Apr 2017 12:19:57 GMT

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 50600    0 50097  100   503  11699    117  0:00:04  0:00:04 --:--:-- 11702
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49844    0 49844    0     0  18396      0 --:--:--  0:00:02 --:--:-- 18392
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49843    0 49843    0     0  82013      0 --:--:-- --:--:-- --:--:-- 82113
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49843    0 49843    0     0   127k      0 --:--:-- --:--:-- --:--:--  127k
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49843    0 49843    0     0   116k      0 --:--:-- --:--:-- --:--:--  116k
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49843    0 49843    0     0  87391      0 --:--:-- --:--:-- --:--:-- 87443
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49843    0 49843    0     0  78113      0 --:--:-- --:--:-- --:--:-- 78246
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49844    0 49844    0     0   102k      0 --:--:-- --:--:-- --:--:--  102k
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49879    0 49879    0     0  54246      0 --:--:-- --:--:-- --:--:-- 54216
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49879    0 49879    0     0   145k      0 --:--:-- --:--:-- --:--:--  145k
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49866    0 49866    0     0  72476      0 --:--:-- --:--:-- --:--:-- 72479
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49866    0 49866    0     0  61805      0 --:--:-- --:--:-- --:--:-- 61791
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49866    0 49866    0     0   224k      0 --:--:-- --:--:-- --:--:--  225k
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49856    0 49856    0     0  82899      0 --:--:-- --:--:-- --:--:-- 82817
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49856    0 49856    0     0   173k      0 --:--:-- --:--:-- --:--:--  173k
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49856    0 49856    0     0   306k      0 --:--:-- --:--:-- --:--:--  308k
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49857    0 49857    0     0  37096      0 --:--:--  0:00:01 --:--:-- 37123
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49856    0 49856    0     0  69682      0 --:--:-- --:--:-- --:--:-- 69728
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49857    0 49857    0     0  56433      0 --:--:-- --:--:-- --:--:-- 56399
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49856    0 49856    0     0   161k      0 --:--:-- --:--:-- --:--:--  161k
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49856    0 49856    0     0   583k      0 --:--:-- --:--:-- --:--:--  586k
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49856    0 49856    0     0   141k      0 --:--:-- --:--:-- --:--:--  141k
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49856    0 49856    0     0   221k      0 --:--:-- --:--:-- --:--:--  222k
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49856    0 49856    0     0   242k      0 --:--:-- --:--:-- --:--:--  242k
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49856    0 49856    0     0  56313      0 --:--:-- --:--:-- --:--:-- 56270
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49856    0 49856    0     0  95634      0 --:--:-- --:--:-- --:--:-- 95692
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49856    0 49856    0     0   302k      0 --:--:-- --:--:-- --:--:--  304k
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10100
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49427    0 49427    0     0  45959      0 --:--:--  0:00:01 --:--:-- 45978
Destination URL 10.0.2.2:2990
Task has finished


Import example

import-project-script 10.0.2.2:2990 jira admin admin scriptfile.zip

We're importing the projects LOREM and IPSUM from a file called scriptfile.zip into the server located in 10.0.2.2:2990, using the account admin:admin.

Results
import-project-script 10.0.2.2:2990 jira admin admin automatescriptfile.zip
options: 
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-AREQUESTID: 863x537x1
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
X-ASEN: SEN-500
Set-Cookie: JSESSIONID=7167238DC067766192AA8E89EC37D97F; Path=/jira/; HttpOnly
X-Seraph-LoginReason: OK
Set-Cookie: atlassian.xsrf.token=BWP3-NZB2-6EDY-6C7K|842e3643cd6b103f4c5bc9a41158a1349cbf14b9|lin; Path=/jira
X-ASESSIONID: 4annn0
X-AUSERNAME: admin
X-Content-Type-Options: nosniff
X-Accel-Buffering: no
Content-Type: text/html;charset=UTF-8
Transfer-Encoding: chunked
Date: Tue, 11 Apr 2017 12:23:50 GMT

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49139    0 48971  100   168  15973     54  0:00:03  0:00:03 --:--:-- 15977
Destination URL 10.0.2.2:2990/jira/secure/preprocessor-step-result.jspa?taskId=10104
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48697    0 48697    0     0   7845      0 --:--:--  0:00:06 --:--:-- 12165
Destination URL 10.0.2.2:2990/jira/secure/preprocessor-step-result.jspa?taskId=10104
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48716    0 48716    0     0  79320      0 --:--:-- --:--:-- --:--:-- 79213
Destination URL 10.0.2.2:2990/jira/secure/preprocessor-step-result.jspa?taskId=10104
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48716    0 48716    0     0   592k      0 --:--:-- --:--:-- --:--:--  594k
Destination URL 10.0.2.2:2990/jira/secure/preprocessor-step-result.jspa?taskId=10104
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48716    0 48716    0     0   109k      0 --:--:-- --:--:-- --:--:--  109k
Destination URL 10.0.2.2:2990/jira/secure/preprocessor-step-result.jspa?taskId=10104
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 49154    0 49154    0     0  11742      0 --:--:--  0:00:04 --:--:-- 16467
Destination URL 10.0.2.2:2990/jira/secure/RealConfigStepResult.jspa?taskId=10105
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49173    0 49173    0     0  16970      0 --:--:--  0:00:02 --:--:-- 16967
Destination URL 10.0.2.2:2990/jira/secure/RealConfigStepResult.jspa?taskId=10105
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48667    0 48667    0     0   156k      0 --:--:-- --:--:-- --:--:--  156k
Destination URL 10.0.2.2:2990/jira/secure/RealConfigStepResult.jspa?taskId=10105
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48668    0 48668    0     0  66442      0 --:--:-- --:--:-- --:--:-- 66486
Destination URL 10.0.2.2:2990/jira/secure/RealConfigStepResult.jspa?taskId=10105
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48667    0 48667    0     0   123k      0 --:--:-- --:--:-- --:--:--  123k
Destination URL 10.0.2.2:2990/jira/secure/RealConfigStepResult.jspa?taskId=10105
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48667    0 48667    0     0   345k      0 --:--:-- --:--:-- --:--:--  346k
Destination URL 10.0.2.2:2990/jira/secure/RealConfigStepResult.jspa?taskId=10105
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48663    0 48663    0     0  72545      0 --:--:-- --:--:-- --:--:-- 72523
Destination URL 10.0.2.2:2990/jira/secure/RealConfigStepResult.jspa?taskId=10105
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48664    0 48664    0     0  74098      0 --:--:-- --:--:-- --:--:-- 74182
Destination URL 10.0.2.2:2990/jira/secure/RealConfigStepResult.jspa?taskId=10105
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48664    0 48664    0     0   167k      0 --:--:-- --:--:-- --:--:--  168k
Destination URL 10.0.2.2:2990/jira/secure/RealConfigStepResult.jspa?taskId=10105
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48664    0 48664    0     0   212k      0 --:--:-- --:--:-- --:--:--  213k
Destination URL 10.0.2.2:2990/jira/secure/RealConfigStepResult.jspa?taskId=10105
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48671    0 48671    0     0  32900      0 --:--:--  0:00:01 --:--:-- 32885
Destination URL 10.0.2.2:2990/jira/secure/RealConfigStepResult.jspa?taskId=10105
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 48736    0 48736    0     0  10953      0 --:--:--  0:00:04 --:--:-- 11472
Destination URL 10.0.2.2:2990/jira/secure/DataImportStepResult.jspa?taskId=10106
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48735    0 48735    0     0  14553      0 --:--:--  0:00:03 --:--:-- 14552
Destination URL 10.0.2.2:2990/jira/secure/DataImportStepResult.jspa?taskId=10106
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48734    0 48734    0     0  33427      0 --:--:--  0:00:01 --:--:-- 33425
Destination URL 10.0.2.2:2990/jira/secure/DataImportStepResult.jspa?taskId=10106
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48733    0 48733    0     0   8512      0 --:--:--  0:00:05 --:--:-- 13832
Destination URL 10.0.2.2:2990/jira/secure/DataImportStepResult.jspa?taskId=10106
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48732    0 48732    0     0  47855      0 --:--:--  0:00:01 --:--:-- 47870
Destination URL 10.0.2.2:2990/jira/secure/DataImportStepResult.jspa?taskId=10106
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48731    0 48731    0     0  36090      0 --:--:--  0:00:01 --:--:-- 36097
Destination URL 10.0.2.2:2990/jira/secure/DataImportStepResult.jspa?taskId=10106
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48731    0 48731    0     0  78667      0 --:--:-- --:--:-- --:--:-- 78725
Destination URL 10.0.2.2:2990/jira/secure/DataImportStepResult.jspa?taskId=10106
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48733    0 48733    0     0  46363      0 --:--:--  0:00:01 --:--:-- 46412
Destination URL 10.0.2.2:2990/jira/secure/DataImportStepResult.jspa?taskId=10106
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48732    0 48732    0     0  50485      0 --:--:-- --:--:-- --:--:-- 50499
Destination URL 10.0.2.2:2990/jira/secure/DataImportStepResult.jspa?taskId=10106
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48732    0 48732    0     0  47041      0 --:--:--  0:00:01 --:--:-- 47084
Destination URL 10.0.2.2:2990/jira/secure/DataImportStepResult.jspa?taskId=10106
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48729    0 48729    0     0  64234      0 --:--:-- --:--:-- --:--:-- 64286
Destination URL 10.0.2.2:2990/jira/secure/DataImportStepResult.jspa?taskId=10106
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48743    0 48743    0     0  58835      0 --:--:-- --:--:-- --:--:-- 58797
Destination URL 10.0.2.2:2990/jira/secure/DataImportStepResult.jspa?taskId=10106
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48734    0 48734    0     0   229k      0 --:--:-- --:--:-- --:--:--  229k
Destination URL 10.0.2.2:2990/jira/secure/DataImportStepResult.jspa?taskId=10106
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48736    0 48736    0     0   9250      0 --:--:--  0:00:05 --:--:-- 11986
Destination URL 10.0.2.2:2990/jira/secure/DataImportStepResult.jspa?taskId=10106
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48731    0 48731    0     0  69950      0 --:--:-- --:--:-- --:--:-- 70015
Destination URL 10.0.2.2:2990/jira/secure/DataImportStepResult.jspa?taskId=10106
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48731    0 48731    0     0  80039      0 --:--:-- --:--:-- --:--:-- 80018
Destination URL 10.0.2.2:2990/jira/secure/DataImportStepResult.jspa?taskId=10106
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48733    0 48733    0     0  32022      0 --:--:--  0:00:01 --:--:-- 32019
Destination URL 10.0.2.2:2990/jira/secure/DataImportStepResult.jspa?taskId=10106
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48732    0 48732    0     0  39439      0 --:--:--  0:00:01 --:--:-- 39459
Destination URL 10.0.2.2:2990/jira/secure/DataImportStepResult.jspa?taskId=10106
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48733    0 48733    0     0  45665      0 --:--:--  0:00:01 --:--:-- 45672
Destination URL 10.0.2.2:2990/jira/secure/DataImportStepResult.jspa?taskId=10106
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48729    0 48729    0     0  37192      0 --:--:--  0:00:01 --:--:-- 37169
Destination URL 10.0.2.2:2990/jira/secure/DataImportStepResult.jspa?taskId=10106
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48983    0 48983    0     0  49285      0 --:--:-- --:--:-- --:--:-- 49278
Destination URL 10.0.2.2:2990/jira/secure/DataImportStepResult.jspa?taskId=10106
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48996    0 48996    0     0  45996      0 --:--:--  0:00:01 --:--:-- 46005
Destination URL 10.0.2.2:2990/jira/secure/DataImportStepResult.jspa?taskId=10106
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48743    0 48743    0     0  99629      0 --:--:-- --:--:-- --:--:-- 99475
Destination URL 10.0.2.2:2990/jira/secure/DataImportStepResult.jspa?taskId=10106
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 48745    0 48745    0     0  37123      0 --:--:--  0:00:01 --:--:-- 37124
Destination URL 10.0.2.2:2990/jira/secure/DataImportStepResult.jspa?taskId=10106
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 54111    0 54111    0     0  22398      0 --:--:--  0:00:02 --:--:-- 22396
Destination URL 10.0.2.2:2990
Task has finished

Error handling

Let's see a couple examples of error traces, and how to fix those errors.

Error example when exporting
export-project-script 10.0.2.2:2990 jira admin admin scriptfile.zip SCRUM -O "agileBoardsExportMode=all"
projects param: -F selectedProjectKeys=SCRUM
options:  -F agileBoardsExportMode=all
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-AREQUESTID: 844x6048x1
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie: JSESSIONID=A62379852B3DEFC5466B5DC53264E467; Path=/jira/; HttpOnly
X-Seraph-LoginReason: OK
Set-Cookie: atlassian.xsrf.token=B74A-S9EF-8DS8-KK7L|d6c953f80429e43ab3ff75583a59401d0ae64c5b|lin; Path=/jira
X-ASESSIONID: 1e9uxb0
X-AUSERNAME: admin
X-Content-Type-Options: nosniff
X-Accel-Buffering: no
Content-Type: text/html;charset=UTF-8
Transfer-Encoding: chunked
Date: Tue, 11 Apr 2017 12:04:43 GMT

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 93679    0 93184  100   495  1033k   5619 --:--:-- --:--:-- --:--:-- 1045k
Destination URL 10.0.2.2:2990/jira/secure/project-export-result.jspa?taskId=10307
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 94225    0 94225    0     0  1670k      0 --:--:-- --:--:-- --:--:-- 1704k

  Something went wrong, http status: 500
  Error in export, please check response.html

Task has finished

As we can see, the trace ended with an http status: 500, and it says that we should check response.html.

Inside response.html, we can find:

java.lang.NoSuchFieldError: NONE

    at com.awnaba.projectconfigurator.projectconfigserialize.JSBoardsGlobalTable.dumpCardColors(JSBoardsGlobalTable.java:147)

    at com.awnaba.projectconfigurator.projectconfigserialize.JSBoardsGlobalTable.insert(JSBoardsGlobalTable.java:113)

    at com.awnaba.projectconfigurator.projectconfigserialize.JSBoardsGlobalTable.insert(JSBoardsGlobalTable.java:55)

    at com.awnaba.projectconfigurator.projectconfigserialize.AbstractGlobalTable$1.doAndReturn(AbstractGlobalTable.java:27)

    at com.awnaba.projectconfigurator.utils.SmartErrorReporter.wrapSafely(SmartErrorReporter.java:84)

    at com.awnaba.projectconfigurator.projectconfigserialize.AbstractGlobalTable.findOrInsertObject(AbstractGlobalTable.java:23)

    at com.awnaba.projectconfigurator.projectconfigserialize.ExportManager.dumpAgileBoards(ExportManager.java:305)

    at com.awnaba.projectconfigurator.projectconfigserialize.ExportManager.createJAXBTree(ExportManager.java:139)

    at com.awnaba.projectconfigurator.projectconfigserialize.ExportManager.dumpConfigurations(ExportManager.java:98)

    at com.awnaba.projectconfigurator.operationsapi.impl.ProjectConfigExporterImpl.doExport(ProjectConfigExporterImpl.java:96)

    at com.awnaba.projectconfigurator.operationsapi.impl.ProjectConfigExporterImpl.callExport(ProjectConfigExporterImpl.java:78)

    at com.awnaba.projectconfigurator.operationsapi.impl.ProjectConfigExporterImpl.exportSynchronous(ProjectConfigExporterImpl.java:136)

    at com.awnaba.projectconfigurator.transporter.engine.FullExportManager.exportConfig(FullExportManager.java:191)

    at com.awnaba.projectconfigurator.transporter.engine.FullExportManager.call(FullExportManager.java:67)

    at com.awnaba.projectconfigurator.transporter.engine.FullExportManager.call(FullExportManager.java:34)

    at com.atlassian.jira.task.TaskManagerImpl$TaskCallableDecorator.call(TaskManagerImpl.java:528)

    at com.atlassian.jira.task.TaskManagerImpl$TaskCallableDecorator.call(TaskManagerImpl.java:491)

    at java.util.concurrent.FutureTask.run(FutureTask.java:266)

    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

    at java.util.concurrent.FutureTask.run(FutureTask.java:266)

    at com.atlassian.jira.task.ForkedThreadExecutor$ForkedRunnableDecorator.run(ForkedThreadExecutor.java:254)

    at java.lang.Thread.run(Thread.java:745)

As we can see, something in Project Configurator failed. After searching in PCP's wiki or contacting support, we find that this error happens because we tried to export a project with agile boards from a JIRA instance with JIRA Agile v6.7.6, and Project Configurator is only compatible with JIRA Agile v6.7.7 or higher.


import-project-script 10.0.2.2:2990 jira admin admin wrongfile
options: 
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-AREQUESTID: 849x6051x1
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie: JSESSIONID=0761B3D4DDF6416BE52C4E310D5DD671; Path=/jira/; HttpOnly
X-Seraph-LoginReason: OK
Set-Cookie: atlassian.xsrf.token=B74A-S9EF-8DS8-KK7L|e15eb9d34e71b17d894875a1999d50eaca79c6a7|lin; Path=/jira
X-ASESSIONID: oyjtjj
X-AUSERNAME: admin
X-Content-Type-Options: nosniff
X-Accel-Buffering: no
Content-Type: text/html;charset=UTF-8
Transfer-Encoding: chunked
Date: Tue, 11 Apr 2017 12:09:58 GMT

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 98971    0 98816  100   155   487k    782 --:--:-- --:--:-- --:--:--  489k

  Something went wrong, http status: 400
  Error in load, please check response.html

Task has stopped

This trace ended with an http status: 400, again, we check response.html to see what happened.

In response.html, we find:

An error occurred:

File C:\Atlassian_tutorial\myPlugin\target\jira\home\import\projectconfigurator\wrongfile does not exist or JIRA does not have permissions to open and read it.

Which means the filename was wrong, it doesn't exist or it may be missing its extension.