From 894d1bcefb63ee5792099026f653e697bc859e96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Wed, 26 Jan 2022 20:53:14 +0200 Subject: [PATCH 01/28] GH-8 Add dump_only_these_tables input --- README.md | 1 + action.yml | 3 +++ entrypoint.sh | 13 +++++++++++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1ac49b7..1412dfa 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ GitHub Action to take a database dump from a platform.sh site and copy the dump platformsh_relationship: 'database' # optional. specify if the project has multiple databases. aws_s3_bucket: 'bucket-name' # required. db_dump_filename_base: 'sitename-db-dump' + dump_only_these_tables: 'table_name another_table_name' # optional. limit the tables being dumped, separate the table names with spaces. env: PLATFORMSH_CLI_TOKEN: ${{ secrets.PLATFORMSH_CLI_TOKEN }} # required. AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} # required. diff --git a/action.yml b/action.yml index 35ccf33..c500cbd 100644 --- a/action.yml +++ b/action.yml @@ -19,6 +19,9 @@ inputs: description: 'Filename for the database dump. A timestamp will be appended after it.' required: false default: 'db-dump' + dump_only_these_tables: + description: 'Limit the dumped tables to this list, separated by spaces.' + required: false runs: using: 'docker' image: 'Dockerfile' diff --git a/entrypoint.sh b/entrypoint.sh index 8b44b47..6c90f1d 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -7,14 +7,23 @@ platform --version sed -i 's/# StrictHostKeyChecking ask.*/StrictHostKeyChecking accept-new/' /etc/ssh/ssh_config FILENAME="${INPUT_DB_DUMP_FILENAME_BASE}-$(date +%F-%T)" +# If we are not limiting the tables with INPUT_ONLY_INCLUDE_THESE_TABLES, then +# this will pass harmlessly as an empty string in the platform db:dump command. +# @todo Can malicious users run command injection attack with table name input? +DUMP_ONLY_THESE_TABLES="" +for table in ${INPUT_DUMP_ONLY_THESE_TABLES} +do + DUMP_ONLY_THESE_TABLES+="--table $table " +done + # Check if the optional relationship value exists. if [ -z "${INPUT_PLATFORMSH_RELATIONSHIP}" ] then # Run command without --relationship parameter. - platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --gzip -f "$FILENAME".sql.gz + platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" ${DUMP_ONLY_THESE_TABLES} --gzip -f "$FILENAME".sql.gz else # Run command with --relationship parameter. - platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" --gzip -f "$FILENAME".sql.gz + platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" ${DUMP_ONLY_THESE_TABLES} --gzip -f "$FILENAME".sql.gz fi aws s3 cp "$FILENAME".sql.gz s3://"$INPUT_AWS_S3_BUCKET" From b03783d2e51fba74927b258def2109d6fe8ad2cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Wed, 26 Jan 2022 21:14:19 +0200 Subject: [PATCH 02/28] Try bash shell --- entrypoint.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 6c90f1d..b5bb262 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/sh -l +#!/bin/bash -l php --version aws --version @@ -20,10 +20,10 @@ done if [ -z "${INPUT_PLATFORMSH_RELATIONSHIP}" ] then # Run command without --relationship parameter. - platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" ${DUMP_ONLY_THESE_TABLES} --gzip -f "$FILENAME".sql.gz + platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" "${DUMP_ONLY_THESE_TABLES}" --gzip -f "$FILENAME".sql.gz else # Run command with --relationship parameter. - platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" ${DUMP_ONLY_THESE_TABLES} --gzip -f "$FILENAME".sql.gz + platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" "${DUMP_ONLY_THESE_TABLES}" --gzip -f "$FILENAME".sql.gz fi aws s3 cp "$FILENAME".sql.gz s3://"$INPUT_AWS_S3_BUCKET" From 2dd1faed51099c131bdbcebe283153f481497fc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Wed, 26 Jan 2022 21:17:44 +0200 Subject: [PATCH 03/28] Remove double quotes --- entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index b5bb262..c1054c3 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -20,10 +20,10 @@ done if [ -z "${INPUT_PLATFORMSH_RELATIONSHIP}" ] then # Run command without --relationship parameter. - platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" "${DUMP_ONLY_THESE_TABLES}" --gzip -f "$FILENAME".sql.gz + platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" ${DUMP_ONLY_THESE_TABLES} --gzip -f "$FILENAME".sql.gz else # Run command with --relationship parameter. - platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" "${DUMP_ONLY_THESE_TABLES}" --gzip -f "$FILENAME".sql.gz + platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" ${DUMP_ONLY_THESE_TABLES} --gzip -f "$FILENAME".sql.gz fi aws s3 cp "$FILENAME".sql.gz s3://"$INPUT_AWS_S3_BUCKET" From 72557e1c7985490ad5e941438329d954fda94924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Wed, 26 Jan 2022 21:51:45 +0200 Subject: [PATCH 04/28] Change to sh and try with array --- entrypoint.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index c1054c3..69878d2 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/bash -l +#!/bin/sh -l php --version aws --version @@ -13,17 +13,18 @@ FILENAME="${INPUT_DB_DUMP_FILENAME_BASE}-$(date +%F-%T)" DUMP_ONLY_THESE_TABLES="" for table in ${INPUT_DUMP_ONLY_THESE_TABLES} do - DUMP_ONLY_THESE_TABLES+="--table $table " + # Add table options into array. + DUMP_ONLY_THESE_TABLES+=("--table $table") done # Check if the optional relationship value exists. if [ -z "${INPUT_PLATFORMSH_RELATIONSHIP}" ] then # Run command without --relationship parameter. - platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" ${DUMP_ONLY_THESE_TABLES} --gzip -f "$FILENAME".sql.gz + platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" ${DUMP_ONLY_THESE_TABLES[@]} --gzip -f "$FILENAME".sql.gz else # Run command with --relationship parameter. - platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" ${DUMP_ONLY_THESE_TABLES} --gzip -f "$FILENAME".sql.gz + platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" ${DUMP_ONLY_THESE_TABLES[@]} --gzip -f "$FILENAME".sql.gz fi aws s3 cp "$FILENAME".sql.gz s3://"$INPUT_AWS_S3_BUCKET" From 5d30a90ae3dd7107fec3ba6ecc09fb0329484a53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Wed, 26 Jan 2022 21:52:57 +0200 Subject: [PATCH 05/28] Change to bash again --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 69878d2..01386fe 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/sh -l +#!/bin/bash -l php --version aws --version From b38afbc075158c1e453fa8166cb87fcebbf75156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Thu, 3 Feb 2022 16:42:51 +0200 Subject: [PATCH 06/28] Use backquotes to run string as command --- entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 01386fe..eba001a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -21,10 +21,10 @@ done if [ -z "${INPUT_PLATFORMSH_RELATIONSHIP}" ] then # Run command without --relationship parameter. - platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" ${DUMP_ONLY_THESE_TABLES[@]} --gzip -f "$FILENAME".sql.gz + platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" `"${DUMP_ONLY_THESE_TABLES[@]}"` --gzip -f "$FILENAME".sql.gz else # Run command with --relationship parameter. - platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" ${DUMP_ONLY_THESE_TABLES[@]} --gzip -f "$FILENAME".sql.gz + platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" `"${DUMP_ONLY_THESE_TABLES[@]}"` --gzip -f "$FILENAME".sql.gz fi aws s3 cp "$FILENAME".sql.gz s3://"$INPUT_AWS_S3_BUCKET" From 7951ab4fdc536c2e744599b18019e9b69e86e684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Thu, 3 Feb 2022 17:04:47 +0200 Subject: [PATCH 07/28] Surround platform db:dump command in backquotes --- entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index eba001a..9c8cf42 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -21,10 +21,10 @@ done if [ -z "${INPUT_PLATFORMSH_RELATIONSHIP}" ] then # Run command without --relationship parameter. - platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" `"${DUMP_ONLY_THESE_TABLES[@]}"` --gzip -f "$FILENAME".sql.gz + `platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" ${DUMP_ONLY_THESE_TABLES[@]} --gzip -f "$FILENAME".sql.gz` else # Run command with --relationship parameter. - platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" `"${DUMP_ONLY_THESE_TABLES[@]}"` --gzip -f "$FILENAME".sql.gz + `platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" ${DUMP_ONLY_THESE_TABLES[@]} --gzip -f "$FILENAME".sql.gz` fi aws s3 cp "$FILENAME".sql.gz s3://"$INPUT_AWS_S3_BUCKET" From 254c7f8ac5f4050f504dd484b1f5831c89632dee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Thu, 3 Feb 2022 17:18:39 +0200 Subject: [PATCH 08/28] Put entire command as string into variable --- entrypoint.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 9c8cf42..504ac89 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -21,10 +21,13 @@ done if [ -z "${INPUT_PLATFORMSH_RELATIONSHIP}" ] then # Run command without --relationship parameter. - `platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" ${DUMP_ONLY_THESE_TABLES[@]} --gzip -f "$FILENAME".sql.gz` + PLATFORM_COMMAND="platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" "${DUMP_ONLY_THESE_TABLES[@]}" --gzip -f "$FILENAME".sql.gz" else # Run command with --relationship parameter. - `platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" ${DUMP_ONLY_THESE_TABLES[@]} --gzip -f "$FILENAME".sql.gz` + PLATFORM_COMMAND="platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" "${DUMP_ONLY_THESE_TABLES[@]}" --gzip -f "$FILENAME".sql.gz" fi +# Use command substitution. +$($PLATFORM_COMMAND) + aws s3 cp "$FILENAME".sql.gz s3://"$INPUT_AWS_S3_BUCKET" From 99c6cdd801871e8210ad9758d3a80bead055a4e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Thu, 3 Feb 2022 17:44:10 +0200 Subject: [PATCH 09/28] Use * instead of @ in array --- entrypoint.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 504ac89..530a7f9 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -4,7 +4,7 @@ php --version aws --version platform --version -sed -i 's/# StrictHostKeyChecking ask.*/StrictHostKeyChecking accept-new/' /etc/ssh/ssh_config +sed -i 's/# StrictHostKeyChecking ask.*/StrictHostKeyChecking accept-new/' /etc/ssh/ssh_config FILENAME="${INPUT_DB_DUMP_FILENAME_BASE}-$(date +%F-%T)" # If we are not limiting the tables with INPUT_ONLY_INCLUDE_THESE_TABLES, then @@ -21,13 +21,13 @@ done if [ -z "${INPUT_PLATFORMSH_RELATIONSHIP}" ] then # Run command without --relationship parameter. - PLATFORM_COMMAND="platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" "${DUMP_ONLY_THESE_TABLES[@]}" --gzip -f "$FILENAME".sql.gz" + PLATFORM_COMMAND="platform db:dump -v --yes --project $INPUT_PLATFORMSH_PROJECT --environment $INPUT_PLATFORMSH_ENVIRONMENT ${DUMP_ONLY_THESE_TABLES[*]} --gzip -f $FILENAME.sql.gz" else # Run command with --relationship parameter. - PLATFORM_COMMAND="platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" "${DUMP_ONLY_THESE_TABLES[@]}" --gzip -f "$FILENAME".sql.gz" + PLATFORM_COMMAND="platform db:dump -v --yes --project $INPUT_PLATFORMSH_PROJECT --environment $INPUT_PLATFORMSH_ENVIRONMENT --relationship $INPUT_PLATFORMSH_RELATIONSHIP ${DUMP_ONLY_THESE_TABLES[*]} --gzip -f $FILENAME.sql.gz" fi -# Use command substitution. -$($PLATFORM_COMMAND) +# Run the string through eval to execute the platform db:dump command. +eval "$PLATFORM_COMMAND" aws s3 cp "$FILENAME".sql.gz s3://"$INPUT_AWS_S3_BUCKET" From c2119e4aa8422178f72312100da6e9fd5f7385e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Mon, 7 Feb 2022 18:53:23 +0200 Subject: [PATCH 10/28] Match sed command to that in main --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 530a7f9..cd7ebbb 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -4,7 +4,7 @@ php --version aws --version platform --version -sed -i 's/# StrictHostKeyChecking ask.*/StrictHostKeyChecking accept-new/' /etc/ssh/ssh_config +sed -i 's/# StrictHostKeyChecking ask.*/StrictHostKeyChecking accept-new/' /etc/ssh/ssh_config FILENAME="${INPUT_DB_DUMP_FILENAME_BASE}-$(date +%F-%T)" # If we are not limiting the tables with INPUT_ONLY_INCLUDE_THESE_TABLES, then From 09749dd711c7cc7d3fbcecf7e4d04438dcc8c272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Mon, 30 Sep 2024 14:56:14 +0300 Subject: [PATCH 11/28] Add debug statement and try different syntax --- entrypoint.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 7ffb440..eba641b 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -13,8 +13,9 @@ FILENAME="${INPUT_DB_DUMP_FILENAME_BASE}-$(date +%F-%T)" DUMP_ONLY_THESE_TABLES="" for table in ${INPUT_DUMP_ONLY_THESE_TABLES} do + echo $table # Add table options into array. - DUMP_ONLY_THESE_TABLES+=("--table $table") + DUMP_ONLY_THESE_TABLES+=("--table ${table}") done # Check if neither optional relationship nor optional app value exists. @@ -41,4 +42,4 @@ else fi fi -aws s3 cp "$FILENAME".sql.gz s3://"$INPUT_AWS_S3_BUCKET" \ No newline at end of file +aws s3 cp "$FILENAME".sql.gz s3://"$INPUT_AWS_S3_BUCKET" From c0dedd54c70c6adcb87c7cfdd427831b76cbebed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Mon, 30 Sep 2024 14:59:51 +0300 Subject: [PATCH 12/28] Add debug statement --- entrypoint.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index eba641b..6e02716 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -7,6 +7,8 @@ platform --version sed -i 's/# StrictHostKeyChecking ask.*/StrictHostKeyChecking accept-new/' /etc/ssh/ssh_config FILENAME="${INPUT_DB_DUMP_FILENAME_BASE}-$(date +%F-%T)" +echo "About to go into loop" + # If we are not limiting the tables with INPUT_ONLY_INCLUDE_THESE_TABLES, then # this will pass harmlessly as an empty string in the platform db:dump command. # @todo Can malicious users run command injection attack with table name input? From ba3c2ac97f4bd2751fa0446a9a5da1d0b6475c0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Mon, 30 Sep 2024 15:06:23 +0300 Subject: [PATCH 13/28] Try various debug statements --- entrypoint.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 6e02716..8b0f88d 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -15,9 +15,12 @@ echo "About to go into loop" DUMP_ONLY_THESE_TABLES="" for table in ${INPUT_DUMP_ONLY_THESE_TABLES} do - echo $table + echo "Without parentheses..." + echo "-- table $table" + echo "And now with parentheses..." + echo "-- table ${table}" # Add table options into array. - DUMP_ONLY_THESE_TABLES+=("--table ${table}") +i# DUMP_ONLY_THESE_TABLES+=("--table ${table}") done # Check if neither optional relationship nor optional app value exists. From b26d1a6f8b55a5cc4d045c5316a559a00b1c40b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Mon, 30 Sep 2024 15:08:11 +0300 Subject: [PATCH 14/28] Remove accidental typo character --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 8b0f88d..dc80c40 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -20,7 +20,7 @@ do echo "And now with parentheses..." echo "-- table ${table}" # Add table options into array. -i# DUMP_ONLY_THESE_TABLES+=("--table ${table}") + # DUMP_ONLY_THESE_TABLES+=("--table ${table}") done # Check if neither optional relationship nor optional app value exists. From e82eed5a3cd360c544d4398baa556aba2577c2cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Mon, 30 Sep 2024 15:10:33 +0300 Subject: [PATCH 15/28] Remove extra spaces --- entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index dc80c40..44c9f8c 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -16,9 +16,9 @@ DUMP_ONLY_THESE_TABLES="" for table in ${INPUT_DUMP_ONLY_THESE_TABLES} do echo "Without parentheses..." - echo "-- table $table" + echo "--table $table" echo "And now with parentheses..." - echo "-- table ${table}" + echo "--table ${table}" # Add table options into array. # DUMP_ONLY_THESE_TABLES+=("--table ${table}") done From ba008889dc8c69bb0613d17044fc103317d506d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Mon, 30 Sep 2024 15:14:09 +0300 Subject: [PATCH 16/28] Temporarily hard-code DUMP_ONLY_THESE_TABLES --- entrypoint.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 44c9f8c..a56586c 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -22,6 +22,8 @@ do # Add table options into array. # DUMP_ONLY_THESE_TABLES+=("--table ${table}") done +# Temporarily hard-code DUMP_ONLY_THESE_TABLES. +DUMP_ONLY_THESE_TABLES = "--table elog --table watchdog" # Check if neither optional relationship nor optional app value exists. if [ -z "${INPUT_PLATFORMSH_RELATIONSHIP}" ] && [ -z "${INPUT_PLATFORMSH_APP}" ] @@ -43,7 +45,7 @@ else # To get here we must have both --relationship and --app values available. # Run command with --relationship and --app parameters. # Also the optional DUMP_ONLY_THESE_TABLES argument limits to a subset of tables, separated by spaces. - platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" --app "$INPUT_PLATFORMSH_APP" ${DUMP_ONLY_THESE_TABLES[*]} --gzip -f "$FILENAME".sql.gz + platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" --app "$INPUT_PLATFORMSH_APP" ${DUMP_ONLY_THESE_TABLES} --gzip -f "$FILENAME".sql.gz fi fi From 2157b170fcc86ee9d9f9c04259ef6c8bff36b7d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Mon, 30 Sep 2024 15:17:24 +0300 Subject: [PATCH 17/28] Remove unnecessary spaces --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index a56586c..ec4cbf5 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -23,7 +23,7 @@ do # DUMP_ONLY_THESE_TABLES+=("--table ${table}") done # Temporarily hard-code DUMP_ONLY_THESE_TABLES. -DUMP_ONLY_THESE_TABLES = "--table elog --table watchdog" +DUMP_ONLY_THESE_TABLES="--table elog --table watchdog" # Check if neither optional relationship nor optional app value exists. if [ -z "${INPUT_PLATFORMSH_RELATIONSHIP}" ] && [ -z "${INPUT_PLATFORMSH_APP}" ] From effc3d70191c2f3beab766dadad1c61989a8bc6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Wed, 2 Oct 2024 16:24:21 +0300 Subject: [PATCH 18/28] Remove parentheses from string concatenation --- entrypoint.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index ec4cbf5..0f10153 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -21,9 +21,10 @@ do echo "--table ${table}" # Add table options into array. # DUMP_ONLY_THESE_TABLES+=("--table ${table}") + DUMP_ONLY_THESE_TABLES+="--table ${table} " done # Temporarily hard-code DUMP_ONLY_THESE_TABLES. -DUMP_ONLY_THESE_TABLES="--table elog --table watchdog" +# DUMP_ONLY_THESE_TABLES="--table elog --table watchdog" # Check if neither optional relationship nor optional app value exists. if [ -z "${INPUT_PLATFORMSH_RELATIONSHIP}" ] && [ -z "${INPUT_PLATFORMSH_APP}" ] From 1df0cb0e2db0c38a2a0f72911d149362bfbc9420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Wed, 2 Oct 2024 16:25:25 +0300 Subject: [PATCH 19/28] Change comment --- entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/entrypoint.sh b/entrypoint.sh index 0f10153..bcd2f59 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -21,6 +21,7 @@ do echo "--table ${table}" # Add table options into array. # DUMP_ONLY_THESE_TABLES+=("--table ${table}") + # Concatenate table options into string. DUMP_ONLY_THESE_TABLES+="--table ${table} " done # Temporarily hard-code DUMP_ONLY_THESE_TABLES. From 1eb41fe3da04b079c1c2fc3b9a8af87aab928ed5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Wed, 2 Oct 2024 16:35:49 +0300 Subject: [PATCH 20/28] Add debug to see contents of DUMP_ONLY_THESE_TABLES --- entrypoint.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index bcd2f59..2b99ee3 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -15,17 +15,14 @@ echo "About to go into loop" DUMP_ONLY_THESE_TABLES="" for table in ${INPUT_DUMP_ONLY_THESE_TABLES} do - echo "Without parentheses..." - echo "--table $table" - echo "And now with parentheses..." - echo "--table ${table}" # Add table options into array. # DUMP_ONLY_THESE_TABLES+=("--table ${table}") # Concatenate table options into string. DUMP_ONLY_THESE_TABLES+="--table ${table} " done -# Temporarily hard-code DUMP_ONLY_THESE_TABLES. -# DUMP_ONLY_THESE_TABLES="--table elog --table watchdog" + +echo "About to echo the contents of DUMP_ONLY_THESE_TABLES +echo $DUMP_ONLY_THESE_TABLES # Check if neither optional relationship nor optional app value exists. if [ -z "${INPUT_PLATFORMSH_RELATIONSHIP}" ] && [ -z "${INPUT_PLATFORMSH_APP}" ] From 06387de810c888f8c29a41849ed4797de52fdc53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Wed, 2 Oct 2024 16:52:18 +0300 Subject: [PATCH 21/28] Add debug lines --- entrypoint.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 2b99ee3..097bd50 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -18,11 +18,18 @@ do # Add table options into array. # DUMP_ONLY_THESE_TABLES+=("--table ${table}") # Concatenate table options into string. - DUMP_ONLY_THESE_TABLES+="--table ${table} " + DUMP_ONLY_THESE_TABLES+=" --table ${table}" done +echo "Testing manual string concatenation" +TEST_VAR_ONE=" --table testelog" +TEST_VAR_TWO=" --table testwatchdog" +TEST_VARS="" +TEST_VARS+="$TEST_VAR_ONE" +TEST_VARS+="$TEST_VAR_TWO" +echo "$TEST_VARS" echo "About to echo the contents of DUMP_ONLY_THESE_TABLES -echo $DUMP_ONLY_THESE_TABLES +echo "$DUMP_ONLY_THESE_TABLES" # Check if neither optional relationship nor optional app value exists. if [ -z "${INPUT_PLATFORMSH_RELATIONSHIP}" ] && [ -z "${INPUT_PLATFORMSH_APP}" ] @@ -44,7 +51,7 @@ else # To get here we must have both --relationship and --app values available. # Run command with --relationship and --app parameters. # Also the optional DUMP_ONLY_THESE_TABLES argument limits to a subset of tables, separated by spaces. - platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" --app "$INPUT_PLATFORMSH_APP" ${DUMP_ONLY_THESE_TABLES} --gzip -f "$FILENAME".sql.gz + platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" --app "$INPUT_PLATFORMSH_APP" "$DUMP_ONLY_THESE_TABLES" --gzip -f "$FILENAME".sql.gz fi fi From a830bd48712e4c329dd3e5d534377f196205950a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Wed, 2 Oct 2024 16:54:06 +0300 Subject: [PATCH 22/28] Adjust debug lines --- entrypoint.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 097bd50..9b237f1 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -21,11 +21,11 @@ do DUMP_ONLY_THESE_TABLES+=" --table ${table}" done echo "Testing manual string concatenation" -TEST_VAR_ONE=" --table testelog" -TEST_VAR_TWO=" --table testwatchdog" +TEST_VAR_ONE="testelog" +TEST_VAR_TWO="testwatchdog" TEST_VARS="" -TEST_VARS+="$TEST_VAR_ONE" -TEST_VARS+="$TEST_VAR_TWO" +TEST_VARS+="$TEST_VAR_ONE " +TEST_VARS+="$TEST_VAR_TWO " echo "$TEST_VARS" echo "About to echo the contents of DUMP_ONLY_THESE_TABLES From 2948052faa3fe4c16e3a36c514b94045bff073db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Wed, 2 Oct 2024 17:37:25 +0300 Subject: [PATCH 23/28] Add missing double quote --- entrypoint.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 9b237f1..235b438 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -26,10 +26,10 @@ TEST_VAR_TWO="testwatchdog" TEST_VARS="" TEST_VARS+="$TEST_VAR_ONE " TEST_VARS+="$TEST_VAR_TWO " -echo "$TEST_VARS" +echo "${TEST_VARS}" -echo "About to echo the contents of DUMP_ONLY_THESE_TABLES -echo "$DUMP_ONLY_THESE_TABLES" +echo "About to echo the contents of DUMP_ONLY_THESE_TABLES" +echo "${DUMP_ONLY_THESE_TABLES}" # Check if neither optional relationship nor optional app value exists. if [ -z "${INPUT_PLATFORMSH_RELATIONSHIP}" ] && [ -z "${INPUT_PLATFORMSH_APP}" ] @@ -51,7 +51,7 @@ else # To get here we must have both --relationship and --app values available. # Run command with --relationship and --app parameters. # Also the optional DUMP_ONLY_THESE_TABLES argument limits to a subset of tables, separated by spaces. - platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" --app "$INPUT_PLATFORMSH_APP" "$DUMP_ONLY_THESE_TABLES" --gzip -f "$FILENAME".sql.gz + platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" --app "$INPUT_PLATFORMSH_APP" "${DUMP_ONLY_THESE_TABLES}" --gzip -f "$FILENAME".sql.gz fi fi From 24156043a8e4441dff53c6e13bd2173a8a478a67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Thu, 3 Oct 2024 14:32:40 +0300 Subject: [PATCH 24/28] Alter debugging lines --- entrypoint.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 235b438..1af2b9f 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -18,14 +18,14 @@ do # Add table options into array. # DUMP_ONLY_THESE_TABLES+=("--table ${table}") # Concatenate table options into string. - DUMP_ONLY_THESE_TABLES+=" --table ${table}" + DUMP_ONLY_THESE_TABLES="${DUMP_ONLY_THESE_TABLES} --table ${table}" done echo "Testing manual string concatenation" TEST_VAR_ONE="testelog" TEST_VAR_TWO="testwatchdog" TEST_VARS="" -TEST_VARS+="$TEST_VAR_ONE " -TEST_VARS+="$TEST_VAR_TWO " +TEST_VARS="${TEST_VARS} ${TEST_VAR_ONE}" +TEST_VARS="${TEST_VARS} ${TEST_VAR_TWO}" echo "${TEST_VARS}" echo "About to echo the contents of DUMP_ONLY_THESE_TABLES" From 3a213c1244278b48ffafb7db2d4d56886bbf6dae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Thu, 3 Oct 2024 14:38:13 +0300 Subject: [PATCH 25/28] Insert DUMP_ONLY_THESE_TABLES into --app --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 1af2b9f..925a244 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -51,7 +51,7 @@ else # To get here we must have both --relationship and --app values available. # Run command with --relationship and --app parameters. # Also the optional DUMP_ONLY_THESE_TABLES argument limits to a subset of tables, separated by spaces. - platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" --app "$INPUT_PLATFORMSH_APP" "${DUMP_ONLY_THESE_TABLES}" --gzip -f "$FILENAME".sql.gz + platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" --app "$INPUT_PLATFORMSH_APP ${DUMP_ONLY_THESE_TABLES}" --gzip -f "$FILENAME".sql.gz fi fi From 0e2e0574a477ae9833ba6e517335899610c04e6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Thu, 3 Oct 2024 14:41:57 +0300 Subject: [PATCH 26/28] Instantiate DUMP_ONLY_THESE_TABLES with --table --- entrypoint.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 925a244..3211e77 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -12,13 +12,14 @@ echo "About to go into loop" # If we are not limiting the tables with INPUT_ONLY_INCLUDE_THESE_TABLES, then # this will pass harmlessly as an empty string in the platform db:dump command. # @todo Can malicious users run command injection attack with table name input? -DUMP_ONLY_THESE_TABLES="" +DUMP_ONLY_THESE_TABLES="--table " for table in ${INPUT_DUMP_ONLY_THESE_TABLES} do # Add table options into array. # DUMP_ONLY_THESE_TABLES+=("--table ${table}") # Concatenate table options into string. - DUMP_ONLY_THESE_TABLES="${DUMP_ONLY_THESE_TABLES} --table ${table}" + # DUMP_ONLY_THESE_TABLES="${DUMP_ONLY_THESE_TABLES} --table ${table}" + DUMP_ONLY_THESE_TABLES="${DUMP_ONLY_THESE_TABLES} ${table}" done echo "Testing manual string concatenation" TEST_VAR_ONE="testelog" @@ -51,7 +52,7 @@ else # To get here we must have both --relationship and --app values available. # Run command with --relationship and --app parameters. # Also the optional DUMP_ONLY_THESE_TABLES argument limits to a subset of tables, separated by spaces. - platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" --app "$INPUT_PLATFORMSH_APP ${DUMP_ONLY_THESE_TABLES}" --gzip -f "$FILENAME".sql.gz + platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" --app "$INPUT_PLATFORMSH_APP" "${DUMP_ONLY_THESE_TABLES}" --gzip -f "$FILENAME".sql.gz fi fi From 358f1859020869aa1f48779b0453956d1467e18e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Thu, 3 Oct 2024 14:58:40 +0300 Subject: [PATCH 27/28] Add = sign after --table --- entrypoint.sh | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 3211e77..b22da5e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -7,27 +7,18 @@ platform --version sed -i 's/# StrictHostKeyChecking ask.*/StrictHostKeyChecking accept-new/' /etc/ssh/ssh_config FILENAME="${INPUT_DB_DUMP_FILENAME_BASE}-$(date +%F-%T)" -echo "About to go into loop" - # If we are not limiting the tables with INPUT_ONLY_INCLUDE_THESE_TABLES, then # this will pass harmlessly as an empty string in the platform db:dump command. # @todo Can malicious users run command injection attack with table name input? -DUMP_ONLY_THESE_TABLES="--table " +DUMP_ONLY_THESE_TABLES="" for table in ${INPUT_DUMP_ONLY_THESE_TABLES} do # Add table options into array. # DUMP_ONLY_THESE_TABLES+=("--table ${table}") # Concatenate table options into string. # DUMP_ONLY_THESE_TABLES="${DUMP_ONLY_THESE_TABLES} --table ${table}" - DUMP_ONLY_THESE_TABLES="${DUMP_ONLY_THESE_TABLES} ${table}" + DUMP_ONLY_THESE_TABLES="${DUMP_ONLY_THESE_TABLES} --table=${table}" done -echo "Testing manual string concatenation" -TEST_VAR_ONE="testelog" -TEST_VAR_TWO="testwatchdog" -TEST_VARS="" -TEST_VARS="${TEST_VARS} ${TEST_VAR_ONE}" -TEST_VARS="${TEST_VARS} ${TEST_VAR_TWO}" -echo "${TEST_VARS}" echo "About to echo the contents of DUMP_ONLY_THESE_TABLES" echo "${DUMP_ONLY_THESE_TABLES}" From 80d948848459b04e1172197b4a7c3fcdf63efd1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4rt=20Matsoo?= Date: Thu, 3 Oct 2024 15:03:19 +0300 Subject: [PATCH 28/28] Do some code clean-up --- entrypoint.sh | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index b22da5e..46f68ec 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -9,20 +9,13 @@ FILENAME="${INPUT_DB_DUMP_FILENAME_BASE}-$(date +%F-%T)" # If we are not limiting the tables with INPUT_ONLY_INCLUDE_THESE_TABLES, then # this will pass harmlessly as an empty string in the platform db:dump command. -# @todo Can malicious users run command injection attack with table name input? DUMP_ONLY_THESE_TABLES="" for table in ${INPUT_DUMP_ONLY_THESE_TABLES} do - # Add table options into array. - # DUMP_ONLY_THESE_TABLES+=("--table ${table}") # Concatenate table options into string. - # DUMP_ONLY_THESE_TABLES="${DUMP_ONLY_THESE_TABLES} --table ${table}" DUMP_ONLY_THESE_TABLES="${DUMP_ONLY_THESE_TABLES} --table=${table}" done -echo "About to echo the contents of DUMP_ONLY_THESE_TABLES" -echo "${DUMP_ONLY_THESE_TABLES}" - # Check if neither optional relationship nor optional app value exists. if [ -z "${INPUT_PLATFORMSH_RELATIONSHIP}" ] && [ -z "${INPUT_PLATFORMSH_APP}" ] then @@ -42,8 +35,8 @@ else else # To get here we must have both --relationship and --app values available. # Run command with --relationship and --app parameters. - # Also the optional DUMP_ONLY_THESE_TABLES argument limits to a subset of tables, separated by spaces. - platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" --app "$INPUT_PLATFORMSH_APP" "${DUMP_ONLY_THESE_TABLES}" --gzip -f "$FILENAME".sql.gz + # Also the optional DUMP_ONLY_THESE_TABLES argument limits to a subset of tables, but it may be empty. + platform db:dump -v --yes --project "$INPUT_PLATFORMSH_PROJECT" --environment "$INPUT_PLATFORMSH_ENVIRONMENT" --relationship "$INPUT_PLATFORMSH_RELATIONSHIP" --app "$INPUT_PLATFORMSH_APP" ${DUMP_ONLY_THESE_TABLES} --gzip -f "$FILENAME".sql.gz fi fi