From fb281680cd64f3f9d3225331e5d1bb6d997f9968 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Fri, 30 Oct 2026 10:30:32 +1100 Subject: [PATCH 1/6] [#3250] Purged every domain attached to the Acquia environment and skipped missing listed domains without stopping. --- .../docs/content/development/variables.mdx | 2 +- .vortex/docs/content/hosting/acquia.mdx | 17 +- .../src/vortex-task-purge-cache-acquia | 121 ++++-- .../tests/unit/task-purge-cache-acquia.bats | 387 ++++++++++++++---- hooks/library/domains.txt | 1 - 5 files changed, 405 insertions(+), 123 deletions(-) delete mode 100644 hooks/library/domains.txt diff --git a/.vortex/docs/content/development/variables.mdx b/.vortex/docs/content/development/variables.mdx index e20e7ddd79..43e8242269 100644 --- a/.vortex/docs/content/development/variables.mdx +++ b/.vortex/docs/content/development/variables.mdx @@ -576,7 +576,7 @@ The list below is automatically generated with [Shellvar](https://github.com/ale | `VORTEX_TASK_CUSTOM_LAGOON_SSH_FINGERPRINT` | SSH key fingerprint used to connect to a remote. | `UNDEFINED` | `.vortex/tooling/src/vortex-task-custom-lagoon` | | `VORTEX_TASK_PLATFORM` | Hosting platform to run the operation for. | `${VORTEX_PLATFORM}` | `.vortex/tooling/src/vortex-task` | | `VORTEX_TASK_PURGE_CACHE_ACQUIA_APP_NAME` | Application name. Used to discover UUID. | `${VORTEX_ACQUIA_APP_NAME}` | `.vortex/tooling/src/vortex-task-purge-cache-acquia` | -| `VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE` | File with a list of domains that should be purged. | `domains.txt` | `.vortex/tooling/src/vortex-task-purge-cache-acquia` | +| `VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE` | File with a list of domains to limit the purge to.

When the file does not exist, all domains attached to the environment are purged. | `domains.txt` | `.vortex/tooling/src/vortex-task-purge-cache-acquia` | | `VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV` | An environment name to purge cache for. | `UNDEFINED` | `.vortex/tooling/src/vortex-task-purge-cache-acquia` | | `VORTEX_TASK_PURGE_CACHE_ACQUIA_KEY` | Acquia Cloud API key. | `${VORTEX_ACQUIA_KEY}` | `.vortex/tooling/src/vortex-task-purge-cache-acquia` | | `VORTEX_TASK_PURGE_CACHE_ACQUIA_SECRET` | Acquia Cloud API secret. | `${VORTEX_ACQUIA_SECRET}` | `.vortex/tooling/src/vortex-task-purge-cache-acquia` | diff --git a/.vortex/docs/content/hosting/acquia.mdx b/.vortex/docs/content/hosting/acquia.mdx index 14ade92717..15154adb69 100644 --- a/.vortex/docs/content/hosting/acquia.mdx +++ b/.vortex/docs/content/hosting/acquia.mdx @@ -95,13 +95,11 @@ blank field in the Acquia UI counts as empty. `purge-cache.sh` and both copy hooks require `VORTEX_ACQUIA_KEY` and `VORTEX_ACQUIA_SECRET`, so set both in the Acquia UI before the first deployment. -`purge-cache.sh` purges the domains listed in `hooks/library/domains.txt`. -The installer writes your domain there as `$TARGET_ENV_REMAP.`. Add -a line for every other domain the site serves. - -`$TARGET_ENV_REMAP` expands to `dev` on `dev`, `stage` on `test` and -`test2` on `test2`. On `prod`, the prefix and its dot are removed. Any -other environment, including on-demand ones, purges nothing. +`purge-cache.sh` purges every domain attached to the environment, on-demand +environments included. It reads the list from the Acquia Cloud API, so it +covers the Acquia domain and every custom domain or sub-domain. It skips +wildcard domains such as `*.example.com`. Each purge clears Varnish and the +Platform CDN when it's enabled. `notify-deployment.sh` builds the notification URL from Acquia's `AH_SITE_NAME` and `AH_REALM` variables: @@ -217,10 +215,7 @@ default environments, so set them for a manual run: (the database name). - `copy-files`: `VORTEX_TASK_COPY_FILES_ACQUIA_SRC` and `VORTEX_TASK_COPY_FILES_ACQUIA_DST`. -- `purge-cache`: `VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV`, plus - `VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE` when the domain list isn't - `domains.txt` in the current directory (the hook sets it to - `hooks/library/domains.txt`). +- `purge-cache`: `VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV`. For example, to copy the production database into `dev`, run the following command from the project root: diff --git a/.vortex/tooling/src/vortex-task-purge-cache-acquia b/.vortex/tooling/src/vortex-task-purge-cache-acquia index 5d5c941f41..da9ad46f8b 100755 --- a/.vortex/tooling/src/vortex-task-purge-cache-acquia +++ b/.vortex/tooling/src/vortex-task-purge-cache-acquia @@ -9,7 +9,7 @@ # To create a Cloud API token, go to # Acquia Cloud UI -> Account -> API tokens -> Create Token # -# @see https://cloudapi-docs.acquia.com/#/Environments/postEnvironmentsDomainsClearVarnish +# @see https://cloudapi-docs.acquia.com/#/Environments/postEnvironmentsClearCaches # # shellcheck disable=SC1090,SC1091 @@ -30,7 +30,10 @@ VORTEX_TASK_PURGE_CACHE_ACQUIA_APP_NAME="${VORTEX_TASK_PURGE_CACHE_ACQUIA_APP_NA # An environment name to purge cache for. VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV="${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV:-}" -# File with a list of domains that should be purged. +# File with a list of domains to limit the purge to. +# +# When the file does not exist, all domains attached to the environment are +# purged. VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE="${VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE:-domains.txt}" # Number of status retrieval retries. If this limit reached and task has not @@ -60,6 +63,23 @@ extract_json_value() { php -r "\$data=json_decode(file_get_contents('php://stdin'), TRUE); isset(\$data[\"${key}\"]) ? print trim(json_encode(\$data[\"${key}\"], JSON_UNESCAPED_SLASHES), '\"') : exit(1);" } +# Wildcard entries are not hostnames, so the purge endpoint cannot take them. +extract_json_hostnames() { + php -r "\$data=json_decode(file_get_contents('php://stdin'), TRUE); foreach (\$data['_embedded']['items'] ?? [] as \$item) { if (!empty(\$item['hostname']) && empty(\$item['flags']['wildcard']) && strpos(\$item['hostname'], '*') === FALSE) { print \$item['hostname'] . PHP_EOL; } }" +} + +in_list() { + local needle="${1}" + shift + local item + for item in "$@"; do + if [ "${item}" = "${needle}" ]; then + return 0 + fi + done + return 1 +} + for cmd in php curl; do command -v "${cmd}" >/dev/null || fail "Command ${cmd} is not available."; done info "Started cache purging in Acquia." @@ -68,7 +88,6 @@ info "Started cache purging in Acquia." [ -z "${VORTEX_TASK_PURGE_CACHE_ACQUIA_SECRET}" ] && fail "Missing required value for VORTEX_TASK_PURGE_CACHE_ACQUIA_SECRET or VORTEX_ACQUIA_SECRET." [ -z "${VORTEX_TASK_PURGE_CACHE_ACQUIA_APP_NAME}" ] && fail "Missing required value for VORTEX_TASK_PURGE_CACHE_ACQUIA_APP_NAME or VORTEX_ACQUIA_APP_NAME." [ -z "${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV}" ] && fail "Missing required value for VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV." -[ -z "${VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE}" ] && fail "Missing required value for VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE." [ -z "${VORTEX_TASK_PURGE_CACHE_ACQUIA_STATUS_RETRIES}" ] && fail "Missing required value for VORTEX_TASK_PURGE_CACHE_ACQUIA_STATUS_RETRIES." [ -z "${VORTEX_TASK_PURGE_CACHE_ACQUIA_STATUS_INTERVAL}" ] && fail "Missing required value for VORTEX_TASK_PURGE_CACHE_ACQUIA_STATUS_INTERVAL." @@ -111,53 +130,91 @@ env_id=$(echo "${envs_json}" | extract_json_value "_embedded" | extract_json_val [ -z "${env_id}" ] && fail "Unable to retrieve environment ID for \"${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV}\". API response: ${envs_json}" pass "Retrieved environment ID." +task "Retrieving domains attached to ${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV} environment." +domains_json=$(curl -s -L -H 'Accept: application/json, version=2' -H "Authorization: Bearer ${token}" "https://cloud.acquia.com/api/environments/${env_id}/domains") +[ "${VORTEX_DEBUG-}" = "1" ] && note "Domains API response: ${domains_json}" + +if echo "${domains_json}" | grep -q '"error"'; then + fail "Unable to retrieve domains attached to ${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV} environment. API response: ${domains_json}" +fi + +env_domains=() +while IFS= read -r domain; do + if [ -n "${domain}" ]; then + env_domains+=("${domain}") + fi +done < <(echo "${domains_json}" | extract_json_hostnames) +pass "Retrieved ${#env_domains[@]} domains attached to ${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV} environment." + task "Compiling a list of domains." -target_env="${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV}" domain_list=() -while read -r domain; do - # TARGET_ENV_REMAP maps the target env to the sub-domain prefix based on - # the UI name. - TARGET_ENV_REMAP="${target_env}" - # Strip placeholder for PROD environment. - if [ "${target_env}" = "prod" ]; then - domain="${domain//\$TARGET_ENV_REMAP./}" - domain="${domain//\$TARGET_ENV./}" - fi +if [ "${#env_domains[@]}" -gt 0 ] && [ -f "${VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE}" ]; then + note "Limiting the purge to domains listed in ${VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE}." + + # Placeholders resolve to the sub-domain prefix shown in the Acquia UI. + target_env="${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV}" + target_env_remap="" + case "${target_env}" in + dev | test2) target_env_remap="${target_env}" ;; + test) target_env_remap="stage" ;; + esac + + while IFS= read -r domain || [ -n "${domain}" ]; do + domain="${domain#"${domain%%[![:space:]]*}"}" + domain="${domain%"${domain##*[![:space:]]}"}" + + if [ -z "${domain}" ] || [ "${domain:0:1}" = "#" ]; then + continue + fi - # Re-map 'test' to 'stage' as seen in UI. - if [ "${target_env}" = "test" ]; then - TARGET_ENV_REMAP=stage - fi + # Production domains carry no prefix, so the placeholder and its dot are + # removed. + if [ "${target_env}" = "prod" ]; then + domain="${domain//\$TARGET_ENV_REMAP./}" + domain="${domain//\$TARGET_ENV./}" + fi - # Disable replacement for unknown environments. - if [ "${target_env}" != "dev" ] && [ "${target_env}" != "test" ] && [ "${target_env}" != "test2" ] && [ "${target_env}" != "prod" ]; then - TARGET_ENV_REMAP="" - fi + if [[ ${domain} == *\$TARGET_ENV* ]]; then + if [ -z "${target_env_remap}" ]; then + note "Skipping domain ${domain} as its placeholder has no value for ${target_env} environment." + continue + fi + + domain="${domain//\$TARGET_ENV_REMAP/${target_env_remap}}" + domain="${domain//\$TARGET_ENV/${target_env}}" + fi + + if ! in_list "${domain}" "${env_domains[@]}"; then + note "Warning: Skipping domain ${domain} as it is not attached to ${target_env} environment." + continue + fi + + if [ "${#domain_list[@]}" -gt 0 ] && in_list "${domain}" "${domain_list[@]}"; then + continue + fi - if [ -n "${TARGET_ENV_REMAP}" ]; then - # Interpolate variables in domain name. - domain="$(eval echo "${domain}")" domain_list+=("${domain}") - fi -done <"${VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE}" + done <"${VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE}" +elif [ "${#env_domains[@]}" -gt 0 ]; then + domain_list=("${env_domains[@]}") +fi pass "Compiled a list of ${#domain_list[@]} domains." if [ "${#domain_list[@]}" -gt 0 ]; then # The Acquia API aborts a batched purge when any domain fails, so caches - # are cleared per domain and a missing domain is not a failure. + # are cleared per domain. for domain in "${domain_list[@]}"; do task "Purging cache for ${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV} environment domain ${domain}." - task_status_json=$(curl -X POST -s -L -H 'Accept: application/json, version=2' -H "Authorization: Bearer ${token}" -H "Content-Type: application/json" -d "{\"domains\":[\"${domain}\"]}" "https://cloud.acquia.com/api/environments/${env_id}/domains/actions/clear-varnish") + task_status_json=$(curl -X POST -s -L -H 'Accept: application/json, version=2' -H "Authorization: Bearer ${token}" -H "Content-Type: application/json" -d "{\"domains\":[\"${domain}\"]}" "https://cloud.acquia.com/api/environments/${env_id}/actions/clear-caches") notification_url=$(echo "${task_status_json}" | extract_json_value "_links" | extract_json_value "notification" | extract_json_value "href") || true - # A missing domain yields an empty notification URL and is skipped - # without a failure. + # A rejected purge yields an empty notification URL. if [ -z "${notification_url}" ]; then - note "Warning: Unable to purge cache for ${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV} environment domain ${domain} as it does not exist." + note "Warning: Unable to purge cache for ${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV} environment domain ${domain}. API response: ${task_status_json}" pass "Completed cache purging for ${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV} environment domain ${domain}." - break + continue fi printf " Checking task status: " diff --git a/.vortex/tooling/tests/unit/task-purge-cache-acquia.bats b/.vortex/tooling/tests/unit/task-purge-cache-acquia.bats index 16671d5791..1cc65be754 100644 --- a/.vortex/tooling/tests/unit/task-purge-cache-acquia.bats +++ b/.vortex/tooling/tests/unit/task-purge-cache-acquia.bats @@ -2,26 +2,21 @@ ## # Unit tests for the 'vortex-task-purge-cache-acquia' script. # -# shellcheck disable=SC2030,SC2031,SC2034 +# shellcheck disable=SC2030,SC2031,SC2034,SC2016 load ../_helper.bash -# Runs the task for one environment and asserts the domain it purges. -# -# The Acquia API replies without a notification link, which the task reports as -# a missing domain and skips, so the run stops before the status polling. +# Appends the steps that resolve the token, application, environment and the +# domains attached to the environment. # # Arguments: # 1. env_name: Environment to purge the cache for. -# 2. domain: Domain the placeholder is expected to resolve to. -# 3. domains_file: File to read the domain list from. Optional, defaults to -# the domain list shipped with the template. -assert_purge_domain() { +# 2. domains_json: Response of the environment domains API. +steps_lookup() { local env_name="${1}" - local domain="${2}" - local domains_file="${3:-hooks/library/domains.txt}" + local domains_json="${2}" - declare -a STEPS=( + STEPS+=( "[INFO] Started cache purging in Acquia." "Retrieving authentication token." @@ -36,51 +31,222 @@ assert_purge_domain() { "@curl -s -L -H Accept: application/json, version=2 -H Authorization: Bearer test-token https://cloud.acquia.com/api/applications/app-uuid-123/environments?filter=name%3D${env_name} # {\"_embedded\":{\"items\":[{\"id\":\"env-id-456\"}]}}" "[ OK ] Retrieved environment ID." - "Compiling a list of domains." - "[ OK ] Compiled a list of 1 domains." + "Retrieving domains attached to ${env_name} environment." + "@curl -s -L -H Accept: application/json, version=2 -H Authorization: Bearer test-token https://cloud.acquia.com/api/environments/env-id-456/domains # ${domains_json}" + ) +} + +# Appends the steps of a purge that completes for one domain. +# +# Arguments: +# 1. env_name: Environment to purge the cache for. +# 2. domain: Domain to purge. +steps_purge() { + local env_name="${1}" + local domain="${2}" + STEPS+=( "Purging cache for ${env_name} environment domain ${domain}." - "@curl -X POST -s -L -H Accept: application/json, version=2 -H Authorization: Bearer test-token -H Content-Type: application/json -d {\"domains\":[\"${domain}\"]} https://cloud.acquia.com/api/environments/env-id-456/domains/actions/clear-varnish # {}" - "Warning: Unable to purge cache for ${env_name} environment domain ${domain} as it does not exist." + "@curl -X POST -s -L -H Accept: application/json, version=2 -H Authorization: Bearer test-token -H Content-Type: application/json -d {\"domains\":[\"${domain}\"]} https://cloud.acquia.com/api/environments/env-id-456/actions/clear-caches # {\"_links\":{\"notification\":{\"href\":\"https://cloud.acquia.com/api/notifications/notif-123\"}}}" + '@curl -s -L -H Accept: application/json, version=2 -H Authorization: Bearer test-token https://cloud.acquia.com/api/notifications/notif-123 # {"status":"completed"}' + "Purged cache for ${env_name} environment domain ${domain}." "[ OK ] Completed cache purging for ${env_name} environment domain ${domain}." - - "[ OK ] Finished cache purging in Acquia." ) +} + +# Builds a domains API response from a list of hostnames. +# +# A hostname starting with '*' is flagged as a wildcard. +# +# Arguments: +# @: Hostnames attached to the environment. +domains_json() { + local items=() + local hostname + local wildcard + for hostname in "$@"; do + wildcard="false" + if [ "${hostname:0:1}" = "*" ]; then + wildcard="true" + fi + items+=("{\"hostname\":\"${hostname}\",\"flags\":{\"default\":false,\"active\":true,\"wildcard\":${wildcard}}}") + done + + local IFS="," + echo "{\"total\":${#items[@]},\"_embedded\":{\"items\":[${items[*]}]}}" +} + +# Runs the task for one environment with the steps in STEPS. +# +# Arguments: +# 1. env_name: Environment to purge the cache for. +# 2. domains_file: File to limit the purge to. Optional, the variable is left +# unset when empty so the script default applies. +run_purge() { + local env_name="${1}" + local domains_file="${2:-}" export VORTEX_TASK_PURGE_CACHE_ACQUIA_KEY="test-key" export VORTEX_TASK_PURGE_CACHE_ACQUIA_SECRET="test-secret" export VORTEX_TASK_PURGE_CACHE_ACQUIA_APP_NAME="testapp" export VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV="${env_name}" - export VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE="${domains_file}" + export VORTEX_TASK_PURGE_CACHE_ACQUIA_STATUS_RETRIES="1" + export VORTEX_TASK_PURGE_CACHE_ACQUIA_STATUS_INTERVAL="0" + + unset VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE + if [ -n "${domains_file}" ]; then + export VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE="${domains_file}" + fi mocks="$(steps_run "setup")" run .vortex/tooling/src/vortex-task-purge-cache-acquia steps_run "assert" "${mocks[@]}" +} + +# Asserts that a placeholder in the domains file resolves to the domain the +# environment has attached. +# +# Arguments: +# 1. env_name: Environment to purge the cache for. +# 2. line: Line written to the domains file. +# 3. domain: Domain the line is expected to resolve to. +assert_placeholder() { + local env_name="${1}" + local line="${2}" + local domain="${3}" + + echo "${line}" >domains-placeholder.txt + + declare -a STEPS=() + steps_lookup "${env_name}" "$(domains_json "${domain}" "other.example.com")" + STEPS+=( + "[ OK ] Retrieved 2 domains attached to ${env_name} environment." + "Compiling a list of domains." + "Limiting the purge to domains listed in domains-placeholder.txt." + "[ OK ] Compiled a list of 1 domains." + ) + steps_purge "${env_name}" "${domain}" + STEPS+=( + "- Purging cache for ${env_name} environment domain other.example.com." + "[ OK ] Finished cache purging in Acquia." + ) + + run_purge "${env_name}" "domains-placeholder.txt" assert_success } -@test "task-purge-cache-acquia: prod strips the placeholder from the shipped domain list" { +@test "task-purge-cache-acquia: purges every domain attached to the environment" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 - assert_purge_domain "prod" "your-site-domain.example" + declare -a STEPS=() + steps_lookup "dev" "$(domains_json "sitedev.prod.acquia-sites.com" "dev.example.com" "*.example.com")" + STEPS+=( + "[ OK ] Retrieved 2 domains attached to dev environment." + "Compiling a list of domains." + "- Limiting the purge to domains listed in" + "[ OK ] Compiled a list of 2 domains." + ) + steps_purge "dev" "sitedev.prod.acquia-sites.com" + steps_purge "dev" "dev.example.com" + STEPS+=( + "- *.example.com" + "[ OK ] Finished cache purging in Acquia." + ) + + run_purge "dev" - # A placeholder that survives the strip is interpolated into the environment - # name, which is the prefix production must not carry. - assert_output_not_contains "prod.your-site-domain.example" + assert_success popd >/dev/null || exit 1 } -@test "task-purge-cache-acquia: prod strips the legacy placeholder" { +@test "task-purge-cache-acquia: purges every domain attached to an on-demand environment" { + pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + + declare -a STEPS=() + steps_lookup "ode1" "$(domains_json "siteode1.prod.acquia-sites.com")" + STEPS+=( + "[ OK ] Retrieved 1 domains attached to ode1 environment." + "[ OK ] Compiled a list of 1 domains." + ) + steps_purge "ode1" "siteode1.prod.acquia-sites.com" + STEPS+=( + "[ OK ] Finished cache purging in Acquia." + ) + + run_purge "ode1" + + assert_success + + popd >/dev/null || exit 1 +} + +@test "task-purge-cache-acquia: skips a listed domain that is not attached and purges the rest" { + pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + + printf "dev.example.com\ndev.missing.example\nsitedev.prod.acquia-sites.com\n" >domains-list.txt + + declare -a STEPS=() + steps_lookup "dev" "$(domains_json "sitedev.prod.acquia-sites.com" "dev.example.com" "dev.other.example")" + STEPS+=( + "[ OK ] Retrieved 3 domains attached to dev environment." + "Limiting the purge to domains listed in domains-list.txt." + "Warning: Skipping domain dev.missing.example as it is not attached to dev environment." + "[ OK ] Compiled a list of 2 domains." + ) + steps_purge "dev" "dev.example.com" + steps_purge "dev" "sitedev.prod.acquia-sites.com" + STEPS+=( + "- Purging cache for dev environment domain dev.missing.example." + "- Purging cache for dev environment domain dev.other.example." + "[ OK ] Finished cache purging in Acquia." + ) + + run_purge "dev" "domains-list.txt" + + assert_success + + popd >/dev/null || exit 1 +} + +@test "task-purge-cache-acquia: ignores blank lines, comments, whitespace and duplicates in the domains file" { + pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + + # The last line has no trailing newline. + printf "# Domains to purge.\n\n dev.example.com \ndev.example.com\n\$TARGET_ENV_REMAP.example.com" >domains-format.txt + + declare -a STEPS=() + steps_lookup "dev" "$(domains_json "dev.example.com")" + STEPS+=( + "[ OK ] Retrieved 1 domains attached to dev environment." + "- Warning: Skipping domain" + "[ OK ] Compiled a list of 1 domains." + ) + steps_purge "dev" "dev.example.com" + STEPS+=( + "[ OK ] Finished cache purging in Acquia." + ) + + run_purge "dev" "domains-format.txt" + + assert_success + + popd >/dev/null || exit 1 +} + +@test "task-purge-cache-acquia: prod strips the placeholder" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 - # shellcheck disable=SC2016 - echo '$TARGET_ENV.your-site-domain.example' >domains-legacy.txt + assert_placeholder "prod" '$TARGET_ENV_REMAP.example.com' "example.com" - assert_purge_domain "prod" "your-site-domain.example" "domains-legacy.txt" + popd >/dev/null || exit 1 +} - assert_output_not_contains "prod.your-site-domain.example" +@test "task-purge-cache-acquia: prod strips the legacy placeholder" { + pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + + assert_placeholder "prod" '$TARGET_ENV.example.com' "example.com" popd >/dev/null || exit 1 } @@ -88,7 +254,7 @@ assert_purge_domain() { @test "task-purge-cache-acquia: dev prefixes the domain with the environment name" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 - assert_purge_domain "dev" "dev.your-site-domain.example" + assert_placeholder "dev" '$TARGET_ENV_REMAP.example.com' "dev.example.com" popd >/dev/null || exit 1 } @@ -96,7 +262,15 @@ assert_purge_domain() { @test "task-purge-cache-acquia: test prefixes the domain with the stage name used in the UI" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 - assert_purge_domain "test" "stage.your-site-domain.example" + assert_placeholder "test" '$TARGET_ENV_REMAP.example.com' "stage.example.com" + + popd >/dev/null || exit 1 +} + +@test "task-purge-cache-acquia: test resolves the legacy placeholder to the environment name" { + pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + + assert_placeholder "test" '$TARGET_ENV.example.com' "test.example.com" popd >/dev/null || exit 1 } @@ -104,88 +278,145 @@ assert_purge_domain() { @test "task-purge-cache-acquia: test2 prefixes the domain with the environment name" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 - assert_purge_domain "test2" "test2.your-site-domain.example" + assert_placeholder "test2" '$TARGET_ENV_REMAP.example.com' "test2.example.com" popd >/dev/null || exit 1 } -@test "task-purge-cache-acquia: unknown environment compiles no domains" { +@test "task-purge-cache-acquia: does not evaluate the domains file" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 - declare -a STEPS=( - "[INFO] Started cache purging in Acquia." + printf '$(touch evaluated.txt)dev.example.com\ndev.example.com\n' >domains-eval.txt - "Retrieving authentication token." - '@curl -s -L https://accounts.acquia.com/api/auth/oauth/token --data-urlencode client_id=test-key --data-urlencode client_secret=test-secret --data-urlencode grant_type=client_credentials # {"access_token":"test-token"}' + declare -a STEPS=() + steps_lookup "dev" "$(domains_json "dev.example.com")" + STEPS+=( + 'Warning: Skipping domain $(touch evaluated.txt)dev.example.com as it is not attached to dev environment.' + "[ OK ] Compiled a list of 1 domains." + ) + steps_purge "dev" "dev.example.com" - "Retrieving testapp application UUID." - '@curl -s -L -H Accept: application/json, version=2 -H Authorization: Bearer test-token https://cloud.acquia.com/api/applications?filter=name%3Dtestapp # {"_embedded":{"items":[{"uuid":"app-uuid-123"}]}}' + run_purge "dev" "domains-eval.txt" - "Retrieving environment ID." - '@curl -s -L -H Accept: application/json, version=2 -H Authorization: Bearer test-token https://cloud.acquia.com/api/applications/app-uuid-123/environments?filter=name%3Dunknownenv # {"_embedded":{"items":[{"id":"env-id-456"}]}}' + assert_success + assert_file_not_exists "evaluated.txt" - "[ OK ] Compiled a list of 0 domains." - "Unable to find domains to purge cache for unknownenv environment." + popd >/dev/null || exit 1 +} +@test "task-purge-cache-acquia: unknown environment skips placeholder lines and keeps plain domains" { + pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + + printf '$TARGET_ENV_REMAP.example.com\node1.example.com\n' >domains-unknown.txt + + declare -a STEPS=() + steps_lookup "ode1" "$(domains_json "siteode1.prod.acquia-sites.com" "ode1.example.com")" + STEPS+=( + 'Skipping domain $TARGET_ENV_REMAP.example.com as its placeholder has no value for ode1 environment.' + "[ OK ] Compiled a list of 1 domains." + ) + steps_purge "ode1" "ode1.example.com" + STEPS+=( + "- Purging cache for ode1 environment domain siteode1.prod.acquia-sites.com." "[ OK ] Finished cache purging in Acquia." ) - export VORTEX_TASK_PURGE_CACHE_ACQUIA_KEY="test-key" - export VORTEX_TASK_PURGE_CACHE_ACQUIA_SECRET="test-secret" - export VORTEX_TASK_PURGE_CACHE_ACQUIA_APP_NAME="testapp" - export VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV="unknownenv" - export VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE="hooks/library/domains.txt" - - mocks="$(steps_run "setup")" - run .vortex/tooling/src/vortex-task-purge-cache-acquia - steps_run "assert" "${mocks[@]}" + run_purge "ode1" "domains-unknown.txt" assert_success popd >/dev/null || exit 1 } -@test "task-purge-cache-acquia: prod purge completes for an existing domain" { +@test "task-purge-cache-acquia: environment without domains purges nothing" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 - declare -a STEPS=( - "[INFO] Started cache purging in Acquia." + echo "dev.example.com" >domains-none.txt - "Retrieving authentication token." - '@curl -s -L https://accounts.acquia.com/api/auth/oauth/token --data-urlencode client_id=test-key --data-urlencode client_secret=test-secret --data-urlencode grant_type=client_credentials # {"access_token":"test-token"}' + declare -a STEPS=() + steps_lookup "dev" '{"total":0,"_embedded":{"items":[]}}' + STEPS+=( + "[ OK ] Retrieved 0 domains attached to dev environment." + "- Limiting the purge to domains listed in" + "[ OK ] Compiled a list of 0 domains." + "Unable to find domains to purge cache for dev environment." + "- Purging cache for" + "[ OK ] Finished cache purging in Acquia." + ) - "Retrieving testapp application UUID." - '@curl -s -L -H Accept: application/json, version=2 -H Authorization: Bearer test-token https://cloud.acquia.com/api/applications?filter=name%3Dtestapp # {"_embedded":{"items":[{"uuid":"app-uuid-123"}]}}' + run_purge "dev" "domains-none.txt" - "Retrieving environment ID." - '@curl -s -L -H Accept: application/json, version=2 -H Authorization: Bearer test-token https://cloud.acquia.com/api/applications/app-uuid-123/environments?filter=name%3Dprod # {"_embedded":{"items":[{"id":"env-id-456"}]}}' + assert_success - "[ OK ] Compiled a list of 1 domains." + popd >/dev/null || exit 1 +} - "Purging cache for prod environment domain your-site-domain.example." - '@curl -X POST -s -L -H Accept: application/json, version=2 -H Authorization: Bearer test-token -H Content-Type: application/json -d {"domains":["your-site-domain.example"]} https://cloud.acquia.com/api/environments/env-id-456/domains/actions/clear-varnish # {"_links":{"notification":{"href":"https://cloud.acquia.com/api/notifications/notif-123"}}}' - '@curl -s -L -H Accept: application/json, version=2 -H Authorization: Bearer test-token https://cloud.acquia.com/api/notifications/notif-123 # {"status":"completed"}' - "Purged cache for prod environment domain your-site-domain.example." - "[ OK ] Completed cache purging for prod environment domain your-site-domain.example." +@test "task-purge-cache-acquia: continues with the next domain when a purge is rejected" { + pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + declare -a STEPS=() + steps_lookup "dev" "$(domains_json "dev.example.com" "dev.other.example")" + STEPS+=( + "[ OK ] Compiled a list of 2 domains." + + "Purging cache for dev environment domain dev.example.com." + '@curl -X POST -s -L -H Accept: application/json, version=2 -H Authorization: Bearer test-token -H Content-Type: application/json -d {"domains":["dev.example.com"]} https://cloud.acquia.com/api/environments/env-id-456/actions/clear-caches # {"error":"forbidden"}' + 'Warning: Unable to purge cache for dev environment domain dev.example.com. API response: {"error":"forbidden"}' + "[ OK ] Completed cache purging for dev environment domain dev.example.com." + ) + steps_purge "dev" "dev.other.example" + STEPS+=( "[ OK ] Finished cache purging in Acquia." ) - export VORTEX_TASK_PURGE_CACHE_ACQUIA_KEY="test-key" - export VORTEX_TASK_PURGE_CACHE_ACQUIA_SECRET="test-secret" - export VORTEX_TASK_PURGE_CACHE_ACQUIA_APP_NAME="testapp" - export VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV="prod" - export VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE="hooks/library/domains.txt" - export VORTEX_TASK_PURGE_CACHE_ACQUIA_STATUS_RETRIES="1" - export VORTEX_TASK_PURGE_CACHE_ACQUIA_STATUS_INTERVAL="0" + run_purge "dev" - mocks="$(steps_run "setup")" - run .vortex/tooling/src/vortex-task-purge-cache-acquia - steps_run "assert" "${mocks[@]}" + assert_success + + popd >/dev/null || exit 1 +} + +@test "task-purge-cache-acquia: continues with the next domain when the status checks run out" { + pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + + declare -a STEPS=() + steps_lookup "dev" "$(domains_json "dev.example.com" "dev.other.example")" + STEPS+=( + "[ OK ] Compiled a list of 2 domains." + + "Purging cache for dev environment domain dev.example.com." + '@curl -X POST -s -L -H Accept: application/json, version=2 -H Authorization: Bearer test-token -H Content-Type: application/json -d {"domains":["dev.example.com"]} https://cloud.acquia.com/api/environments/env-id-456/actions/clear-caches # {"_links":{"notification":{"href":"https://cloud.acquia.com/api/notifications/notif-123"}}}' + '@curl -s -L -H Accept: application/json, version=2 -H Authorization: Bearer test-token https://cloud.acquia.com/api/notifications/notif-123 # {"status":"in-progress"}' + '@curl -s -L https://accounts.acquia.com/api/auth/oauth/token --data-urlencode client_id=test-key --data-urlencode client_secret=test-secret --data-urlencode grant_type=client_credentials # {"access_token":"test-token"}' + "Refreshed authentication token." + "Warning: Unable to purge cache for dev environment domain dev.example.com." + "[ OK ] Completed cache purging for dev environment domain dev.example.com." + ) + steps_purge "dev" "dev.other.example" + STEPS+=( + "[ OK ] Finished cache purging in Acquia." + ) + + run_purge "dev" assert_success - assert_output_not_contains "prod.your-site-domain.example" + popd >/dev/null || exit 1 +} + +@test "task-purge-cache-acquia: reports the failed domain lookup" { + pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + + declare -a STEPS=() + steps_lookup "dev" '{"error":"not_found","message":"Domain names do not exist on non-hosted applications."}' + STEPS+=( + '[FAIL] Unable to retrieve domains attached to dev environment. API response: {"error":"not_found","message":"Domain names do not exist on non-hosted applications."}' + "- Compiling a list of domains." + ) + + run_purge "dev" + + assert_failure popd >/dev/null || exit 1 } diff --git a/hooks/library/domains.txt b/hooks/library/domains.txt deleted file mode 100644 index 0e31e9f2ea..0000000000 --- a/hooks/library/domains.txt +++ /dev/null @@ -1 +0,0 @@ -$TARGET_ENV_REMAP.your-site-domain.example From fcb0dc786c334034df9e1a4404f9dc1ca8d059c1 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Fri, 30 Oct 2026 10:33:31 +1100 Subject: [PATCH 2/6] Updated snapshots. --- .../handler_process/hosting_acquia/hooks/library/domains.txt | 1 - .../hosting_project_name___acquia/hooks/library/domains.txt | 1 - 2 files changed, 2 deletions(-) delete mode 100644 .vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/domains.txt delete mode 100644 .vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/domains.txt diff --git a/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/domains.txt b/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/domains.txt deleted file mode 100644 index 7d47091d34..0000000000 --- a/.vortex/installer/tests/Fixtures/handler_process/hosting_acquia/hooks/library/domains.txt +++ /dev/null @@ -1 +0,0 @@ -$TARGET_ENV_REMAP.star-wars.com diff --git a/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/domains.txt b/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/domains.txt deleted file mode 100644 index 7d47091d34..0000000000 --- a/.vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/hooks/library/domains.txt +++ /dev/null @@ -1 +0,0 @@ -$TARGET_ENV_REMAP.star-wars.com From 308739a5721ef340252da63551e424789de95fc9 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Fri, 30 Oct 2026 11:08:35 +1100 Subject: [PATCH 3/6] Addressed code review: paged through the Acquia domains listing and failed on a response without domains. --- .../src/vortex-task-purge-cache-acquia | 53 +++++-- .../tests/unit/task-purge-cache-acquia.bats | 132 +++++++++++++++++- 2 files changed, 173 insertions(+), 12 deletions(-) diff --git a/.vortex/tooling/src/vortex-task-purge-cache-acquia b/.vortex/tooling/src/vortex-task-purge-cache-acquia index da9ad46f8b..3a71218a34 100755 --- a/.vortex/tooling/src/vortex-task-purge-cache-acquia +++ b/.vortex/tooling/src/vortex-task-purge-cache-acquia @@ -68,6 +68,14 @@ extract_json_hostnames() { php -r "\$data=json_decode(file_get_contents('php://stdin'), TRUE); foreach (\$data['_embedded']['items'] ?? [] as \$item) { if (!empty(\$item['hostname']) && empty(\$item['flags']['wildcard']) && strpos(\$item['hostname'], '*') === FALSE) { print \$item['hostname'] . PHP_EOL; } }" } +extract_json_items_count() { + php -r "\$data=json_decode(file_get_contents('php://stdin'), TRUE); is_array(\$data['_embedded']['items'] ?? NULL) ? print count(\$data['_embedded']['items']) : exit(1);" +} + +extract_json_pagination_total() { + php -r "\$data=json_decode(file_get_contents('php://stdin'), TRUE); isset(\$data['pagination']['total']) ? print (int) \$data['pagination']['total'] : exit(1);" +} + in_list() { local needle="${1}" shift @@ -131,19 +139,44 @@ env_id=$(echo "${envs_json}" | extract_json_value "_embedded" | extract_json_val pass "Retrieved environment ID." task "Retrieving domains attached to ${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV} environment." -domains_json=$(curl -s -L -H 'Accept: application/json, version=2' -H "Authorization: Bearer ${token}" "https://cloud.acquia.com/api/environments/${env_id}/domains") -[ "${VORTEX_DEBUG-}" = "1" ] && note "Domains API response: ${domains_json}" +env_domains=() +domains_limit=100 +domains_offset=0 +previous_domains_json="" +while true; do + domains_json=$(curl -s -L -H 'Accept: application/json, version=2' -H "Authorization: Bearer ${token}" "https://cloud.acquia.com/api/environments/${env_id}/domains?limit=${domains_limit}&offset=${domains_offset}") + [ "${VORTEX_DEBUG-}" = "1" ] && note "Domains API response: ${domains_json}" + + page_count=$(echo "${domains_json}" | extract_json_items_count) || page_count="" + if echo "${domains_json}" | grep -q '"error"' || [ -z "${page_count}" ]; then + fail "Unable to retrieve domains attached to ${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV} environment. API response: ${domains_json}" + fi -if echo "${domains_json}" | grep -q '"error"'; then - fail "Unable to retrieve domains attached to ${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV} environment. API response: ${domains_json}" -fi + # Stops an API that ignores the offset from returning the same page forever. + if [ "${page_count}" -eq 0 ] || [ "${domains_json}" = "${previous_domains_json}" ]; then + break + fi + previous_domains_json="${domains_json}" -env_domains=() -while IFS= read -r domain; do - if [ -n "${domain}" ]; then - env_domains+=("${domain}") + while IFS= read -r domain; do + if [ -n "${domain}" ]; then + env_domains+=("${domain}") + fi + done < <(echo "${domains_json}" | extract_json_hostnames) + + domains_offset=$((domains_offset + page_count)) + domains_total=$(echo "${domains_json}" | extract_json_pagination_total) || domains_total="" + + # The API can cap a page below the requested limit, so a short page marks + # the end only when the response reports no total. + if [ -n "${domains_total}" ]; then + if [ "${domains_offset}" -ge "${domains_total}" ]; then + break + fi + elif [ "${page_count}" -lt "${domains_limit}" ]; then + break fi -done < <(echo "${domains_json}" | extract_json_hostnames) +done pass "Retrieved ${#env_domains[@]} domains attached to ${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV} environment." task "Compiling a list of domains." diff --git a/.vortex/tooling/tests/unit/task-purge-cache-acquia.bats b/.vortex/tooling/tests/unit/task-purge-cache-acquia.bats index 1cc65be754..8967802514 100644 --- a/.vortex/tooling/tests/unit/task-purge-cache-acquia.bats +++ b/.vortex/tooling/tests/unit/task-purge-cache-acquia.bats @@ -32,7 +32,21 @@ steps_lookup() { "[ OK ] Retrieved environment ID." "Retrieving domains attached to ${env_name} environment." - "@curl -s -L -H Accept: application/json, version=2 -H Authorization: Bearer test-token https://cloud.acquia.com/api/environments/env-id-456/domains # ${domains_json}" + "@curl -s -L -H Accept: application/json, version=2 -H Authorization: Bearer test-token https://cloud.acquia.com/api/environments/env-id-456/domains?limit=100&offset=0 # ${domains_json}" + ) +} + +# Appends the request for a further page of the environment domains. +# +# Arguments: +# 1. offset: Offset the page is requested from. +# 2. domains_json: Response of the environment domains API. +steps_lookup_page() { + local offset="${1}" + local domains_json="${2}" + + STEPS+=( + "@curl -s -L -H Accept: application/json, version=2 -H Authorization: Bearer test-token https://cloud.acquia.com/api/environments/env-id-456/domains?limit=100&offset=${offset} # ${domains_json}" ) } @@ -59,8 +73,16 @@ steps_purge() { # A hostname starting with '*' is flagged as a wildcard. # # Arguments: +# 1. --total=: Total reported in the pagination block. Optional, the +# block is left out when omitted. # @: Hostnames attached to the environment. domains_json() { + local pagination="" + if [ "${1#--total=}" != "${1:-}" ]; then + pagination=",\"pagination\":{\"total\":${1#--total=},\"limit\":100,\"offset\":0}" + shift + fi + local items=() local hostname local wildcard @@ -73,7 +95,19 @@ domains_json() { done local IFS="," - echo "{\"total\":${#items[@]},\"_embedded\":{\"items\":[${items[*]}]}}" + echo "{\"total\":${#items[@]}${pagination},\"_embedded\":{\"items\":[${items[*]}]}}" +} + +# Prints 100 hostnames, 'd.example.com' onwards. +# +# Arguments: +# 1. start: Number of the first hostname. +full_page_hostnames() { + local start="${1}" + local i + for ((i = start; i < start + 100; i++)); do + echo "d${i}.example.com" + done } # Runs the task for one environment with the steps in STEPS. @@ -421,6 +455,100 @@ assert_placeholder() { popd >/dev/null || exit 1 } +@test "task-purge-cache-acquia: reports a domain lookup response without domains" { + pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + + declare -a STEPS=() + steps_lookup "dev" 'Bad Gateway' + STEPS+=( + '[FAIL] Unable to retrieve domains attached to dev environment. API response: Bad Gateway' + "- Compiling a list of domains." + ) + + run_purge "dev" + + assert_failure + + popd >/dev/null || exit 1 +} + +@test "task-purge-cache-acquia: requests the next page of domains after a full page" { + pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + + echo "d101.example.com" >domains-paged.txt + + mapfile -t first_page < <(full_page_hostnames 1) + + declare -a STEPS=() + steps_lookup "dev" "$(domains_json "${first_page[@]}")" + steps_lookup_page 100 "$(domains_json "d101.example.com")" + STEPS+=( + "[ OK ] Retrieved 101 domains attached to dev environment." + "[ OK ] Compiled a list of 1 domains." + ) + steps_purge "dev" "d101.example.com" + STEPS+=( + "[ OK ] Finished cache purging in Acquia." + ) + + run_purge "dev" "domains-paged.txt" + + assert_success + + popd >/dev/null || exit 1 +} + +@test "task-purge-cache-acquia: requests the next page of domains until the reported total" { + pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + + declare -a STEPS=() + steps_lookup "dev" "$(domains_json --total=3 "dev.example.com" "dev.other.example")" + steps_lookup_page 2 "$(domains_json --total=3 "dev.third.example")" + STEPS+=( + "[ OK ] Retrieved 3 domains attached to dev environment." + "[ OK ] Compiled a list of 3 domains." + ) + steps_purge "dev" "dev.example.com" + steps_purge "dev" "dev.other.example" + steps_purge "dev" "dev.third.example" + STEPS+=( + "[ OK ] Finished cache purging in Acquia." + ) + + run_purge "dev" + + assert_success + + popd >/dev/null || exit 1 +} + +@test "task-purge-cache-acquia: stops paging when the API repeats a page" { + pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 + + echo "d1.example.com" >domains-repeated.txt + + mapfile -t first_page < <(full_page_hostnames 1) + page_json="$(domains_json "${first_page[@]}")" + + declare -a STEPS=() + steps_lookup "dev" "${page_json}" + steps_lookup_page 100 "${page_json}" + STEPS+=( + "[ OK ] Retrieved 100 domains attached to dev environment." + "[ OK ] Compiled a list of 1 domains." + ) + steps_purge "dev" "d1.example.com" + STEPS+=( + "[ OK ] Finished cache purging in Acquia." + ) + + run_purge "dev" "domains-repeated.txt" + + assert_success + + popd >/dev/null || exit 1 +} + @test "task-purge-cache-acquia: missing key" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 From 2e3e09b5a97fb5f78ea7ef5846355f9e0b0d5023 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Fri, 30 Oct 2026 12:22:54 +1100 Subject: [PATCH 4/6] [#3250] Removed the 'domains.txt' domain list and 'VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE' from the Acquia cache purge. --- .../.utils/variables/variables.excluded.txt | 1 - .../docs/content/development/variables.mdx | 1 - .../src/vortex-task-purge-cache-acquia | 80 +----- .../tests/unit/task-purge-cache-acquia.bats | 259 ++---------------- hooks/library/purge-cache.sh | 1 - 5 files changed, 32 insertions(+), 310 deletions(-) diff --git a/.vortex/docs/.utils/variables/variables.excluded.txt b/.vortex/docs/.utils/variables/variables.excluded.txt index d3f82c5164..de67d4dcbf 100755 --- a/.vortex/docs/.utils/variables/variables.excluded.txt +++ b/.vortex/docs/.utils/variables/variables.excluded.txt @@ -7,7 +7,6 @@ IFS PATH SCRIPT_DIR SRC_TMPDIR -TARGET_ENV_REMAP TEST_PACKAGE_TOKEN VORTEX_DOCTOR_CHECK_PREFLIGHT VORTEX_PROVISION_LOG_ACTIVE diff --git a/.vortex/docs/content/development/variables.mdx b/.vortex/docs/content/development/variables.mdx index 43e8242269..2aa32ef220 100644 --- a/.vortex/docs/content/development/variables.mdx +++ b/.vortex/docs/content/development/variables.mdx @@ -576,7 +576,6 @@ The list below is automatically generated with [Shellvar](https://github.com/ale | `VORTEX_TASK_CUSTOM_LAGOON_SSH_FINGERPRINT` | SSH key fingerprint used to connect to a remote. | `UNDEFINED` | `.vortex/tooling/src/vortex-task-custom-lagoon` | | `VORTEX_TASK_PLATFORM` | Hosting platform to run the operation for. | `${VORTEX_PLATFORM}` | `.vortex/tooling/src/vortex-task` | | `VORTEX_TASK_PURGE_CACHE_ACQUIA_APP_NAME` | Application name. Used to discover UUID. | `${VORTEX_ACQUIA_APP_NAME}` | `.vortex/tooling/src/vortex-task-purge-cache-acquia` | -| `VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE` | File with a list of domains to limit the purge to.

When the file does not exist, all domains attached to the environment are purged. | `domains.txt` | `.vortex/tooling/src/vortex-task-purge-cache-acquia` | | `VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV` | An environment name to purge cache for. | `UNDEFINED` | `.vortex/tooling/src/vortex-task-purge-cache-acquia` | | `VORTEX_TASK_PURGE_CACHE_ACQUIA_KEY` | Acquia Cloud API key. | `${VORTEX_ACQUIA_KEY}` | `.vortex/tooling/src/vortex-task-purge-cache-acquia` | | `VORTEX_TASK_PURGE_CACHE_ACQUIA_SECRET` | Acquia Cloud API secret. | `${VORTEX_ACQUIA_SECRET}` | `.vortex/tooling/src/vortex-task-purge-cache-acquia` | diff --git a/.vortex/tooling/src/vortex-task-purge-cache-acquia b/.vortex/tooling/src/vortex-task-purge-cache-acquia index 3a71218a34..830a041deb 100755 --- a/.vortex/tooling/src/vortex-task-purge-cache-acquia +++ b/.vortex/tooling/src/vortex-task-purge-cache-acquia @@ -30,12 +30,6 @@ VORTEX_TASK_PURGE_CACHE_ACQUIA_APP_NAME="${VORTEX_TASK_PURGE_CACHE_ACQUIA_APP_NA # An environment name to purge cache for. VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV="${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV:-}" -# File with a list of domains to limit the purge to. -# -# When the file does not exist, all domains attached to the environment are -# purged. -VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE="${VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE:-domains.txt}" - # Number of status retrieval retries. If this limit reached and task has not # yet finished, the task is considered failed. VORTEX_TASK_PURGE_CACHE_ACQUIA_STATUS_RETRIES="${VORTEX_TASK_PURGE_CACHE_ACQUIA_STATUS_RETRIES:-600}" @@ -76,18 +70,6 @@ extract_json_pagination_total() { php -r "\$data=json_decode(file_get_contents('php://stdin'), TRUE); isset(\$data['pagination']['total']) ? print (int) \$data['pagination']['total'] : exit(1);" } -in_list() { - local needle="${1}" - shift - local item - for item in "$@"; do - if [ "${item}" = "${needle}" ]; then - return 0 - fi - done - return 1 -} - for cmd in php curl; do command -v "${cmd}" >/dev/null || fail "Command ${cmd} is not available."; done info "Started cache purging in Acquia." @@ -139,7 +121,7 @@ env_id=$(echo "${envs_json}" | extract_json_value "_embedded" | extract_json_val pass "Retrieved environment ID." task "Retrieving domains attached to ${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV} environment." -env_domains=() +domain_list=() domains_limit=100 domains_offset=0 previous_domains_json="" @@ -160,7 +142,7 @@ while true; do while IFS= read -r domain; do if [ -n "${domain}" ]; then - env_domains+=("${domain}") + domain_list+=("${domain}") fi done < <(echo "${domains_json}" | extract_json_hostnames) @@ -177,63 +159,7 @@ while true; do break fi done -pass "Retrieved ${#env_domains[@]} domains attached to ${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV} environment." - -task "Compiling a list of domains." - -domain_list=() -if [ "${#env_domains[@]}" -gt 0 ] && [ -f "${VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE}" ]; then - note "Limiting the purge to domains listed in ${VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE}." - - # Placeholders resolve to the sub-domain prefix shown in the Acquia UI. - target_env="${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV}" - target_env_remap="" - case "${target_env}" in - dev | test2) target_env_remap="${target_env}" ;; - test) target_env_remap="stage" ;; - esac - - while IFS= read -r domain || [ -n "${domain}" ]; do - domain="${domain#"${domain%%[![:space:]]*}"}" - domain="${domain%"${domain##*[![:space:]]}"}" - - if [ -z "${domain}" ] || [ "${domain:0:1}" = "#" ]; then - continue - fi - - # Production domains carry no prefix, so the placeholder and its dot are - # removed. - if [ "${target_env}" = "prod" ]; then - domain="${domain//\$TARGET_ENV_REMAP./}" - domain="${domain//\$TARGET_ENV./}" - fi - - if [[ ${domain} == *\$TARGET_ENV* ]]; then - if [ -z "${target_env_remap}" ]; then - note "Skipping domain ${domain} as its placeholder has no value for ${target_env} environment." - continue - fi - - domain="${domain//\$TARGET_ENV_REMAP/${target_env_remap}}" - domain="${domain//\$TARGET_ENV/${target_env}}" - fi - - if ! in_list "${domain}" "${env_domains[@]}"; then - note "Warning: Skipping domain ${domain} as it is not attached to ${target_env} environment." - continue - fi - - if [ "${#domain_list[@]}" -gt 0 ] && in_list "${domain}" "${domain_list[@]}"; then - continue - fi - - domain_list+=("${domain}") - done <"${VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE}" -elif [ "${#env_domains[@]}" -gt 0 ]; then - domain_list=("${env_domains[@]}") -fi - -pass "Compiled a list of ${#domain_list[@]} domains." +pass "Retrieved ${#domain_list[@]} domains attached to ${VORTEX_TASK_PURGE_CACHE_ACQUIA_ENV} environment." if [ "${#domain_list[@]}" -gt 0 ]; then # The Acquia API aborts a batched purge when any domain fails, so caches diff --git a/.vortex/tooling/tests/unit/task-purge-cache-acquia.bats b/.vortex/tooling/tests/unit/task-purge-cache-acquia.bats index 8967802514..2c432dd4e0 100644 --- a/.vortex/tooling/tests/unit/task-purge-cache-acquia.bats +++ b/.vortex/tooling/tests/unit/task-purge-cache-acquia.bats @@ -2,12 +2,12 @@ ## # Unit tests for the 'vortex-task-purge-cache-acquia' script. # -# shellcheck disable=SC2030,SC2031,SC2034,SC2016 +# shellcheck disable=SC2030,SC2031,SC2034 load ../_helper.bash # Appends the steps that resolve the token, application, environment and the -# domains attached to the environment. +# first page of domains attached to the environment. # # Arguments: # 1. env_name: Environment to purge the cache for. @@ -98,15 +98,15 @@ domains_json() { echo "{\"total\":${#items[@]}${pagination},\"_embedded\":{\"items\":[${items[*]}]}}" } -# Prints 100 hostnames, 'd.example.com' onwards. +# Prints wildcard hostnames, which fill a page without adding purges. # # Arguments: -# 1. start: Number of the first hostname. -full_page_hostnames() { - local start="${1}" +# 1. count: Number of hostnames to print. +wildcard_hostnames() { + local count="${1}" local i - for ((i = start; i < start + 100; i++)); do - echo "d${i}.example.com" + for ((i = 1; i <= count; i++)); do + echo "*.d${i}.example.com" done } @@ -114,11 +114,8 @@ full_page_hostnames() { # # Arguments: # 1. env_name: Environment to purge the cache for. -# 2. domains_file: File to limit the purge to. Optional, the variable is left -# unset when empty so the script default applies. run_purge() { local env_name="${1}" - local domains_file="${2:-}" export VORTEX_TASK_PURGE_CACHE_ACQUIA_KEY="test-key" export VORTEX_TASK_PURGE_CACHE_ACQUIA_SECRET="test-secret" @@ -127,68 +124,28 @@ run_purge() { export VORTEX_TASK_PURGE_CACHE_ACQUIA_STATUS_RETRIES="1" export VORTEX_TASK_PURGE_CACHE_ACQUIA_STATUS_INTERVAL="0" - unset VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE - if [ -n "${domains_file}" ]; then - export VORTEX_TASK_PURGE_CACHE_ACQUIA_DOMAINS_FILE="${domains_file}" - fi - mocks="$(steps_run "setup")" run .vortex/tooling/src/vortex-task-purge-cache-acquia steps_run "assert" "${mocks[@]}" } -# Asserts that a placeholder in the domains file resolves to the domain the -# environment has attached. -# -# Arguments: -# 1. env_name: Environment to purge the cache for. -# 2. line: Line written to the domains file. -# 3. domain: Domain the line is expected to resolve to. -assert_placeholder() { - local env_name="${1}" - local line="${2}" - local domain="${3}" - - echo "${line}" >domains-placeholder.txt - - declare -a STEPS=() - steps_lookup "${env_name}" "$(domains_json "${domain}" "other.example.com")" - STEPS+=( - "[ OK ] Retrieved 2 domains attached to ${env_name} environment." - "Compiling a list of domains." - "Limiting the purge to domains listed in domains-placeholder.txt." - "[ OK ] Compiled a list of 1 domains." - ) - steps_purge "${env_name}" "${domain}" - STEPS+=( - "- Purging cache for ${env_name} environment domain other.example.com." - "[ OK ] Finished cache purging in Acquia." - ) - - run_purge "${env_name}" "domains-placeholder.txt" - - assert_success -} - @test "task-purge-cache-acquia: purges every domain attached to the environment" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 declare -a STEPS=() - steps_lookup "dev" "$(domains_json "sitedev.prod.acquia-sites.com" "dev.example.com" "*.example.com")" + steps_lookup "prod" "$(domains_json "siteprod.prod.acquia-sites.com" "example.com" "www.example.com" "*.example.com")" STEPS+=( - "[ OK ] Retrieved 2 domains attached to dev environment." - "Compiling a list of domains." - "- Limiting the purge to domains listed in" - "[ OK ] Compiled a list of 2 domains." + "[ OK ] Retrieved 3 domains attached to prod environment." ) - steps_purge "dev" "sitedev.prod.acquia-sites.com" - steps_purge "dev" "dev.example.com" + steps_purge "prod" "siteprod.prod.acquia-sites.com" + steps_purge "prod" "example.com" + steps_purge "prod" "www.example.com" STEPS+=( "- *.example.com" "[ OK ] Finished cache purging in Acquia." ) - run_purge "dev" + run_purge "prod" assert_success @@ -202,7 +159,6 @@ assert_placeholder() { steps_lookup "ode1" "$(domains_json "siteode1.prod.acquia-sites.com")" STEPS+=( "[ OK ] Retrieved 1 domains attached to ode1 environment." - "[ OK ] Compiled a list of 1 domains." ) steps_purge "ode1" "siteode1.prod.acquia-sites.com" STEPS+=( @@ -216,169 +172,19 @@ assert_placeholder() { popd >/dev/null || exit 1 } -@test "task-purge-cache-acquia: skips a listed domain that is not attached and purges the rest" { - pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 - - printf "dev.example.com\ndev.missing.example\nsitedev.prod.acquia-sites.com\n" >domains-list.txt - - declare -a STEPS=() - steps_lookup "dev" "$(domains_json "sitedev.prod.acquia-sites.com" "dev.example.com" "dev.other.example")" - STEPS+=( - "[ OK ] Retrieved 3 domains attached to dev environment." - "Limiting the purge to domains listed in domains-list.txt." - "Warning: Skipping domain dev.missing.example as it is not attached to dev environment." - "[ OK ] Compiled a list of 2 domains." - ) - steps_purge "dev" "dev.example.com" - steps_purge "dev" "sitedev.prod.acquia-sites.com" - STEPS+=( - "- Purging cache for dev environment domain dev.missing.example." - "- Purging cache for dev environment domain dev.other.example." - "[ OK ] Finished cache purging in Acquia." - ) - - run_purge "dev" "domains-list.txt" - - assert_success - - popd >/dev/null || exit 1 -} - -@test "task-purge-cache-acquia: ignores blank lines, comments, whitespace and duplicates in the domains file" { - pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 - - # The last line has no trailing newline. - printf "# Domains to purge.\n\n dev.example.com \ndev.example.com\n\$TARGET_ENV_REMAP.example.com" >domains-format.txt - - declare -a STEPS=() - steps_lookup "dev" "$(domains_json "dev.example.com")" - STEPS+=( - "[ OK ] Retrieved 1 domains attached to dev environment." - "- Warning: Skipping domain" - "[ OK ] Compiled a list of 1 domains." - ) - steps_purge "dev" "dev.example.com" - STEPS+=( - "[ OK ] Finished cache purging in Acquia." - ) - - run_purge "dev" "domains-format.txt" - - assert_success - - popd >/dev/null || exit 1 -} - -@test "task-purge-cache-acquia: prod strips the placeholder" { - pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 - - assert_placeholder "prod" '$TARGET_ENV_REMAP.example.com' "example.com" - - popd >/dev/null || exit 1 -} - -@test "task-purge-cache-acquia: prod strips the legacy placeholder" { - pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 - - assert_placeholder "prod" '$TARGET_ENV.example.com' "example.com" - - popd >/dev/null || exit 1 -} - -@test "task-purge-cache-acquia: dev prefixes the domain with the environment name" { - pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 - - assert_placeholder "dev" '$TARGET_ENV_REMAP.example.com' "dev.example.com" - - popd >/dev/null || exit 1 -} - -@test "task-purge-cache-acquia: test prefixes the domain with the stage name used in the UI" { - pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 - - assert_placeholder "test" '$TARGET_ENV_REMAP.example.com' "stage.example.com" - - popd >/dev/null || exit 1 -} - -@test "task-purge-cache-acquia: test resolves the legacy placeholder to the environment name" { - pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 - - assert_placeholder "test" '$TARGET_ENV.example.com' "test.example.com" - - popd >/dev/null || exit 1 -} - -@test "task-purge-cache-acquia: test2 prefixes the domain with the environment name" { - pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 - - assert_placeholder "test2" '$TARGET_ENV_REMAP.example.com' "test2.example.com" - - popd >/dev/null || exit 1 -} - -@test "task-purge-cache-acquia: does not evaluate the domains file" { - pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 - - printf '$(touch evaluated.txt)dev.example.com\ndev.example.com\n' >domains-eval.txt - - declare -a STEPS=() - steps_lookup "dev" "$(domains_json "dev.example.com")" - STEPS+=( - 'Warning: Skipping domain $(touch evaluated.txt)dev.example.com as it is not attached to dev environment.' - "[ OK ] Compiled a list of 1 domains." - ) - steps_purge "dev" "dev.example.com" - - run_purge "dev" "domains-eval.txt" - - assert_success - assert_file_not_exists "evaluated.txt" - - popd >/dev/null || exit 1 -} - -@test "task-purge-cache-acquia: unknown environment skips placeholder lines and keeps plain domains" { - pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 - - printf '$TARGET_ENV_REMAP.example.com\node1.example.com\n' >domains-unknown.txt - - declare -a STEPS=() - steps_lookup "ode1" "$(domains_json "siteode1.prod.acquia-sites.com" "ode1.example.com")" - STEPS+=( - 'Skipping domain $TARGET_ENV_REMAP.example.com as its placeholder has no value for ode1 environment.' - "[ OK ] Compiled a list of 1 domains." - ) - steps_purge "ode1" "ode1.example.com" - STEPS+=( - "- Purging cache for ode1 environment domain siteode1.prod.acquia-sites.com." - "[ OK ] Finished cache purging in Acquia." - ) - - run_purge "ode1" "domains-unknown.txt" - - assert_success - - popd >/dev/null || exit 1 -} - @test "task-purge-cache-acquia: environment without domains purges nothing" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 - echo "dev.example.com" >domains-none.txt - declare -a STEPS=() steps_lookup "dev" '{"total":0,"_embedded":{"items":[]}}' STEPS+=( "[ OK ] Retrieved 0 domains attached to dev environment." - "- Limiting the purge to domains listed in" - "[ OK ] Compiled a list of 0 domains." "Unable to find domains to purge cache for dev environment." "- Purging cache for" "[ OK ] Finished cache purging in Acquia." ) - run_purge "dev" "domains-none.txt" + run_purge "dev" assert_success @@ -391,7 +197,7 @@ assert_placeholder() { declare -a STEPS=() steps_lookup "dev" "$(domains_json "dev.example.com" "dev.other.example")" STEPS+=( - "[ OK ] Compiled a list of 2 domains." + "[ OK ] Retrieved 2 domains attached to dev environment." "Purging cache for dev environment domain dev.example.com." '@curl -X POST -s -L -H Accept: application/json, version=2 -H Authorization: Bearer test-token -H Content-Type: application/json -d {"domains":["dev.example.com"]} https://cloud.acquia.com/api/environments/env-id-456/actions/clear-caches # {"error":"forbidden"}' @@ -416,7 +222,7 @@ assert_placeholder() { declare -a STEPS=() steps_lookup "dev" "$(domains_json "dev.example.com" "dev.other.example")" STEPS+=( - "[ OK ] Compiled a list of 2 domains." + "[ OK ] Retrieved 2 domains attached to dev environment." "Purging cache for dev environment domain dev.example.com." '@curl -X POST -s -L -H Accept: application/json, version=2 -H Authorization: Bearer test-token -H Content-Type: application/json -d {"domains":["dev.example.com"]} https://cloud.acquia.com/api/environments/env-id-456/actions/clear-caches # {"_links":{"notification":{"href":"https://cloud.acquia.com/api/notifications/notif-123"}}}' @@ -445,7 +251,7 @@ assert_placeholder() { steps_lookup "dev" '{"error":"not_found","message":"Domain names do not exist on non-hosted applications."}' STEPS+=( '[FAIL] Unable to retrieve domains attached to dev environment. API response: {"error":"not_found","message":"Domain names do not exist on non-hosted applications."}' - "- Compiling a list of domains." + "- Purging cache for" ) run_purge "dev" @@ -462,7 +268,7 @@ assert_placeholder() { steps_lookup "dev" 'Bad Gateway' STEPS+=( '[FAIL] Unable to retrieve domains attached to dev environment. API response: Bad Gateway' - "- Compiling a list of domains." + "- Purging cache for" ) run_purge "dev" @@ -475,23 +281,20 @@ assert_placeholder() { @test "task-purge-cache-acquia: requests the next page of domains after a full page" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 - echo "d101.example.com" >domains-paged.txt - - mapfile -t first_page < <(full_page_hostnames 1) + mapfile -t first_page < <(wildcard_hostnames 100) declare -a STEPS=() steps_lookup "dev" "$(domains_json "${first_page[@]}")" - steps_lookup_page 100 "$(domains_json "d101.example.com")" + steps_lookup_page 100 "$(domains_json "dev.example.com")" STEPS+=( - "[ OK ] Retrieved 101 domains attached to dev environment." - "[ OK ] Compiled a list of 1 domains." + "[ OK ] Retrieved 1 domains attached to dev environment." ) - steps_purge "dev" "d101.example.com" + steps_purge "dev" "dev.example.com" STEPS+=( "[ OK ] Finished cache purging in Acquia." ) - run_purge "dev" "domains-paged.txt" + run_purge "dev" assert_success @@ -506,7 +309,6 @@ assert_placeholder() { steps_lookup_page 2 "$(domains_json --total=3 "dev.third.example")" STEPS+=( "[ OK ] Retrieved 3 domains attached to dev environment." - "[ OK ] Compiled a list of 3 domains." ) steps_purge "dev" "dev.example.com" steps_purge "dev" "dev.other.example" @@ -525,24 +327,21 @@ assert_placeholder() { @test "task-purge-cache-acquia: stops paging when the API repeats a page" { pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1 - echo "d1.example.com" >domains-repeated.txt - - mapfile -t first_page < <(full_page_hostnames 1) - page_json="$(domains_json "${first_page[@]}")" + mapfile -t page < <(wildcard_hostnames 99) + page_json="$(domains_json "${page[@]}" "dev.example.com")" declare -a STEPS=() steps_lookup "dev" "${page_json}" steps_lookup_page 100 "${page_json}" STEPS+=( - "[ OK ] Retrieved 100 domains attached to dev environment." - "[ OK ] Compiled a list of 1 domains." + "[ OK ] Retrieved 1 domains attached to dev environment." ) - steps_purge "dev" "d1.example.com" + steps_purge "dev" "dev.example.com" STEPS+=( "[ OK ] Finished cache purging in Acquia." ) - run_purge "dev" "domains-repeated.txt" + run_purge "dev" assert_success diff --git a/hooks/library/purge-cache.sh b/hooks/library/purge-cache.sh index f2537f599b..080ec2eb18 100755 --- a/hooks/library/purge-cache.sh +++ b/hooks/library/purge-cache.sh @@ -17,7 +17,6 @@ export VORTEX_ACQUIA_KEY="${VORTEX_ACQUIA_KEY:?Missing required value.}" export VORTEX_ACQUIA_SECRET="${VORTEX_ACQUIA_SECRET:?Missing required value.}" 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"}" pushd "/var/www/html/${site}.${target_env}" >/dev/null || exit 1 From 996978465696f0ded28607a5c8b07bcafd3d873d Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Fri, 30 Oct 2026 12:29:40 +1100 Subject: [PATCH 5/6] Updated snapshots. --- .../handler_process/hosting_acquia/hooks/library/purge-cache.sh | 1 - .../hosting_project_name___acquia/hooks/library/purge-cache.sh | 1 - 2 files changed, 2 deletions(-) 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 f2537f599b..080ec2eb18 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 @@ -17,7 +17,6 @@ export VORTEX_ACQUIA_KEY="${VORTEX_ACQUIA_KEY:?Missing required value.}" export VORTEX_ACQUIA_SECRET="${VORTEX_ACQUIA_SECRET:?Missing required value.}" 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"}" pushd "/var/www/html/${site}.${target_env}" >/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 f2537f599b..080ec2eb18 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 @@ -17,7 +17,6 @@ export VORTEX_ACQUIA_KEY="${VORTEX_ACQUIA_KEY:?Missing required value.}" export VORTEX_ACQUIA_SECRET="${VORTEX_ACQUIA_SECRET:?Missing required value.}" 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"}" pushd "/var/www/html/${site}.${target_env}" >/dev/null || exit 1 From 83aad139c3ce8f59578929c63cac77a77ccc4ecd Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Fri, 30 Oct 2026 14:43:04 +1100 Subject: [PATCH 6/6] Re-triggered CI to clear a flaky check.