Skip to content

Commit 04b5374

Browse files
OlehStefanyshyndoit-bi-do
authored andcommitted
DCA-1073: Update populate_db script (atlassian#656)
* DCA-1073: Update populate_db script * DCA-1073: Update populate_db.sh
1 parent 837fd8a commit 04b5374

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

app/util/bitbucket/populate_db.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,14 @@ if [[ ! "${SUPPORTED_BITBUCKET_VERSIONS[*]}" =~ ${BITBUCKET_VERSION} ]]; then
4949
echo "!!! Warning !!! This may break your Bitbucket instance. Also, note that downgrade is not supported by Bitbucket."
5050
# Check if --force flag is passed into command
5151
if [[ "$1" == "--force" ]]; then
52+
# Check if version was specified after --force flag
53+
if [[ -z "$2" ]]; then
54+
echo "Error: --force flag requires version after it."
55+
echo "Specify one of these versions: ${SUPPORTED_BITBUCKET_VERSIONS[*]}"
56+
exit 1
57+
fi
5258
# Check if passed Bitbucket version is in list of supported
53-
if [[ "${SUPPORTED_BITBUCKET_VERSIONS[*]}" =~ ${2} ]]; then
59+
if [[ " ${SUPPORTED_BITBUCKET_VERSIONS[@]} " =~ " ${2} " ]]; then
5460
DB_DUMP_URL="${DATASETS_AWS_BUCKET}/$2/${DATASETS_SIZE}/${DB_DUMP_NAME}"
5561
echo "Force mode. Dataset URL: ${DB_DUMP_URL}"
5662
else

app/util/confluence/populate_db.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,14 @@ if [[ ! "${SUPPORTED_CONFLUENCE_VERSIONS[*]}" =~ ${CONFLUENCE_VERSION} ]]; then
5353
echo "!!! Warning !!! This may break your Confluence instance. Also, note that downgrade is not supported by Confluence."
5454
# Check if --force flag is passed into command
5555
if [[ "$1" == "--force" ]]; then
56+
# Check if version was specified after --force flag
57+
if [[ -z "$2" ]]; then
58+
echo "Error: --force flag requires version after it."
59+
echo "Specify one of these versions: ${SUPPORTED_CONFLUENCE_VERSIONS[*]}"
60+
exit 1
61+
fi
5662
# Check if passed Confluence version is in list of supported
57-
if [[ "${SUPPORTED_CONFLUENCE_VERSIONS[*]}" =~ ${2} ]]; then
63+
if [[ " ${SUPPORTED_CONFLUENCE_VERSIONS[@]} " =~ " ${2} " ]]; then
5864
DB_DUMP_URL="${DATASETS_AWS_BUCKET}/$2/${DATASETS_SIZE}/${DB_DUMP_NAME}"
5965
echo "Force mode. Dataset URL: ${DB_DUMP_URL}"
6066
else

app/util/jira/populate_db.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,14 @@ if [[ ! "${SUPPORTED_VERSIONS[*]}" =~ ${JIRA_VERSION} ]]; then
9090
echo "!!! Warning !!! This may break your Jira instance."
9191
# Check if --force flag is passed into command
9292
if [[ ${force} == 1 ]]; then
93+
# Check if version was specified after --force flag
94+
if [[ -z ${version} ]]; then
95+
echo "Error: --force flag requires version after it."
96+
echo "Specify one of these versions: ${SUPPORTED_VERSIONS[*]}"
97+
exit 1
98+
fi
9399
# Check if passed Jira version is in list of supported
94-
if [[ "${SUPPORTED_VERSIONS[*]}" =~ ${version} ]]; then
100+
if [[ " ${SUPPORTED_VERSIONS[@]} " =~ " ${version} " ]]; then
95101
DB_DUMP_URL="${DATASETS_AWS_BUCKET}/${version}/${DATASETS_SIZE}/${DB_DUMP_NAME}"
96102
echo "Force mode. Dataset URL: ${DB_DUMP_URL}"
97103
# If there is no DOWNGRADE_OPT - set it

0 commit comments

Comments
 (0)