Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .ahoy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ commands:
cmd: |
COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME:-${PWD##*/}} \
VORTEX_HOST_DB_PORT=$(docker compose port database 3306 2>/dev/null | cut -d : -f 2) \
#;< MIGRATION
VORTEX_HOST_DB2_PORT=$(docker compose port database2 3306 2>/dev/null | cut -d : -f 2) \
#;> MIGRATION
VORTEX_HOST_SOLR_PORT=$(docker compose port solr 8983 2>/dev/null | cut -d : -f 2) \
VORTEX_HOST_SELENIUM_VNC_PORT=$(docker compose port chrome 7900 2>/dev/null | cut -d : -f 2) \
VORTEX_HOST_HAS_SEQUELACE=$(uname -a | grep -i -q darwin && mdfind -name 'Sequel Ace' 2>/dev/null | grep -q "Ace" && echo 1 || true) \
Expand All @@ -48,6 +51,16 @@ commands:
open "mysql://${DATABASE_USERNAME:-drupal}:${DATABASE_PASSWORD:-drupal}@127.0.0.1:${VORTEX_HOST_DB_PORT}/drupal" -a "Sequel Ace" \
|| echo "Not a supported OS or Sequel Ace is not installed."

#;< MIGRATION
db2:
usage: Open DB2 in Sequel Ace.
cmd: |
uname -a | grep -i -q darwin && test -d "${VORTEX_HOST_SEQUELACE_PATH:-/Applications/Sequel Ace.app}" && \
VORTEX_HOST_DB2_PORT=$(docker compose port database2 3306 2>/dev/null | cut -d : -f 2) && \
open "mysql://${DATABASE2_USERNAME:-drupal}:${DATABASE2_PASSWORD:-drupal}@127.0.0.1:${VORTEX_HOST_DB2_PORT}/drupal" -a "Sequel Ace" \
|| echo "Not a supported OS or Sequel Ace is not installed."
Comment on lines +54 to +61
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Use DATABASE2_NAME in db2 command to respect custom DB names.
Hardcoding /drupal breaks when DB2 name differs from the default.

✏️ Suggested fix
-      open "mysql://${DATABASE2_USERNAME:-drupal}:${DATABASE2_PASSWORD:-drupal}@127.0.0.1:${VORTEX_HOST_DB2_PORT}/drupal" -a "Sequel Ace" \
+      open "mysql://${DATABASE2_USERNAME:-drupal}:${DATABASE2_PASSWORD:-drupal}@127.0.0.1:${VORTEX_HOST_DB2_PORT}/${DATABASE2_NAME:-drupal}" -a "Sequel Ace" \
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#;< MIGRATION
db2:
usage: Open DB2 in Sequel Ace.
cmd: |
uname -a | grep -i -q darwin && test -d "${VORTEX_HOST_SEQUELACE_PATH:-/Applications/Sequel Ace.app}" && \
VORTEX_HOST_DB2_PORT=$(docker compose port database2 3306 2>/dev/null | cut -d : -f 2) && \
open "mysql://${DATABASE2_USERNAME:-drupal}:${DATABASE2_PASSWORD:-drupal}@127.0.0.1:${VORTEX_HOST_DB2_PORT}/drupal" -a "Sequel Ace" \
|| echo "Not a supported OS or Sequel Ace is not installed."
#;< MIGRATION
db2:
usage: Open DB2 in Sequel Ace.
cmd: |
uname -a | grep -i -q darwin && test -d "${VORTEX_HOST_SEQUELACE_PATH:-/Applications/Sequel Ace.app}" && \
VORTEX_HOST_DB2_PORT=$(docker compose port database2 3306 2>/dev/null | cut -d : -f 2) && \
open "mysql://${DATABASE2_USERNAME:-drupal}:${DATABASE2_PASSWORD:-drupal}@127.0.0.1:${VORTEX_HOST_DB2_PORT}/${DATABASE2_NAME:-drupal}" -a "Sequel Ace" \
|| echo "Not a supported OS or Sequel Ace is not installed."
🤖 Prompt for AI Agents
In @.ahoy.yml around lines 54 - 61, The db2 command in .ahoy.yml hardcodes the
database path as /drupal; update the command that builds the Sequel Ace URL (the
db2 cmd block) to use the DATABASE2_NAME environment variable with a default
fallback (e.g., ${DATABASE2_NAME:-drupal}) instead of the literal "/drupal" so
custom DB names are respected and the open URL is constructed dynamically.

#;> MIGRATION

# ----------------------------------------------------------------------------
# Container commands.
# ----------------------------------------------------------------------------
Expand Down Expand Up @@ -125,6 +138,15 @@ commands:
cmd: |
case " $* " in *" --fresh "*) export VORTEX_DOWNLOAD_DB_FRESH=1;; esac
./scripts/vortex/download-db.sh

#;< MIGRATION
download-db2:
usage: Download second database (migration). Run with "--fresh" to force.
aliases: [fetch-db2]
cmd: |
case " $* " in *" --fresh "*) export VORTEX_DOWNLOAD_DB_FORCE=1;; esac
VORTEX_VAR_PREFIX=VORTEX_DOWNLOAD_DB2 ./scripts/vortex/download-db.sh
#;> MIGRATION
Comment on lines +142 to +149
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Check what variables download-db.sh actually uses
rg -n "VORTEX_DOWNLOAD_DB_FORCE|VORTEX_DOWNLOAD_DB_FRESH" scripts/vortex/download-db.sh

Repository: drevops/vortex

Length of output: 278


🏁 Script executed:

# Check the download-db command to verify the variable it uses
sed -n '135,145p' .ahoy.yml

Repository: drevops/vortex

Length of output: 446


🏁 Script executed:

# Get more context around both commands
sed -n '130,155p' .ahoy.yml

Repository: drevops/vortex

Length of output: 998


Fix variable name mismatch in download-db command — the --fresh flag is broken.

The download-db command sets VORTEX_DOWNLOAD_DB_FRESH=1, but download-db.sh checks for VORTEX_DOWNLOAD_DB_FORCE (line 58). This means the --fresh flag has no effect. The download-db2 command correctly uses VORTEX_DOWNLOAD_DB_FORCE, so align download-db to use the same variable for consistency.

🤖 Prompt for AI Agents
In @.ahoy.yml around lines 142 - 149, The download-db command uses the wrong env
var name (VORTEX_DOWNLOAD_DB_FRESH) so the --fresh flag is ignored; change the
variable exported in the download-db command to VORTEX_DOWNLOAD_DB_FORCE to
match the check in download-db.sh (and align with download-db2), ensuring the
script sees the force flag when run.

#;> !PROVISION_TYPE_PROFILE

reload-db:
Expand Down
22 changes: 17 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,23 @@ jobs:
# Change 'v1' to 'v2', 'v3' etc., commit and push to force cache reset.
# Lookup cache based on the default branch and a timestamp. Allows
# to use cache from the very first build on the day (sanitized database dump, for example).
- v26.1.0-db11-{{ checksum "/tmp/db_cache_branch" }}-{{ checksum "/tmp/db_cache_fallback" }}-{{ checksum "/tmp/db_cache_timestamp" }}
- v26.2.0-db11-{{ checksum "/tmp/db_cache_branch" }}-{{ checksum "/tmp/db_cache_fallback" }}-{{ checksum "/tmp/db_cache_timestamp" }}
# Fallback to caching by default branch name only. Allows to use
# cache from the branch build on the previous day.
- v26.1.0-db11-{{ checksum "/tmp/db_cache_branch" }}-{{ checksum "/tmp/db_cache_fallback" }}-
- v26.2.0-db11-{{ checksum "/tmp/db_cache_branch" }}-{{ checksum "/tmp/db_cache_fallback" }}-

- run:
name: Download DB
command: VORTEX_DOWNLOAD_DB_SEMAPHORE=/tmp/download-db-success ./scripts/vortex/download-db.sh
no_output_timeout: 30m

#;< MIGRATION
- run:
name: Download migration DB
command: VORTEX_VAR_PREFIX=VORTEX_DOWNLOAD_DB2 ./scripts/vortex/download-db.sh
no_output_timeout: 30m
#;> MIGRATION

# Execute commands after database download script finished: if the
# DB dump was downloaded - build the site (to ensure that the DB dump
# is valid) and export the DB using selected method (to support
Expand All @@ -187,7 +194,7 @@ jobs:
# The cache will not be saved if it already exists.
# Note that the cache fallback flag is enabled for this case in order
# to save cache even if the fallback is not used when restoring it.
key: v26.1.0-db11-{{ checksum "/tmp/db_cache_branch" }}-{{ checksum "/tmp/db_cache_fallback_yes" }}-{{ checksum "/tmp/db_cache_timestamp" }}
key: v26.2.0-db11-{{ checksum "/tmp/db_cache_branch" }}-{{ checksum "/tmp/db_cache_fallback_yes" }}-{{ checksum "/tmp/db_cache_timestamp" }}
paths:
- /root/project/.data

Expand Down Expand Up @@ -236,8 +243,8 @@ jobs:
keys:
# Use cached artifacts from previous builds of this branch.
# https://circleci.com/docs/2.0/caching/#restoring-cache
- v26.1.0-db11-{{ checksum "/tmp/db_cache_branch" }}-{{ checksum "/tmp/db_cache_fallback_yes" }}-{{ checksum "/tmp/db_cache_timestamp" }}
- v26.1.0-db11-{{ checksum "/tmp/db_cache_branch" }}-{{ checksum "/tmp/db_cache_fallback_yes" }}-
- v26.2.0-db11-{{ checksum "/tmp/db_cache_branch" }}-{{ checksum "/tmp/db_cache_fallback_yes" }}-{{ checksum "/tmp/db_cache_timestamp" }}
- v26.2.0-db11-{{ checksum "/tmp/db_cache_branch" }}-{{ checksum "/tmp/db_cache_fallback_yes" }}-
#;> !PROVISION_TYPE_PROFILE

- *step_setup_remote_docker
Expand Down Expand Up @@ -356,6 +363,11 @@ jobs:
if [ -f .data/db.sql ]; then
docker compose exec cli mkdir -p .data
docker compose cp -L .data/db.sql cli:/app/.data/db.sql
#;< MIGRATION
if [ -f ".data/${VORTEX_DOWNLOAD_DB2_FILE:-db2.sql}" ]; then
docker compose cp -L ".data/${VORTEX_DOWNLOAD_DB2_FILE:-db2.sql}" cli:"/app/.data/${VORTEX_DOWNLOAD_DB2_FILE:-db2.sql}"
fi
#;> MIGRATION
fi
docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli ./scripts/vortex/provision.sh
no_output_timeout: 30m
Expand Down
62 changes: 62 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,61 @@ VORTEX_DOWNLOAD_DB_ACQUIA_DB_NAME=your_site

#;> !PROVISION_TYPE_PROFILE

#;< MIGRATION
################################################################################
# SECOND DATABASE (MIGRATION) #
################################################################################

# Second database for migrations.
# See settings.migration.php for database credentials.

# Second database dump file name.
VORTEX_DOWNLOAD_DB2_FILE=db2.sql

# Second database download source.
VORTEX_DOWNLOAD_DB2_SOURCE=url

#;< MIGRATION_DB_DOWNLOAD_SOURCE_URL
# Second database dump file sourced from a URL.
#
# HTTP Basic Authentication credentials should be embedded into the value.
VORTEX_DOWNLOAD_DB2_URL=
Comment on lines +243 to +247
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Avoid duplicate VORTEX_DOWNLOAD_DB2_URL keys.

The key appears in both the MIGRATION and DEMO blocks, which triggers the dotenv-linter duplication warning and makes precedence unclear. Consider commenting out one, using a distinct demo-only key, or gating so only one active value remains.

Also applies to: 361-365

🤖 Prompt for AI Agents
In @.env around lines 243 - 247, The env file defines duplicate keys named
VORTEX_DOWNLOAD_DB2_URL (in both the MIGRATION and DEMO sections) which triggers
dotenv-linter warnings; pick a single canonical key or rename the demo-specific
one (e.g., VORTEX_DOWNLOAD_DB2_URL_DEMO), or comment/gate the unused entry so
only one active VORTEX_DOWNLOAD_DB2_URL remains; update any code or docs that
reference VORTEX_DOWNLOAD_DB2_URL to use the new demo-specific name if you
rename it.

#;> MIGRATION_DB_DOWNLOAD_SOURCE_URL

#;< MIGRATION_DB_DOWNLOAD_SOURCE_FTP
# Second database dump file sourced from FTP.

# Second database dump FTP host.
VORTEX_DOWNLOAD_DB2_FTP_HOST=

# Second database dump FTP port.
VORTEX_DOWNLOAD_DB2_FTP_PORT=21

# Second database dump FTP file name.
VORTEX_DOWNLOAD_DB2_FTP_FILE=db2.sql
#;> MIGRATION_DB_DOWNLOAD_SOURCE_FTP

#;< MIGRATION_DB_DOWNLOAD_SOURCE_S3
# Second database dump file sourced from S3.

# AWS S3 bucket name for second database download.
VORTEX_DOWNLOAD_DB2_S3_BUCKET=

# AWS S3 region.
VORTEX_DOWNLOAD_DB2_S3_REGION=ap-southeast-2
#;> MIGRATION_DB_DOWNLOAD_SOURCE_S3

# Environment to download the second database from.
#
# Applies to hosting environments.
VORTEX_DOWNLOAD_DB2_ENVIRONMENT=prod

#;< HOSTING_ACQUIA
# Acquia database name to download the second database from.
VORTEX_DOWNLOAD_DB2_ACQUIA_DB_NAME=your_site
#;> HOSTING_ACQUIA
#;> MIGRATION

################################################################################
# RELEASE VERSIONING #
################################################################################
Expand Down Expand Up @@ -303,6 +358,13 @@ VORTEX_NOTIFY_WEBHOOK_URL=
VORTEX_DOWNLOAD_DB_URL=https://github.com/drevops/vortex/releases/download/25.4.0/db_d11.demo.sql
#;> DB_DOWNLOAD_SOURCE_URL

#;< MIGRATION
#;< MIGRATION_DB_DOWNLOAD_SOURCE_URL
# URL of the migration source database used for demonstration.
VORTEX_DOWNLOAD_DB2_URL=https://github.com/drevops/vortex/releases/download/25.4.0/db_d11.demo_source.sql
#;> MIGRATION_DB_DOWNLOAD_SOURCE_URL
#;> MIGRATION

#;< DB_DOWNLOAD_SOURCE_CONTAINER_REGISTRY
# Demo database container image used for demonstration of database-in-image
# data storage.
Expand Down
22 changes: 16 additions & 6 deletions .github/workflows/build-test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ jobs:
uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5
with:
path: .data
key: v26.1.0-db11-${{ hashFiles('db_cache_branch') }}-${{ hashFiles('db_cache_fallback') }}-${{ hashFiles('db_cache_timestamp') }}
key: v26.2.0-db11-${{ hashFiles('db_cache_branch') }}-${{ hashFiles('db_cache_fallback') }}-${{ hashFiles('db_cache_timestamp') }}
# Fallback to caching by default branch name only. Allows to use
# cache from the branch build on the previous day.
restore-keys: |
v26.1.0-db11-${{ hashFiles('db_cache_branch') }}-${{ hashFiles('db_cache_fallback') }}-
v26.2.0-db11-${{ hashFiles('db_cache_branch') }}-${{ hashFiles('db_cache_fallback') }}-

- name: Download DB
run: |
Expand All @@ -139,6 +139,11 @@ jobs:
VORTEX_ACQUIA_SECRET: ${{ secrets.VORTEX_ACQUIA_SECRET }}
#;> DB_DOWNLOAD_SOURCE_ACQUIA

#;< MIGRATION
- name: Download migration DB
run: VORTEX_VAR_PREFIX=VORTEX_DOWNLOAD_DB2 ./scripts/vortex/download-db.sh
#;> MIGRATION
Comment on lines +142 to +145
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Run the command from the review comment to find references
rg -nP "VORTEX_DOWNLOAD_DB2_(FILE|DIR)|VORTEX_VAR_PREFIX=VORTEX_DOWNLOAD_DB2"

Repository: drevops/vortex

Length of output: 497


🏁 Script executed:

#!/bin/bash
# First, let's look at the actual workflow file around lines 142-145 and 348-351
cat -n .github/workflows/build-test-deploy.yml | sed -n '135,155p'
echo "---"
cat -n .github/workflows/build-test-deploy.yml | sed -n '340,360p'

Repository: drevops/vortex

Length of output: 2275


🏁 Script executed:

#!/bin/bash
# Check if the download-db.sh script exists and examine it
find . -name "download-db.sh" -type f

Repository: drevops/vortex

Length of output: 89


🏁 Script executed:

#!/bin/bash
# Examine the download-db.sh script
wc -l ./scripts/vortex/download-db.sh

Repository: drevops/vortex

Length of output: 92


🏁 Script executed:

#!/bin/bash
# Read the download-db.sh script to understand its behavior
cat -n ./scripts/vortex/download-db.sh

Repository: drevops/vortex

Length of output: 4519


🏁 Script executed:

#!/bin/bash
# Look for how VORTEX_VAR_PREFIX is used in the codebase
rg -nA5 "VORTEX_VAR_PREFIX" ./scripts

Repository: drevops/vortex

Length of output: 4298


Set VORTEX_DOWNLOAD_DB2_FILE=db2.sql to prevent migration download from overwriting the primary database dump.

When VORTEX_VAR_PREFIX=VORTEX_DOWNLOAD_DB2 is used, the script remaps any VORTEX_DOWNLOAD_DB2_* environment variables to VORTEX_DOWNLOAD_DB_* (line 15 of download-db.sh). Without an explicit VORTEX_DOWNLOAD_DB2_FILE env var, the script defaults to db.sql (line 32), writing to the same location as the primary dump. The later copy step at lines 348-351 checks for .data/${VORTEX_DOWNLOAD_DB2_FILE:-db2.sql}, which defaults to db2.sql when the variable is unset, causing the file check to fail and the migration DB to not be copied into the container.

🔧 Suggested fix
       - name: Download migration DB
         run: VORTEX_VAR_PREFIX=VORTEX_DOWNLOAD_DB2 ./scripts/vortex/download-db.sh
+        env:
+          VORTEX_DOWNLOAD_DB2_FILE: db2.sql
+          VORTEX_DOWNLOAD_DB2_DIR: .data

Applies to lines 142-145 and 348-351.

🤖 Prompt for AI Agents
In @.github/workflows/build-test-deploy.yml around lines 142 - 145, Set the
VORTEX_DOWNLOAD_DB2_FILE env var in the workflow step that runs download-db.sh
so the migration download writes to db2.sql instead of the default db.sql;
specifically, modify the step that sets VORTEX_VAR_PREFIX=VORTEX_DOWNLOAD_DB2 to
also export VORTEX_DOWNLOAD_DB2_FILE=db2.sql so the remapping logic in
download-db.sh (which maps VORTEX_DOWNLOAD_DB2_* → VORTEX_DOWNLOAD_DB_*) doesn't
cause the migration dump to overwrite the primary dump and so the subsequent
copy check for .data/${VORTEX_DOWNLOAD_DB2_FILE:-db2.sql} succeeds.


- name: Export DB
run: |
if [ ! -f /tmp/download-db-success ]; then echo "==> Database download semaphore file is missing. DB export will not proceed."; exit 0; fi
Expand All @@ -158,7 +163,7 @@ jobs:
if: env.db_hash != hashFiles('.data')
with:
path: .data
key: v26.1.0-db11-${{ hashFiles('db_cache_branch') }}-${{ hashFiles('db_cache_fallback_yes') }}-${{ hashFiles('db_cache_timestamp') }}
key: v26.2.0-db11-${{ hashFiles('db_cache_branch') }}-${{ hashFiles('db_cache_fallback_yes') }}-${{ hashFiles('db_cache_timestamp') }}
#;> !PROVISION_TYPE_PROFILE

build:
Expand Down Expand Up @@ -223,7 +228,7 @@ jobs:
date "${VORTEX_CI_DB_CACHE_TIMESTAMP}" | tee db_cache_timestamp

- name: Show cache key for database caching
run: echo 'v26.1.0-db11-${{ hashFiles('db_cache_branch') }}-${{ hashFiles('db_cache_fallback_yes') }}-${{ hashFiles('db_cache_timestamp') }}'
run: echo 'v26.2.0-db11-${{ hashFiles('db_cache_branch') }}-${{ hashFiles('db_cache_fallback_yes') }}-${{ hashFiles('db_cache_timestamp') }}'

# Restore DB cache based on the cache strategy set by the cache keys below.
# Change 'v1' to 'v2', 'v3' etc., commit and push to force cache reset.
Expand All @@ -235,9 +240,9 @@ jobs:
path: .data
fail-on-cache-miss: true
# Use cached database from previous builds of this branch.
key: v26.1.0-db11-${{ hashFiles('db_cache_branch') }}-${{ hashFiles('db_cache_fallback_yes') }}-${{ hashFiles('db_cache_timestamp') }}
key: v26.2.0-db11-${{ hashFiles('db_cache_branch') }}-${{ hashFiles('db_cache_fallback_yes') }}-${{ hashFiles('db_cache_timestamp') }}
restore-keys: |
v26.1.0-db11-${{ hashFiles('db_cache_branch') }}-${{ hashFiles('db_cache_fallback_yes') }}-
v26.2.0-db11-${{ hashFiles('db_cache_branch') }}-${{ hashFiles('db_cache_fallback_yes') }}-
#;> !PROVISION_TYPE_PROFILE

- name: Login to container registry
Expand Down Expand Up @@ -340,6 +345,11 @@ jobs:
if [ -f .data/db.sql ]; then
docker compose exec cli mkdir -p .data
docker compose cp -L .data/db.sql cli:/app/.data/db.sql
#;< MIGRATION
if [ -f ".data/${VORTEX_DOWNLOAD_DB2_FILE:-db2.sql}" ]; then
docker compose cp -L ".data/${VORTEX_DOWNLOAD_DB2_FILE:-db2.sql}" cli:"/app/.data/${VORTEX_DOWNLOAD_DB2_FILE:-db2.sql}"
fi
#;> MIGRATION
fi
docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli ./scripts/vortex/provision.sh
timeout-minutes: 30
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vortex-test-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -237,5 +237,5 @@ jobs:
continue-on-error: ${{ vars.VORTEX_CI_YAMLLINT_IGNORE_FAILURE == '1' }}

- name: Check coding standards with actionlint
run: docker run --rm -v "${GITHUB_WORKSPACE:-.}":/app --workdir /app rhysd/actionlint:1.7.2 -ignore 'SC2002:' -ignore 'SC2155:' -ignore 'SC2015:' -ignore 'SC2046:' -ignore 'SC1090:'
run: docker run --rm -v "${GITHUB_WORKSPACE:-.}":/app --workdir /app rhysd/actionlint:1.7.10 -ignore 'SC2002:' -ignore 'SC2155:' -ignore 'SC2015:' -ignore 'SC2046:' -ignore 'SC1090:'
continue-on-error: ${{ vars.VORTEX_CI_ACTIONLINT_IGNORE_FAILURE == '1' }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ web/profiles/*
web/sites/default/*
!web/sites/default/settings.php
!web/sites/default/services.yml
#;< MIGRATION
!web/sites/default/settings.migration.php
#;> MIGRATION
!web/sites/default/example.settings.local.php
!web/sites/default/example.services.local.yml
!web/sites/default/default.settings.local.php
Expand Down
10 changes: 10 additions & 0 deletions .lagoon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ tasks:
service: cli
#;> !PROVISION_TYPE_PROFILE

#;< MIGRATION
- run:
name: Download migration database
command: |
export VORTEX_DOWNLOAD_DB_SSH_FILE=false
export VORTEX_DB_DIR=/tmp/data
VORTEX_VAR_PREFIX=VORTEX_DOWNLOAD_DB2 ./scripts/vortex/download-db.sh
service: cli
#;> MIGRATION
Comment on lines +64 to +72
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Verify intended behavior for migration database download.

Two potential concerns:

  1. No environment check: Unlike the primary DB download (lines 54-60) which skips production, the migration download runs unconditionally. If migrations should only run in non-production environments, add an environment check.

  2. Missing directory cleanup: The primary DB download runs rm -Rf $VORTEX_DB_DIR || true before downloading, but the migration download doesn't. Since both use /tmp/data, stale files could cause issues.

If migrations should run in all environments, consider adding a comment to clarify this is intentional.

Suggested fix (if non-production only)
     #;< MIGRATION
     - run:
         name: Download migration database
         command: |
+          if [ "$LAGOON_ENVIRONMENT_TYPE" != "production" ] && [ "$LAGOON_GIT_BRANCH" != "${VORTEX_LAGOON_PRODUCTION_BRANCH:-main}" ]; then
           export VORTEX_DOWNLOAD_DB_SSH_FILE=false
           export VORTEX_DB_DIR=/tmp/data
           VORTEX_VAR_PREFIX=VORTEX_DOWNLOAD_DB2 ./scripts/vortex/download-db.sh
+          fi
         service: cli
     #;> MIGRATION
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#;< MIGRATION
- run:
name: Download migration database
command: |
export VORTEX_DOWNLOAD_DB_SSH_FILE=false
export VORTEX_DB_DIR=/tmp/data
VORTEX_VAR_PREFIX=VORTEX_DOWNLOAD_DB2 ./scripts/vortex/download-db.sh
service: cli
#;> MIGRATION
#;< MIGRATION
- run:
name: Download migration database
command: |
if [ "$LAGOON_ENVIRONMENT_TYPE" != "production" ] && [ "$LAGOON_GIT_BRANCH" != "${VORTEX_LAGOON_PRODUCTION_BRANCH:-main}" ]; then
export VORTEX_DOWNLOAD_DB_SSH_FILE=false
export VORTEX_DB_DIR=/tmp/data
VORTEX_VAR_PREFIX=VORTEX_DOWNLOAD_DB2 ./scripts/vortex/download-db.sh
fi
service: cli
#;> MIGRATION
🤖 Prompt for AI Agents
In @.lagoon.yml around lines 64 - 72, The migration download step runs
unconditionally and lacks the pre-download cleanup; either (A) restrict it to
non-production like the primary DB download by adding the same environment guard
used there and run rm -Rf $VORTEX_DB_DIR || true before invoking
VORTEX_VAR_PREFIX=VORTEX_DOWNLOAD_DB2 ./scripts/vortex/download-db.sh
(preserving the VORTEX_DOWNLOAD_DB_SSH_FILE/VORTEX_DB_DIR vars), or (B) if it is
intended to run in all environments, add an explicit comment above this run
block stating that running migrations/downloads in production is intentional and
explain why; update the block around VORTEX_DOWNLOAD_DB_SSH_FILE, VORTEX_DB_DIR
and the download script accordingly.


- run:
name: Provision site
command: |
Expand Down
8 changes: 8 additions & 0 deletions .vortex/.ahoy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ commands:
name: Lint Vortex project.
cmd: |
ahoy lint-installer
ahoy lint-tests
ahoy lint-scripts
ahoy lint-dockerfiles
ahoy lint-docs
Expand All @@ -52,6 +53,7 @@ commands:
name: Fix linting issues in Vortex project.
cmd: |
ahoy lint-installer-fix
ahoy lint-tests-fix
ahoy lint-docs-fix
ahoy lint-markdown-fix

Expand All @@ -61,6 +63,12 @@ commands:
lint-installer-fix:
cmd: composer --working-dir installer lint-fix

lint-tests:
cmd: composer --working-dir tests lint

lint-tests-fix:
cmd: composer --working-dir tests lint-fix

lint-scripts:
cmd: ./tests/lint.scripts.sh

Expand Down
47 changes: 47 additions & 0 deletions .vortex/docs/.utils/create-migrate-source-db.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash
##
# Create migration source database with sample data.
#
# This script populates the migration source database with a `categories` table
# containing sample data for demonstration purposes.
#
# Usage:
# DB_URL=mysql://user:pass@host:port/dbname ./create-migrate-source-db.sh
#
# Or using drush:
# $(drush sql:connect) < <(./create-migrate-source-db.sh --sql)

set -eu
[ "${VORTEX_DEBUG-}" = "1" ] && set -x

sql=$(
cat <<'SQL'
DROP TABLE IF EXISTS `categories`;

CREATE TABLE `categories` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`description` text DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

INSERT INTO `categories` (`id`, `name`, `description`) VALUES
(1, 'Jedi Order', 'Ancient order of Force-sensitive protectors of peace and justice in the galaxy.'),
(2, 'Sith Lords', 'Dark side practitioners who seek power and dominion over the galaxy.'),
(3, 'Galactic Empire', 'Authoritarian government that ruled the galaxy through fear and military might.'),
(4, 'Rebel Alliance', 'Coalition of resistance fighters opposing the tyranny of the Galactic Empire.'),
(5, 'Bounty Hunters', 'Mercenaries and trackers who pursue targets for credits across the galaxy.'),
(6, 'Smugglers', 'Independent pilots and traders who operate outside the law for profit.'),
(7, 'Droids', 'Mechanical beings serving various roles from protocol to astromech duties.'),
(8, 'Mandalorians', 'Warrior culture known for their beskar armor and combat traditions.'),
(9, 'Wookiees', 'Tall, fur-covered species from Kashyyyk known for their strength and loyalty.'),
(10, 'Hutts', 'Powerful crime lords who control vast criminal enterprises across the Outer Rim.');
SQL
)

if [ "${1:-}" = "--sql" ]; then
printf '%s\n' "${sql}"
exit 0
fi

echo "${sql}"
Comment on lines +42 to +47
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Redundant conditional: both branches output identical content.

The --sql flag has no meaningful effect—both paths emit the same SQL to stdout. Consider either:

  1. Removing the --sql flag and always outputting SQL, or
  2. Implementing actual database execution (using DB_URL) in the default path, reserving --sql for dry-run/output-only mode.
💡 Option 1: Simplify by removing the flag
-if [ "${1:-}" = "--sql" ]; then
-  printf '%s\n' "${sql}"
-  exit 0
-fi
-
-echo "${sql}"
+printf '%s\n' "${sql}"
🤖 Prompt for AI Agents
In @.vortex/docs/.utils/create-migrate-source-db.sh around lines 42 - 47, The
conditional checking "${1:-}" = "--sql" is redundant because both branches print
the same sql variable; change behavior so "--sql" remains a dry-run/output-only
mode and the default path actually executes the SQL against the configured
DB_URL: keep the if block to print and exit when "${1:-}" = "--sql", and in the
else branch replace the echo "${sql}" with logic that uses DB_URL to run the SQL
(e.g., invoke psql/mysql/appropriate client with DB_URL, handle errors and
non-zero exit codes), ensuring you reference the sql variable and DB_URL and
return meaningful exit codes on failure.

Loading
Loading