...
Info |
---|
You’ll need version 3.0.0 or higher of Project Configurator. 3.7.0 Update: Security vulnerabilities fixed in accordance with our our bug bounty program. These vulnerabilities affect all prior versions of Project Configurator up to and including 3.6.2. We strongly advise that you upgrade to version 3.7.0 or 0 or later. See the 3.7.0 release notes for more information. |
This section explains how to drive Project Configurator from the command line so you can create scripts that export or import complete projects. The method is based on interacting with the Jira server by issuing http HTTP requests to concrete URLs. You need a tool that lets you issue http HTTP requests from the command line, such as wget or curl. If you are not familiar with wget or curl, it is recommended you first have a look at the manual for these products.
Some examples are provided below. Remember the , export and import operations require permission from the system administrator permissions.
These examples have been tested on Ubuntu Linux 16.04, and they use curl and xmllint. Both programs must be installed on the system where you are going to run the scripts; you can install them with the following commands:
...
Code Block |
---|
apt get update |
...
...
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.
Script versions 3.7.0 and newer
Download the following .zip file for our latest script versions for Project Configurator 3.7.0 or later:
View file |
---|
name | user-scripts-3.7.0-and-newer.zip |
---|
|
The ZIP file contains the following scripts:
...
Code Block |
---|
|
sh export.sh jira-host-url jira-context-path admin-user admin-password export-file-name export-mode project-key1 project-key2 ... -O export-options |
Import script
This is an executable script that imports complete projects.
Info |
---|
This 3.7.0 script version requires that you update the command used to invoke the import/export scripts. If you are upgrading, refer to the usage command at the top of the related scripts. It is also provided as a snippet, below. |
Code Block |
---|
sh import.sh jira-host-url jira-context-path admin-user admin-password import-file-name import-mode [-O import-options ...] |
Script versions 3.6.2 and older
Download the following .zip file for our earlier script versions for Project Configurator 3.6.2 or older:
View file |
---|
name | user-scripts-3.6.2-and-older.zip |
---|
|
The ZIP file contains the following scripts:
...
Code Block |
---|
export-project-script jira-host-url jira-context-path admin-user admin-password project-key export-mode [export-file-name] [project-key2 ...] [-O export-options ...] |
Import script
This is an executable script that imports complete projects.
...
Legacy import script versions earlier than 3.1.10
Import script
Expand |
---|
title | import-project-script (versions earlier than 3.1.10) |
---|
|
Code Block |
---|
# Usage import-project-script jira-host-url jira-context-path admin-user admin-password import-file-name import-mode [-O import-options ...]
RESPONSE_HTML="response.html"
COOKIES_FILE="cookies.txt"
IMPORT_MODE=""
USER=$3
PASSWD=$4
HOST=$1
CONTEXT=$2
BASE_URL="$1/$2"
IMPORT_FILE_NAME=$5
if [ "$6" == "-COMPLETE" ]
then
IMPORT_MODE=" -F "importMode=COMPLETE" -F "projectFile=$IMPORT_FILE_NAME""
SECOND_STEP="secure/complete-project-import.jspa"
else
IMPORT_MODE=" -F "importMode=CONFIGURATION" -F "projectConfigFile=@$IMPORT_FILE_NAME""
SECOND_STEP="secure/project-config-file-upload!backgroundImport.jspa"
fi
OPTION_STRING=""
shift 6
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
curl -b $COOKIES_FILE -o $RESPONSE_HTML "$BASE_URL/secure/project-import-type!typeProject.jspa" $IMPORT_MODE
if ./status-checker-script $RESPONSE_HTML "-b $COOKIES_FILE -o $RESPONSE_HTML "$BASE_URL/$SECOND_STEP"" $OPTION_STRING" ; then
./wait-task-script $RESPONSE_HTML $HOST $CONTEXT $COOKIES_FILE
else
echo "Task has stopped"
fi |
Command It is launched with the following command: Code Block |
---|
import-project-script jira-host-url jira-context-path admin-user admin-password import-file-name import-mode [-O import-options ...] |
|
...
Export options
jira-host-url:
Host Host part of the exporting instance base URL, including port if needed (for example, http://my-server:2990)
jira-context-path: Context 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 Admin’s username
admin-password: Admin’s Admin’s password
project-key [project-key2 …]: Keys Keys of the projects to export, at least one must be provided
export-mode: COMPLETE COMPLETE for complete export or CONFIGURATION for exporting just configuration
export-file-name: Only Only for COMPLETE export. 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')
export-options: Additional Additional export options. Each export option must be specified as key=value, preferably enclosed in double quotes.
Parameters | Possible Values | Notes |
---|
attachmentMode | automatic | Attachments will be included in the exported ZIP file (This is the default option) |
manual | You’ll need to copy the source Attachments in the target before launching a complete import. |
filterUnusedCF | true | This parameter is deprecated. It is kept for backward compatibility with versions 1.3.0 and earlier of the app. It is equivalent to setting "filterCFMode=filterUnusedCFStrict". |
filterCFMode | exportAllCF | Export all custom fields. |
filterUnusedCFStrict | Filter custom fields unused by the exported projects, as explained Filtering Unused Custom Fields but without taking into account whether there are issues in the project with values for that custom field. This option is deprecated, it is kept only for backwards compatibility with app versions older than 1.5. |
filterUnusedCFExtended | The default. Filter custom fields unused by the exported projects, as explained in Filtering Unused Custom Fields. |
userExportMode, groupExportMode | fullExport | Export all (users or groups) |
ignoreInvalid | The default. Export all but users or groups not found or not valid |
doNotExport | No user or group will be exported. |
jiraFilterExportMode | none | No filter will be exported |
global | Export only filters shared with all users |
projects | The default. Export only filters shared with projects being exported |
global-or-projects | Combines two previous options: export filters that are shared globally or with exported projects. |
shared | Export only filters that the owner has shared with somebody else |
all | All filters (either private or shared) will be exported |
jiraDashboardExportMode | none | No dashboard will be exported |
global | Export only dashboards shared with all users |
projects | The default. Export only dashboards shared with projects being exported |
global-or-projects | Combines two previous options: export dashboards that are shared globally or with exported projects. |
shared | Export only dashboards that the owner has shared with somebody else |
all | All dashboards (either private or shared) will be exported |
agileBoardsExportMode | none | No Scrum or Kanban board will be exported |
projects | The default. Export only Scrum or Kanban boards associated to the projects being exported. Boards associated to a project appear under the project name at the project navigation panel (see an example image). |
all | All Scrum or Kanban boards will be exported |
Import options
jira-host-url:
Host Host part of the importing instance base URL, including port if needed
jira-context-path: Context Context part of the importing instance base URL
admin-user: Admin’s Admin’s username
admin-password: Admin’s Admin’s password
import-file-name: name name of the file to be imported, remember it must be placed before importing in "projectconfigurator" folder under directory $JIRA_HOME/import
import-mode: COMPLETE COMPLETE for complete import or CONFIGURATION for importing just configuration
import-options: additional additional import options. Each import option must be specified as key=value, preferably enclosed in double quotes
Field Name | Valid Values | Mandatory | Defaults to |
---|
attachmentsPath | A directory path with project attachments If you selected to move Attachments manually, introduce the Attachments path where you copied them | Yes (for complete imports) |
|
projectConfigFile | A file with a valid project configuration | Yes |
|
allowDifferentJiraVersionData | true, false | No | false |
applyChanges | true, false | No | false |
continueOnDashboardFilterErrors | true, false | No | false |
createExtraProjects | true, false | No | false |
doNotLoadObjects | Any of the following strings: | No Empty. This means to load all object types | publishDrafts (new in v 1.13-JX) |
true, false | No | false | smartCFContexts |
Temporary files and error handling
...
Code Block |
---|
import-project-script 10.0.2.2:2990 jira admin admin scriptfile.zip-COMPLETE -O "applyChanges=true" "createExtraProjects=true" "smartCFContexts=false" "publishdrafts=true" "continueOnDashboardFilterErrors=true" "attachmentsPath=" |
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.
Expand |
---|
|
Code Block |
---|
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 look at a couple of examples of error traces and how to fix those errors.
...
Expand |
---|
title | Error example when importing |
---|
|
Code Block |
---|
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 HTTP status: 400. In response.html, we find the following:
An error occurred: File 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.
...