From b9e5000c34160c9b57a31914da6deccd4d47a7d5 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Thu, 25 Jun 2026 13:32:16 +1000 Subject: [PATCH 1/6] [#2719] Routed Acquia hooks through a central 'task' router. --- .vortex/tooling/src/task | 28 +++++++++++++ .vortex/tooling/tests/unit/task.bats | 63 ++++++++++++++++++++++++++++ hooks/library/copy-db.sh | 2 +- hooks/library/copy-files.sh | 2 +- hooks/library/purge-cache.sh | 3 +- 5 files changed, 94 insertions(+), 4 deletions(-) create mode 100755 .vortex/tooling/src/task create mode 100644 .vortex/tooling/tests/unit/task.bats diff --git a/.vortex/tooling/src/task b/.vortex/tooling/src/task new file mode 100755 index 000000000..3a7340aba --- /dev/null +++ b/.vortex/tooling/src/task @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +## +# Run a task. +# +# This is a router script to call the relevant task script based on the command. +# +# shellcheck disable=SC1090,SC1091 + +set -eu +[ "${VORTEX_DEBUG-}" = "1" ] && set -x + +# @formatter:off +fail() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[31m[FAIL] %s\033[0m\n" "${1}" || printf "[FAIL] %s\n" "${1}"; } +# @formatter:on + +command="${1:-}" +[ -z "${command}" ] && fail "Missing task command." && exit 1 +shift + +case "${command}" in + copy-db-acquia | copy-files-acquia | purge-cache-acquia) + "$(dirname "${BASH_SOURCE[0]}")/task-${command}" "$@" + ;; + *) + fail "Unsupported task command '${command}' provided." + exit 1 + ;; +esac diff --git a/.vortex/tooling/tests/unit/task.bats b/.vortex/tooling/tests/unit/task.bats new file mode 100644 index 000000000..7d6b1367c --- /dev/null +++ b/.vortex/tooling/tests/unit/task.bats @@ -0,0 +1,63 @@ +#!/usr/bin/env bats +## +# Unit tests for the task router. +# +# The task-specific logic lives in the dispatched sibling scripts +# (task-copy-db-acquia, task-copy-files-acquia, task-purge-cache-acquia); these +# tests cover only the router's command resolution and error handling. +# +#shellcheck disable=SC2030,SC2031,SC2034 + +load ../_helper.bash + +@test "Task: missing command" { + pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + + run ./.vortex/tooling/src/task + assert_failure + assert_output_contains "Missing task command." + + popd >/dev/null || exit 1 +} + +@test "Task: unsupported command" { + pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + + run ./.vortex/tooling/src/task invalid-command + assert_failure + assert_output_contains "Unsupported task command 'invalid-command' provided." + + popd >/dev/null || exit 1 +} + +@test "Task: dispatches copy-db-acquia" { + pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + + # Without credentials the sibling prints its banner and then fails on the + # missing-key guard before any network call, which proves the routing. + run ./.vortex/tooling/src/task copy-db-acquia + assert_failure + assert_output_contains "Started database copying between environments in Acquia." + + popd >/dev/null || exit 1 +} + +@test "Task: dispatches copy-files-acquia" { + pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + + run ./.vortex/tooling/src/task copy-files-acquia + assert_failure + assert_output_contains "Started files copying between environments in Acquia." + + popd >/dev/null || exit 1 +} + +@test "Task: dispatches purge-cache-acquia" { + pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + + run ./.vortex/tooling/src/task purge-cache-acquia + assert_failure + assert_output_contains "Started cache purging in Acquia." + + popd >/dev/null || exit 1 +} diff --git a/hooks/library/copy-db.sh b/hooks/library/copy-db.sh index 9185501b4..ccca16e2d 100755 --- a/hooks/library/copy-db.sh +++ b/hooks/library/copy-db.sh @@ -21,6 +21,6 @@ export VORTEX_TASK_COPY_DB_ACQUIA_SRC="${VORTEX_TASK_COPY_DB_ACQUIA_SRC:-prod}" export VORTEX_TASK_COPY_DB_ACQUIA_DST="${VORTEX_TASK_COPY_DB_ACQUIA_DST:-${target_env}}" export VORTEX_TASK_COPY_DB_ACQUIA_NAME="${VORTEX_TASK_COPY_DB_ACQUIA_NAME?not set}" -./vendor/drevops/vortex-tooling/src/task-copy-db-acquia +./vendor/drevops/vortex-tooling/src/task copy-db-acquia popd >/dev/null || exit 1 diff --git a/hooks/library/copy-files.sh b/hooks/library/copy-files.sh index 95924c1eb..24297b90e 100755 --- a/hooks/library/copy-files.sh +++ b/hooks/library/copy-files.sh @@ -20,6 +20,6 @@ export VORTEX_ACQUIA_APP_NAME="${VORTEX_ACQUIA_APP_NAME:-${site}}" export VORTEX_TASK_COPY_FILES_ACQUIA_SRC="${VORTEX_TASK_COPY_FILES_ACQUIA_SRC:-prod}" export VORTEX_TASK_COPY_FILES_ACQUIA_DST="${VORTEX_TASK_COPY_FILES_ACQUIA_DST:-${target_env}}" -./vendor/drevops/vortex-tooling/src/task-copy-files-acquia +./vendor/drevops/vortex-tooling/src/task copy-files-acquia popd >/dev/null || exit 1 diff --git a/hooks/library/purge-cache.sh b/hooks/library/purge-cache.sh index 81b73bef1..460df730e 100755 --- a/hooks/library/purge-cache.sh +++ b/hooks/library/purge-cache.sh @@ -1,5 +1,4 @@ #!/usr/bin/env bash -#!/usr/bin/env bash ## # Acquia Cloud hook: Purge edge cache in an environment. # @@ -21,6 +20,6 @@ export VORTEX_ACQUIA_APP_NAME="${VORTEX_ACQUIA_APP_NAME:-${site}}" export VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV="${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV:-${target_env}}" export VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE="${VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE:-"/var/www/html/${site}.${target_env}/hooks/library/domains.txt"}" -./vendor/drevops/vortex-tooling/src/task-purge-cache-acquia +./vendor/drevops/vortex-tooling/src/task purge-cache-acquia popd >/dev/null || exit 1 From 2339b4d84a1464bd773ae75314b9dbd451d899e4 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Thu, 25 Jun 2026 13:35:25 +1000 Subject: [PATCH 2/6] Updated snapshots. --- .../handler_process/hosting_acquia/hooks/library/copy-db.sh | 2 +- .../handler_process/hosting_acquia/hooks/library/copy-files.sh | 2 +- .../hosting_acquia/hooks/library/purge-cache.sh | 3 +-- .../hosting_project_name___acquia/hooks/library/copy-db.sh | 2 +- .../hosting_project_name___acquia/hooks/library/copy-files.sh | 2 +- .../hosting_project_name___acquia/hooks/library/purge-cache.sh | 3 +-- 6 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/copy-db.sh b/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/copy-db.sh index 9185501b4..ccca16e2d 100755 --- a/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/copy-db.sh +++ b/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/copy-db.sh @@ -21,6 +21,6 @@ export VORTEX_TASK_COPY_DB_ACQUIA_SRC="${VORTEX_TASK_COPY_DB_ACQUIA_SRC:-prod}" export VORTEX_TASK_COPY_DB_ACQUIA_DST="${VORTEX_TASK_COPY_DB_ACQUIA_DST:-${target_env}}" export VORTEX_TASK_COPY_DB_ACQUIA_NAME="${VORTEX_TASK_COPY_DB_ACQUIA_NAME?not set}" -./vendor/drevops/vortex-tooling/src/task-copy-db-acquia +./vendor/drevops/vortex-tooling/src/task copy-db-acquia popd >/dev/null || exit 1 diff --git a/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/copy-files.sh b/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/copy-files.sh index 95924c1eb..24297b90e 100755 --- a/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/copy-files.sh +++ b/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/copy-files.sh @@ -20,6 +20,6 @@ export VORTEX_ACQUIA_APP_NAME="${VORTEX_ACQUIA_APP_NAME:-${site}}" export VORTEX_TASK_COPY_FILES_ACQUIA_SRC="${VORTEX_TASK_COPY_FILES_ACQUIA_SRC:-prod}" export VORTEX_TASK_COPY_FILES_ACQUIA_DST="${VORTEX_TASK_COPY_FILES_ACQUIA_DST:-${target_env}}" -./vendor/drevops/vortex-tooling/src/task-copy-files-acquia +./vendor/drevops/vortex-tooling/src/task copy-files-acquia popd >/dev/null || exit 1 diff --git a/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/purge-cache.sh b/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/purge-cache.sh index 81b73bef1..460df730e 100755 --- a/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/purge-cache.sh +++ b/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/purge-cache.sh @@ -1,5 +1,4 @@ #!/usr/bin/env bash -#!/usr/bin/env bash ## # Acquia Cloud hook: Purge edge cache in an environment. # @@ -21,6 +20,6 @@ export VORTEX_ACQUIA_APP_NAME="${VORTEX_ACQUIA_APP_NAME:-${site}}" export VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV="${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV:-${target_env}}" export VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE="${VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE:-"/var/www/html/${site}.${target_env}/hooks/library/domains.txt"}" -./vendor/drevops/vortex-tooling/src/task-purge-cache-acquia +./vendor/drevops/vortex-tooling/src/task purge-cache-acquia popd >/dev/null || exit 1 diff --git a/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/copy-db.sh b/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/copy-db.sh index 9185501b4..ccca16e2d 100755 --- a/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/copy-db.sh +++ b/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/copy-db.sh @@ -21,6 +21,6 @@ export VORTEX_TASK_COPY_DB_ACQUIA_SRC="${VORTEX_TASK_COPY_DB_ACQUIA_SRC:-prod}" export VORTEX_TASK_COPY_DB_ACQUIA_DST="${VORTEX_TASK_COPY_DB_ACQUIA_DST:-${target_env}}" export VORTEX_TASK_COPY_DB_ACQUIA_NAME="${VORTEX_TASK_COPY_DB_ACQUIA_NAME?not set}" -./vendor/drevops/vortex-tooling/src/task-copy-db-acquia +./vendor/drevops/vortex-tooling/src/task copy-db-acquia popd >/dev/null || exit 1 diff --git a/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/copy-files.sh b/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/copy-files.sh index 95924c1eb..24297b90e 100755 --- a/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/copy-files.sh +++ b/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/copy-files.sh @@ -20,6 +20,6 @@ export VORTEX_ACQUIA_APP_NAME="${VORTEX_ACQUIA_APP_NAME:-${site}}" export VORTEX_TASK_COPY_FILES_ACQUIA_SRC="${VORTEX_TASK_COPY_FILES_ACQUIA_SRC:-prod}" export VORTEX_TASK_COPY_FILES_ACQUIA_DST="${VORTEX_TASK_COPY_FILES_ACQUIA_DST:-${target_env}}" -./vendor/drevops/vortex-tooling/src/task-copy-files-acquia +./vendor/drevops/vortex-tooling/src/task copy-files-acquia popd >/dev/null || exit 1 diff --git a/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/purge-cache.sh b/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/purge-cache.sh index 81b73bef1..460df730e 100755 --- a/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/purge-cache.sh +++ b/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/purge-cache.sh @@ -1,5 +1,4 @@ #!/usr/bin/env bash -#!/usr/bin/env bash ## # Acquia Cloud hook: Purge edge cache in an environment. # @@ -21,6 +20,6 @@ export VORTEX_ACQUIA_APP_NAME="${VORTEX_ACQUIA_APP_NAME:-${site}}" export VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV="${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV:-${target_env}}" export VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE="${VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE:-"/var/www/html/${site}.${target_env}/hooks/library/domains.txt"}" -./vendor/drevops/vortex-tooling/src/task-purge-cache-acquia +./vendor/drevops/vortex-tooling/src/task purge-cache-acquia popd >/dev/null || exit 1 From 0b50362b5da6c6a25711fbbab3cbfd2cadd10d30 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Thu, 25 Jun 2026 13:42:49 +1000 Subject: [PATCH 3/6] [#2719] Validated task sibling script is executable before dispatch. --- .vortex/tooling/src/task | 4 +++- .vortex/tooling/tests/unit/task.bats | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.vortex/tooling/src/task b/.vortex/tooling/src/task index 3a7340aba..28d1f2f58 100755 --- a/.vortex/tooling/src/task +++ b/.vortex/tooling/src/task @@ -19,7 +19,9 @@ shift case "${command}" in copy-db-acquia | copy-files-acquia | purge-cache-acquia) - "$(dirname "${BASH_SOURCE[0]}")/task-${command}" "$@" + task_script="$(dirname "${BASH_SOURCE[0]}")/task-${command}" + [ ! -x "${task_script}" ] && fail "Task script '${task_script}' is missing or not executable." && exit 1 + "${task_script}" "$@" ;; *) fail "Unsupported task command '${command}' provided." diff --git a/.vortex/tooling/tests/unit/task.bats b/.vortex/tooling/tests/unit/task.bats index 7d6b1367c..065494418 100644 --- a/.vortex/tooling/tests/unit/task.bats +++ b/.vortex/tooling/tests/unit/task.bats @@ -30,6 +30,17 @@ load ../_helper.bash popd >/dev/null || exit 1 } +@test "Task: missing sibling script" { + pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + + chmod -x ./.vortex/tooling/src/task-copy-db-acquia + run ./.vortex/tooling/src/task copy-db-acquia + assert_failure + assert_output_contains "is missing or not executable." + + popd >/dev/null || exit 1 +} + @test "Task: dispatches copy-db-acquia" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 From 3bf55dc90adcd071603a2fdbc69b1179d252e0a0 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Thu, 25 Jun 2026 14:04:24 +1000 Subject: [PATCH 4/6] [#2719] Made the 'task' router platform-agnostic with 'VORTEX_PLATFORM'. --- .vortex/docs/content/hosting/acquia.mdx | 28 ++++++++++ .vortex/tooling/src/task | 35 ++++++++----- .vortex/tooling/tests/unit/task.bats | 68 ++++++++++++++++++------- hooks/library/copy-db.sh | 3 +- hooks/library/copy-files.sh | 3 +- hooks/library/purge-cache.sh | 3 +- 6 files changed, 105 insertions(+), 35 deletions(-) diff --git a/.vortex/docs/content/hosting/acquia.mdx b/.vortex/docs/content/hosting/acquia.mdx index 64de84b9a..0b601c599 100644 --- a/.vortex/docs/content/hosting/acquia.mdx +++ b/.vortex/docs/content/hosting/acquia.mdx @@ -84,3 +84,31 @@ or CI builds: ```shell ahoy download-db ``` + +### Run a hosting task + +Copying databases or files between environments and purging the edge cache run +through a single, platform-agnostic task runner that dispatches each operation +to the implementation for the configured hosting platform: + +```shell +./vendor/drevops/vortex-tooling/src/task +``` + +| Operation | Description | +|---------------|----------------------------------------| +| `copy-db` | Copy the database between environments | +| `copy-files` | Copy files between environments | +| `purge-cache` | Purge the edge (Varnish) cache | + +The platform is read from `VORTEX_PLATFORM`, or from `VORTEX_TASK_PLATFORM` to +override a single task. The Acquia deployment hooks export `VORTEX_PLATFORM` +themselves; set it yourself when running an operation manually - for example, +from your local machine: + +```shell +VORTEX_PLATFORM=acquia ./vendor/drevops/vortex-tooling/src/task copy-db +``` + +Each operation reads its configuration - application name, API credentials, and +source and destination environments - from your `.env` and `.env.local` files. diff --git a/.vortex/tooling/src/task b/.vortex/tooling/src/task index 28d1f2f58..fe8c91e8d 100755 --- a/.vortex/tooling/src/task +++ b/.vortex/tooling/src/task @@ -1,30 +1,37 @@ #!/usr/bin/env bash ## -# Run a task. +# Run a hosting task. # -# This is a router script to call the relevant task script based on the command. +# This is a router script that dispatches a platform-agnostic operation to the +# implementation for the configured hosting platform: 'task [args...]' +# runs the 'task--' sibling script. +# +# The platform is read from VORTEX_TASK_PLATFORM, falling back to VORTEX_PLATFORM. # # shellcheck disable=SC1090,SC1091 set -eu [ "${VORTEX_DEBUG-}" = "1" ] && set -x +# Hosting platform to run the operation for. +VORTEX_TASK_PLATFORM="${VORTEX_TASK_PLATFORM:-${VORTEX_PLATFORM:-}}" + # @formatter:off fail() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[31m[FAIL] %s\033[0m\n" "${1}" || printf "[FAIL] %s\n" "${1}"; } # @formatter:on -command="${1:-}" -[ -z "${command}" ] && fail "Missing task command." && exit 1 +operation="${1:-}" +[ -z "${operation}" ] && fail "Missing task operation." && exit 1 shift -case "${command}" in - copy-db-acquia | copy-files-acquia | purge-cache-acquia) - task_script="$(dirname "${BASH_SOURCE[0]}")/task-${command}" - [ ! -x "${task_script}" ] && fail "Task script '${task_script}' is missing or not executable." && exit 1 - "${task_script}" "$@" - ;; - *) - fail "Unsupported task command '${command}' provided." - exit 1 - ;; +case "${operation}" in + copy-db | copy-files | purge-cache) ;; + *) fail "Unsupported task operation '${operation}'." && exit 1 ;; esac + +[ -z "${VORTEX_TASK_PLATFORM}" ] && fail "Missing hosting platform. Set VORTEX_PLATFORM or VORTEX_TASK_PLATFORM." && exit 1 + +task_script="$(dirname "${BASH_SOURCE[0]}")/task-${operation}-${VORTEX_TASK_PLATFORM}" +[ ! -x "${task_script}" ] && fail "Operation '${operation}' is not supported on the '${VORTEX_TASK_PLATFORM}' platform." && exit 1 + +"${task_script}" "$@" diff --git a/.vortex/tooling/tests/unit/task.bats b/.vortex/tooling/tests/unit/task.bats index 065494418..873367e81 100644 --- a/.vortex/tooling/tests/unit/task.bats +++ b/.vortex/tooling/tests/unit/task.bats @@ -2,71 +2,103 @@ ## # Unit tests for the task router. # -# The task-specific logic lives in the dispatched sibling scripts -# (task-copy-db-acquia, task-copy-files-acquia, task-purge-cache-acquia); these -# tests cover only the router's command resolution and error handling. +# The router resolves a platform-agnostic operation to the +# 'task--' sibling that implements it; these tests cover +# operation validation, platform resolution, and dispatch. The +# operation-specific logic is owned by the sibling scripts. # #shellcheck disable=SC2030,SC2031,SC2034 load ../_helper.bash -@test "Task: missing command" { +@test "Task: missing operation" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 run ./.vortex/tooling/src/task assert_failure - assert_output_contains "Missing task command." + assert_output_contains "Missing task operation." popd >/dev/null || exit 1 } -@test "Task: unsupported command" { +@test "Task: unsupported operation" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 - run ./.vortex/tooling/src/task invalid-command + run ./.vortex/tooling/src/task invalid-operation assert_failure - assert_output_contains "Unsupported task command 'invalid-command' provided." + assert_output_contains "Unsupported task operation 'invalid-operation'." popd >/dev/null || exit 1 } -@test "Task: missing sibling script" { +@test "Task: missing platform" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 - chmod -x ./.vortex/tooling/src/task-copy-db-acquia - run ./.vortex/tooling/src/task copy-db-acquia + unset VORTEX_TASK_PLATFORM + unset VORTEX_PLATFORM + run ./.vortex/tooling/src/task copy-db assert_failure - assert_output_contains "is missing or not executable." + assert_output_contains "Missing hosting platform. Set VORTEX_PLATFORM or VORTEX_TASK_PLATFORM." popd >/dev/null || exit 1 } -@test "Task: dispatches copy-db-acquia" { +@test "Task: operation not supported on platform" { + pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + + # Lagoon has no copy-db implementation, so the sibling resolution fails. + unset VORTEX_TASK_PLATFORM + export VORTEX_PLATFORM=lagoon + run ./.vortex/tooling/src/task copy-db + assert_failure + assert_output_contains "Operation 'copy-db' is not supported on the 'lagoon' platform." + + popd >/dev/null || exit 1 +} + +@test "Task: platform from VORTEX_PLATFORM dispatches copy-db" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 # Without credentials the sibling prints its banner and then fails on the # missing-key guard before any network call, which proves the routing. - run ./.vortex/tooling/src/task copy-db-acquia + unset VORTEX_TASK_PLATFORM + export VORTEX_PLATFORM=acquia + run ./.vortex/tooling/src/task copy-db + assert_failure + assert_output_contains "Started database copying between environments in Acquia." + + popd >/dev/null || exit 1 +} + +@test "Task: VORTEX_TASK_PLATFORM overrides VORTEX_PLATFORM" { + pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + + export VORTEX_PLATFORM=lagoon + export VORTEX_TASK_PLATFORM=acquia + run ./.vortex/tooling/src/task copy-db assert_failure assert_output_contains "Started database copying between environments in Acquia." popd >/dev/null || exit 1 } -@test "Task: dispatches copy-files-acquia" { +@test "Task: platform override dispatches copy-files" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 - run ./.vortex/tooling/src/task copy-files-acquia + export VORTEX_TASK_PLATFORM=acquia + run ./.vortex/tooling/src/task copy-files assert_failure assert_output_contains "Started files copying between environments in Acquia." popd >/dev/null || exit 1 } -@test "Task: dispatches purge-cache-acquia" { +@test "Task: platform from VORTEX_PLATFORM dispatches purge-cache" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 - run ./.vortex/tooling/src/task purge-cache-acquia + unset VORTEX_TASK_PLATFORM + export VORTEX_PLATFORM=acquia + run ./.vortex/tooling/src/task purge-cache assert_failure assert_output_contains "Started cache purging in Acquia." diff --git a/hooks/library/copy-db.sh b/hooks/library/copy-db.sh index ccca16e2d..ea006da1c 100755 --- a/hooks/library/copy-db.sh +++ b/hooks/library/copy-db.sh @@ -14,6 +14,7 @@ pushd "/var/www/html/${site}.${target_env}" >/dev/null || exit 1 [ "${VORTEX_TASK_COPY_DB_ACQUIA_SKIP}" = "1" ] && echo "Skipping copying of database between Acquia environments." && exit 0 +export VORTEX_PLATFORM=acquia export VORTEX_ACQUIA_KEY="${VORTEX_ACQUIA_KEY?not set}" export VORTEX_ACQUIA_SECRET="${VORTEX_ACQUIA_SECRET?not set}" export VORTEX_ACQUIA_APP_NAME="${VORTEX_ACQUIA_APP_NAME:-${site}}" @@ -21,6 +22,6 @@ export VORTEX_TASK_COPY_DB_ACQUIA_SRC="${VORTEX_TASK_COPY_DB_ACQUIA_SRC:-prod}" export VORTEX_TASK_COPY_DB_ACQUIA_DST="${VORTEX_TASK_COPY_DB_ACQUIA_DST:-${target_env}}" export VORTEX_TASK_COPY_DB_ACQUIA_NAME="${VORTEX_TASK_COPY_DB_ACQUIA_NAME?not set}" -./vendor/drevops/vortex-tooling/src/task copy-db-acquia +./vendor/drevops/vortex-tooling/src/task copy-db popd >/dev/null || exit 1 diff --git a/hooks/library/copy-files.sh b/hooks/library/copy-files.sh index 24297b90e..c718cf166 100755 --- a/hooks/library/copy-files.sh +++ b/hooks/library/copy-files.sh @@ -14,12 +14,13 @@ pushd "/var/www/html/${site}.${target_env}" >/dev/null || exit 1 [ "${VORTEX_TASK_COPY_FILES_ACQUIA_SKIP}" = "1" ] && echo "Skipping copying of files between Acquia environments." && exit 0 +export VORTEX_PLATFORM=acquia export VORTEX_ACQUIA_KEY="${VORTEX_ACQUIA_KEY?not set}" export VORTEX_ACQUIA_SECRET="${VORTEX_ACQUIA_SECRET?not set}" export VORTEX_ACQUIA_APP_NAME="${VORTEX_ACQUIA_APP_NAME:-${site}}" export VORTEX_TASK_COPY_FILES_ACQUIA_SRC="${VORTEX_TASK_COPY_FILES_ACQUIA_SRC:-prod}" export VORTEX_TASK_COPY_FILES_ACQUIA_DST="${VORTEX_TASK_COPY_FILES_ACQUIA_DST:-${target_env}}" -./vendor/drevops/vortex-tooling/src/task copy-files-acquia +./vendor/drevops/vortex-tooling/src/task copy-files popd >/dev/null || exit 1 diff --git a/hooks/library/purge-cache.sh b/hooks/library/purge-cache.sh index 460df730e..71e693ab7 100755 --- a/hooks/library/purge-cache.sh +++ b/hooks/library/purge-cache.sh @@ -14,12 +14,13 @@ pushd "/var/www/html/${site}.${target_env}" >/dev/null || exit 1 [ "${VORTEX_PURGE_CACHE_ACQUIA_SKIP}" = "1" ] && echo "Skipping purging of cache in Acquia environment." && exit 0 +export VORTEX_PLATFORM=acquia export VORTEX_ACQUIA_KEY="${VORTEX_ACQUIA_KEY?not set}" export VORTEX_ACQUIA_SECRET="${VORTEX_ACQUIA_SECRET?not set}" export VORTEX_ACQUIA_APP_NAME="${VORTEX_ACQUIA_APP_NAME:-${site}}" export VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV="${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV:-${target_env}}" export VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE="${VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE:-"/var/www/html/${site}.${target_env}/hooks/library/domains.txt"}" -./vendor/drevops/vortex-tooling/src/task purge-cache-acquia +./vendor/drevops/vortex-tooling/src/task purge-cache popd >/dev/null || exit 1 From f1c0fad3adfe9f9f3a68ffd6f98ff5eb82e79dcb Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Thu, 25 Jun 2026 14:07:25 +1000 Subject: [PATCH 5/6] Updated snapshots. --- .../handler_process/hosting_acquia/hooks/library/copy-db.sh | 3 ++- .../handler_process/hosting_acquia/hooks/library/copy-files.sh | 3 ++- .../hosting_acquia/hooks/library/purge-cache.sh | 3 ++- .../hosting_project_name___acquia/hooks/library/copy-db.sh | 3 ++- .../hosting_project_name___acquia/hooks/library/copy-files.sh | 3 ++- .../hosting_project_name___acquia/hooks/library/purge-cache.sh | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/copy-db.sh b/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/copy-db.sh index ccca16e2d..ea006da1c 100755 --- a/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/copy-db.sh +++ b/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/copy-db.sh @@ -14,6 +14,7 @@ pushd "/var/www/html/${site}.${target_env}" >/dev/null || exit 1 [ "${VORTEX_TASK_COPY_DB_ACQUIA_SKIP}" = "1" ] && echo "Skipping copying of database between Acquia environments." && exit 0 +export VORTEX_PLATFORM=acquia export VORTEX_ACQUIA_KEY="${VORTEX_ACQUIA_KEY?not set}" export VORTEX_ACQUIA_SECRET="${VORTEX_ACQUIA_SECRET?not set}" export VORTEX_ACQUIA_APP_NAME="${VORTEX_ACQUIA_APP_NAME:-${site}}" @@ -21,6 +22,6 @@ export VORTEX_TASK_COPY_DB_ACQUIA_SRC="${VORTEX_TASK_COPY_DB_ACQUIA_SRC:-prod}" export VORTEX_TASK_COPY_DB_ACQUIA_DST="${VORTEX_TASK_COPY_DB_ACQUIA_DST:-${target_env}}" export VORTEX_TASK_COPY_DB_ACQUIA_NAME="${VORTEX_TASK_COPY_DB_ACQUIA_NAME?not set}" -./vendor/drevops/vortex-tooling/src/task copy-db-acquia +./vendor/drevops/vortex-tooling/src/task copy-db popd >/dev/null || exit 1 diff --git a/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/copy-files.sh b/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/copy-files.sh index 24297b90e..c718cf166 100755 --- a/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/copy-files.sh +++ b/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/copy-files.sh @@ -14,12 +14,13 @@ pushd "/var/www/html/${site}.${target_env}" >/dev/null || exit 1 [ "${VORTEX_TASK_COPY_FILES_ACQUIA_SKIP}" = "1" ] && echo "Skipping copying of files between Acquia environments." && exit 0 +export VORTEX_PLATFORM=acquia export VORTEX_ACQUIA_KEY="${VORTEX_ACQUIA_KEY?not set}" export VORTEX_ACQUIA_SECRET="${VORTEX_ACQUIA_SECRET?not set}" export VORTEX_ACQUIA_APP_NAME="${VORTEX_ACQUIA_APP_NAME:-${site}}" export VORTEX_TASK_COPY_FILES_ACQUIA_SRC="${VORTEX_TASK_COPY_FILES_ACQUIA_SRC:-prod}" export VORTEX_TASK_COPY_FILES_ACQUIA_DST="${VORTEX_TASK_COPY_FILES_ACQUIA_DST:-${target_env}}" -./vendor/drevops/vortex-tooling/src/task copy-files-acquia +./vendor/drevops/vortex-tooling/src/task copy-files popd >/dev/null || exit 1 diff --git a/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/purge-cache.sh b/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/purge-cache.sh index 460df730e..71e693ab7 100755 --- a/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/purge-cache.sh +++ b/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/purge-cache.sh @@ -14,12 +14,13 @@ pushd "/var/www/html/${site}.${target_env}" >/dev/null || exit 1 [ "${VORTEX_PURGE_CACHE_ACQUIA_SKIP}" = "1" ] && echo "Skipping purging of cache in Acquia environment." && exit 0 +export VORTEX_PLATFORM=acquia export VORTEX_ACQUIA_KEY="${VORTEX_ACQUIA_KEY?not set}" export VORTEX_ACQUIA_SECRET="${VORTEX_ACQUIA_SECRET?not set}" export VORTEX_ACQUIA_APP_NAME="${VORTEX_ACQUIA_APP_NAME:-${site}}" export VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV="${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV:-${target_env}}" export VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE="${VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE:-"/var/www/html/${site}.${target_env}/hooks/library/domains.txt"}" -./vendor/drevops/vortex-tooling/src/task purge-cache-acquia +./vendor/drevops/vortex-tooling/src/task purge-cache popd >/dev/null || exit 1 diff --git a/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/copy-db.sh b/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/copy-db.sh index ccca16e2d..ea006da1c 100755 --- a/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/copy-db.sh +++ b/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/copy-db.sh @@ -14,6 +14,7 @@ pushd "/var/www/html/${site}.${target_env}" >/dev/null || exit 1 [ "${VORTEX_TASK_COPY_DB_ACQUIA_SKIP}" = "1" ] && echo "Skipping copying of database between Acquia environments." && exit 0 +export VORTEX_PLATFORM=acquia export VORTEX_ACQUIA_KEY="${VORTEX_ACQUIA_KEY?not set}" export VORTEX_ACQUIA_SECRET="${VORTEX_ACQUIA_SECRET?not set}" export VORTEX_ACQUIA_APP_NAME="${VORTEX_ACQUIA_APP_NAME:-${site}}" @@ -21,6 +22,6 @@ export VORTEX_TASK_COPY_DB_ACQUIA_SRC="${VORTEX_TASK_COPY_DB_ACQUIA_SRC:-prod}" export VORTEX_TASK_COPY_DB_ACQUIA_DST="${VORTEX_TASK_COPY_DB_ACQUIA_DST:-${target_env}}" export VORTEX_TASK_COPY_DB_ACQUIA_NAME="${VORTEX_TASK_COPY_DB_ACQUIA_NAME?not set}" -./vendor/drevops/vortex-tooling/src/task copy-db-acquia +./vendor/drevops/vortex-tooling/src/task copy-db popd >/dev/null || exit 1 diff --git a/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/copy-files.sh b/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/copy-files.sh index 24297b90e..c718cf166 100755 --- a/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/copy-files.sh +++ b/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/copy-files.sh @@ -14,12 +14,13 @@ pushd "/var/www/html/${site}.${target_env}" >/dev/null || exit 1 [ "${VORTEX_TASK_COPY_FILES_ACQUIA_SKIP}" = "1" ] && echo "Skipping copying of files between Acquia environments." && exit 0 +export VORTEX_PLATFORM=acquia export VORTEX_ACQUIA_KEY="${VORTEX_ACQUIA_KEY?not set}" export VORTEX_ACQUIA_SECRET="${VORTEX_ACQUIA_SECRET?not set}" export VORTEX_ACQUIA_APP_NAME="${VORTEX_ACQUIA_APP_NAME:-${site}}" export VORTEX_TASK_COPY_FILES_ACQUIA_SRC="${VORTEX_TASK_COPY_FILES_ACQUIA_SRC:-prod}" export VORTEX_TASK_COPY_FILES_ACQUIA_DST="${VORTEX_TASK_COPY_FILES_ACQUIA_DST:-${target_env}}" -./vendor/drevops/vortex-tooling/src/task copy-files-acquia +./vendor/drevops/vortex-tooling/src/task copy-files popd >/dev/null || exit 1 diff --git a/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/purge-cache.sh b/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/purge-cache.sh index 460df730e..71e693ab7 100755 --- a/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/purge-cache.sh +++ b/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/purge-cache.sh @@ -14,12 +14,13 @@ pushd "/var/www/html/${site}.${target_env}" >/dev/null || exit 1 [ "${VORTEX_PURGE_CACHE_ACQUIA_SKIP}" = "1" ] && echo "Skipping purging of cache in Acquia environment." && exit 0 +export VORTEX_PLATFORM=acquia export VORTEX_ACQUIA_KEY="${VORTEX_ACQUIA_KEY?not set}" export VORTEX_ACQUIA_SECRET="${VORTEX_ACQUIA_SECRET?not set}" export VORTEX_ACQUIA_APP_NAME="${VORTEX_ACQUIA_APP_NAME:-${site}}" export VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV="${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV:-${target_env}}" export VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE="${VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE:-"/var/www/html/${site}.${target_env}/hooks/library/domains.txt"}" -./vendor/drevops/vortex-tooling/src/task purge-cache-acquia +./vendor/drevops/vortex-tooling/src/task purge-cache popd >/dev/null || exit 1 From a7c25e27f4a9287feb100864f668aa2c044f6e36 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Thu, 25 Jun 2026 14:14:17 +1000 Subject: [PATCH 6/6] [#2719] Validated hosting platform before resolving the task script. --- .vortex/tooling/src/task | 5 +++++ .vortex/tooling/tests/unit/task.bats | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/.vortex/tooling/src/task b/.vortex/tooling/src/task index fe8c91e8d..930477e44 100755 --- a/.vortex/tooling/src/task +++ b/.vortex/tooling/src/task @@ -31,6 +31,11 @@ esac [ -z "${VORTEX_TASK_PLATFORM}" ] && fail "Missing hosting platform. Set VORTEX_PLATFORM or VORTEX_TASK_PLATFORM." && exit 1 +case "${VORTEX_TASK_PLATFORM}" in + acquia | lagoon) ;; + *) fail "Unsupported hosting platform '${VORTEX_TASK_PLATFORM}'." && exit 1 ;; +esac + task_script="$(dirname "${BASH_SOURCE[0]}")/task-${operation}-${VORTEX_TASK_PLATFORM}" [ ! -x "${task_script}" ] && fail "Operation '${operation}' is not supported on the '${VORTEX_TASK_PLATFORM}' platform." && exit 1 diff --git a/.vortex/tooling/tests/unit/task.bats b/.vortex/tooling/tests/unit/task.bats index 873367e81..3c45fb7fc 100644 --- a/.vortex/tooling/tests/unit/task.bats +++ b/.vortex/tooling/tests/unit/task.bats @@ -43,6 +43,18 @@ load ../_helper.bash popd >/dev/null || exit 1 } +@test "Task: unsupported platform" { + pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + + unset VORTEX_TASK_PLATFORM + export VORTEX_PLATFORM=invalid-platform + run ./.vortex/tooling/src/task copy-db + assert_failure + assert_output_contains "Unsupported hosting platform 'invalid-platform'." + + popd >/dev/null || exit 1 +} + @test "Task: operation not supported on platform" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1