Skip to content
Merged
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
1 change: 0 additions & 1 deletion .vortex/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ These modify many files and take 10-15 minutes.
- Multi-line OK for: many parameters, arrays, chained methods, complex
conditionals


```text
vortex/
├── .vortex/ # Test harness and development tools
Expand Down
98 changes: 92 additions & 6 deletions .vortex/tooling/scripts_conversion_plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Convert all Vortex bash scripts (`scripts/vortex/*.sh`) to PHP scripts as a stan

### 📊 Test Statistics

- **Total Tests**: 383 tests, 1,740 assertions
- **Total Tests**: 429 tests, 1,861 assertions
- **Test Groups**:
- `helpers` - 55 tests for core helper functions
- `notify` - 132 tests for notification system
Expand Down Expand Up @@ -753,6 +753,90 @@ function mockFileGetContents(string $path, string $content): void

---

## ✅ Phase 5.5: Sync PHP Scripts with Shell Updates - COMPLETE

After the initial conversion in Phases 1-5, the shell scripts received updates that
were not reflected in the PHP versions. This phase synchronized all differences.

### 5.5.1 Notification Scripts Sync

**notify (router):**
- Added `VORTEX_NOTIFY_BRANCH` (required) variable
- Added `VORTEX_NOTIFY_SHA` (required) variable
- Added `VORTEX_NOTIFY_PR_NUMBER` (optional) variable
- Changed `VORTEX_NOTIFY_ENVIRONMENT_URL` from optional to required
- Added `putenv()` exports for branch, SHA, PR number, label, environment URL, login URL
- Added detailed summary output matching shell format

**notify-slack:**
- Fixed field order: Deployment, Time, Environment, Login (matching shell)
- Added `footer: 'Vortex Deployment'` to Slack attachment

**notify-github:**
- Added `VORTEX_NOTIFY_GITHUB_BRANCH` (with fallback to `VORTEX_NOTIFY_BRANCH`) as deployment ref
- Replaced `$notify_label` with `$notify_branch` for all deployment API `ref` parameters
- Fixed `VORTEX_NOTIFY_GITHUB_ENVIRONMENT_TYPE` default: falls back to `VORTEX_NOTIFY_LABEL` then `'PR'`

**notify-jira:**
- Added `VORTEX_NOTIFY_JIRA_BRANCH` (with fallback to `VORTEX_NOTIFY_BRANCH`) for issue extraction
- Changed issue extraction regex to match against branch (not label)
- Replaced simple text-to-ADF with rich `build_adf_comment()` featuring clickable links, code marks, and hardBreaks

**notify-newrelic:**
- Reordered variables: enabled check first, then required variables
- Renamed `VORTEX_NOTIFY_NEWRELIC_USER_NAME` to `VORTEX_NOTIFY_NEWRELIC_USER` (matching shell)
- Added `VORTEX_NOTIFY_NEWRELIC_SHA` (with fallback to `VORTEX_NOTIFY_SHA`)
- Added SHA-based revision fallback before auto-generated LABEL-DATE-TIME pattern
- Added required variable validation after enabled check (user API key)
- Added numeric validation for app ID regardless of source

### 5.5.2 Deployment Scripts Sync

**deploy (router):**
- Fixed `VORTEX_DEPLOY_ACTION` default from `'deploy'` to `''` (matching shell)

**deploy-artifact:**
- Fixed SSH prefix from `DEPLOY` to `DEPLOY_ARTIFACT` (matching shell)
- Added `VORTEX_DEPLOY_ARTIFACT_SSH_FINGERPRINT` and `VORTEX_DEPLOY_ARTIFACT_SSH_FILE` variable names with fallback chain
- Updated git-artifact version from `~1.1` to `~1.2` (matching shell)

**deploy-lagoon:**
- Added tag deployment check: early exit for tag mode (`'Lagoon does not support tag deployments. Skipping.'`)
- Added `VORTEX_DEPLOY_MODE` variable
- Added `VORTEX_DEPLOY_LAGOON_*` prefixed variable support with fallbacks:
- `VORTEX_DEPLOY_LAGOON_ACTION` (fallback: `VORTEX_DEPLOY_ACTION`, default: `'create'`)
- `VORTEX_DEPLOY_LAGOON_PROJECT` (fallback: `LAGOON_PROJECT`)
- `VORTEX_DEPLOY_LAGOON_BRANCH` (fallback: `VORTEX_DEPLOY_BRANCH`)
- `VORTEX_DEPLOY_LAGOON_PR` (fallback: `VORTEX_DEPLOY_PR`)
- `VORTEX_DEPLOY_LAGOON_PR_HEAD` (fallback: `VORTEX_DEPLOY_PR_HEAD`)
- `VORTEX_DEPLOY_LAGOON_PR_BASE_BRANCH` (fallback: `VORTEX_DEPLOY_PR_BASE_BRANCH`)
- `VORTEX_DEPLOY_LAGOON_SSH_FINGERPRINT` (fallback chain)
- `VORTEX_DEPLOY_LAGOON_SSH_FILE` (fallback chain)
- `VORTEX_DEPLOY_LAGOON_LAGOONCLI_PATH` (fallback: `VORTEX_LAGOONCLI_PATH`)
- `VORTEX_DEPLOY_LAGOON_LAGOONCLI_FORCE_INSTALL` (fallback: `VORTEX_LAGOONCLI_FORCE_INSTALL`)
- `VORTEX_DEPLOY_LAGOON_LAGOONCLI_VERSION` (fallback: `VORTEX_LAGOONCLI_VERSION`)
- Fixed SSH prefix from `DEPLOY` to `DEPLOY_LAGOON` (matching shell)

**login-container-registry:**
- Added `VORTEX_LOGIN_CONTAINER_REGISTRY` (fallback: `VORTEX_CONTAINER_REGISTRY`)
- Added `VORTEX_LOGIN_CONTAINER_REGISTRY_USER` (fallback: `VORTEX_CONTAINER_REGISTRY_USER`)
- Added `VORTEX_LOGIN_CONTAINER_REGISTRY_PASS` (fallback: `VORTEX_CONTAINER_REGISTRY_PASS`)
- Added `VORTEX_LOGIN_CONTAINER_REGISTRY_DOCKER_CONFIG` (fallback: `DOCKER_CONFIG`)

### 5.5.3 Test Updates

All test files updated to match script changes:
- `NotifyGithubTest.php` - Updated for branch variable, assertions, and data providers
- `NotifyJiraTest.php` - Updated for branch-based issue extraction
- `NotifyNewrelicTest.php` - Updated for optional variables, custom error messages
- `NotifyRouterTest.php` - Added required branch and SHA variables
- `DeployArtifactTest.php` - Updated git-artifact version in mocks
- `DeployLagoonTest.php` - Updated error message for new variable names

**All 429 tests passing with 1,861 assertions** ✅

Comment on lines +756 to +837

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix the “required Added” wording in the Phase 5.5 bullet.

The bullet reads awkwardly; splitting it removes the double-modal.

✍️ Suggested wording fix
-- Changed `VORTEX_NOTIFY_ENVIRONMENT_URL` from optional to required - Added `putenv()` exports for branch, SHA, PR number, label, environment URL, login URL
+- Changed `VORTEX_NOTIFY_ENVIRONMENT_URL` from optional to required.
+- Added `putenv()` exports for branch, SHA, PR number, label, environment URL, login URL
🧰 Tools
🪛 LanguageTool

[style] ~768-~768: The double modal “required Added” is nonstandard (only accepted in certain dialects). Consider “to be Added”.
Context: ...ONMENT_URLfrom optional to required - Addedputenv()` exports for branch, SHA, PR ...

(NEEDS_FIXED)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.vortex/tooling/scripts_conversion_plan.md around lines 756 - 837, The Phase
5.5 bullet "Added `VORTEX_NOTIFY_BRANCH` (required) variable" and similar
bullets use awkward "required Added" phrasing; update the wording to use "Added
required" (e.g., change "Added `VORTEX_NOTIFY_BRANCH` (required) variable" to
"Added required `VORTEX_NOTIFY_BRANCH` variable") and apply the same fix across
all similar lines under "5.5.1 Notification Scripts Sync" and related bullets
(look for text containing "Added `VORTEX_*` (required)" and "Added `...`
(optional)" to ensure consistency).

---

## Phase 6: Convert Remaining Scripts (TODO)

### Database Scripts
Expand All @@ -762,9 +846,11 @@ function mockFileGetContents(string $path, string $content): void
4. ⏳ `download-db-container-registry.sh` - Download from container registry
5. ⏳ `download-db-lagoon.sh` - Download from Lagoon
6. ⏳ `download-db-acquia.sh` - Download from Acquia
7. ⏳ `export-db.sh` - Export database router
8. ⏳ `export-db-file.sh` - Export to file
9. ⏳ `export-db-image.sh` - Export to container image
7. ⏳ `download-db-s3.sh` - Download from S3
8. ⏳ `upload-db-s3.sh` - Upload to S3
9. ⏳ `export-db.sh` - Export database router
10. ⏳ `export-db-file.sh` - Export to file
11. ⏳ `export-db-image.sh` - Export to container image

### Provisioning Scripts
10. ⏳ `provision.sh` - Main provisioning
Expand Down Expand Up @@ -1125,6 +1211,6 @@ All deployment scripts converted as a single milestone:

---

**Last Updated**: 2025-12-15
**Current Phase**: Phase 5 Complete ✅
**Last Updated**: 2026-02-20
**Current Phase**: Phase 5.5 Sync Complete ✅
**Next Milestone**: Phase 6 - Database download/export scripts
2 changes: 1 addition & 1 deletion .vortex/tooling/src/deploy
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ $deploy_mode = getenv_default('VORTEX_DEPLOY_MODE', 'branch');
// - deploy: Deploy code and preserve database in the environment.
// - deploy_override_db: Deploy code and override database in the environment.
// - destroy: Destroy the environment (if the provider supports it).
$deploy_action = getenv_default('VORTEX_DEPLOY_ACTION', 'deploy');
$deploy_action = getenv_default('VORTEX_DEPLOY_ACTION', '');

// Deployment branch name.
$deploy_branch = getenv_default('VORTEX_DEPLOY_BRANCH', NULL);
Expand Down
16 changes: 8 additions & 8 deletions .vortex/tooling/src/deploy-artifact
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ $deploy_git_user_email = getenv_required('VORTEX_DEPLOY_ARTIFACT_GIT_USER_EMAIL'

// SSH key fingerprint used to connect to remote.
//
// Falls back to $VORTEX_SSH_FINGERPRINT.
$deploy_ssh_fingerprint = getenv_default('VORTEX_DEPLOY_SSH_FINGERPRINT', 'VORTEX_SSH_FINGERPRINT', '');
// Falls back to VORTEX_DEPLOY_SSH_FINGERPRINT, then VORTEX_SSH_FINGERPRINT.
$deploy_ssh_fingerprint = getenv_default('VORTEX_DEPLOY_ARTIFACT_SSH_FINGERPRINT', 'VORTEX_DEPLOY_SSH_FINGERPRINT', 'VORTEX_SSH_FINGERPRINT', '');

// Default SSH file used if custom fingerprint is not provided.
//
// Falls back to VORTEX_SSH_FILE.
$deploy_ssh_file = getenv_default('VORTEX_DEPLOY_SSH_FILE', 'VORTEX_SSH_FILE', getenv('HOME') . '/.ssh/id_rsa');
// Falls back to VORTEX_DEPLOY_SSH_FILE, then VORTEX_SSH_FILE.
$deploy_ssh_file = getenv_default('VORTEX_DEPLOY_ARTIFACT_SSH_FILE', 'VORTEX_DEPLOY_SSH_FILE', 'VORTEX_SSH_FILE', getenv('HOME') . '/.ssh/id_rsa');

// -----------------------------------------------------------------------------

Expand All @@ -86,16 +86,16 @@ if (empty($global_git_email)) {
}

// Setup SSH.
putenv('VORTEX_SSH_PREFIX=DEPLOY');
!empty($deploy_ssh_fingerprint) && putenv('VORTEX_DEPLOY_SSH_FINGERPRINT=' . $deploy_ssh_fingerprint);
!empty($deploy_ssh_file) && putenv('VORTEX_DEPLOY_SSH_FILE=' . $deploy_ssh_file);
putenv('VORTEX_SSH_PREFIX=DEPLOY_ARTIFACT');
!empty($deploy_ssh_fingerprint) && putenv('VORTEX_DEPLOY_ARTIFACT_SSH_FINGERPRINT=' . $deploy_ssh_fingerprint);
!empty($deploy_ssh_file) && putenv('VORTEX_DEPLOY_ARTIFACT_SSH_FILE=' . $deploy_ssh_file);
passthru(__DIR__ . '/setup-ssh', $exit_code);
if ($exit_code !== 0) {
quit($exit_code);
}

task('Installing artifact builder.');
passthru('composer global require --dev -n --ansi --prefer-source --ignore-platform-reqs drevops/git-artifact:~1.1', $exit_code);
passthru('composer global require --dev -n --ansi --prefer-source --ignore-platform-reqs drevops/git-artifact:~1.2', $exit_code);
if ($exit_code !== 0) {
Comment on lines 97 to 99

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check git-artifact versions and requirements on Packagist.

echo "=== Checking available 1.2.x versions ==="
curl -s https://packagist.org/packages/drevops/git-artifact.json | jq -r '.package.versions | keys[]' | grep -E '^1\.2' || echo "No versions found"

echo -e "\n=== Checking PHP requirements for 1.2.0 ==="
curl -s https://packagist.org/packages/drevops/git-artifact.json | jq -r '.package.versions["1.2.0"] // empty' | head -20

Repository: drevops/vortex

Length of output: 707


🏁 Script executed:

#!/bin/bash
# Get full PHP requirements for version 1.2.0
curl -s https://packagist.org/packages/drevops/git-artifact.json | jq -r '.package.versions["1.2.0"].require' 2>/dev/null || echo "Failed to retrieve requirements"

Repository: drevops/vortex

Length of output: 302


Verify PHP 8.3+ availability in CI environment.
Version 1.2.0 exists on Packagist, but it requires PHP >=8.3. Ensure the CI runtime meets this requirement before deployment.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.vortex/tooling/src/deploy-artifact around lines 97 - 99, The CI may run PHP
<8.3 but the composer global require in task('Installing artifact builder.')
installs drevops/git-artifact:~1.2 which needs PHP >=8.3; add a pre-check
(before the passthru(...) call) that verifies the PHP runtime meets >=8.3 (e.g.,
run php -r or php -v and parse the version) and fail fast with a clear message
if it is too old, or alternatively adjust the requested package constraint to a
version compatible with the detected PHP version; ensure the check is tied to
the same installation block that calls passthru('composer global require ...',
$exit_code) and that it prevents running the composer command when PHP is
incompatible.

quit($exit_code);
}
Expand Down
48 changes: 30 additions & 18 deletions .vortex/tooling/src/deploy-lagoon
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,33 @@ execute_override(basename(__FILE__));

// -----------------------------------------------------------------------------

// Deployment mode.
//
// Values can be one of: branch, tag.
$deploy_mode = getenv_default('VORTEX_DEPLOY_MODE', 'branch');

Comment thread
AlexSkrypnyk marked this conversation as resolved.
// Deployment action.
//
// Values can be one of: deploy, deploy_override_db, destroy.
// - deploy: Deploy code and preserve database in the environment.
// - deploy_override_db: Deploy code and override database in the environment.
// - destroy: Destroy the environment (if the provider supports it).
$deploy_action = getenv_default('VORTEX_DEPLOY_ACTION', 'deploy');
$deploy_action = getenv_default('VORTEX_DEPLOY_LAGOON_ACTION', 'VORTEX_DEPLOY_ACTION', 'create');

// The Lagoon project to perform deployment for.
$lagoon_project = getenv_required('VORTEX_DEPLOY_LAGOON_PROJECT', 'LAGOON_PROJECT');

// The Lagoon branch to deploy.
$deploy_branch = getenv_default('VORTEX_DEPLOY_BRANCH', NULL);
$deploy_branch = getenv_default('VORTEX_DEPLOY_LAGOON_BRANCH', 'VORTEX_DEPLOY_BRANCH', NULL);

// The PR number to deploy.
$deploy_pr = getenv_default('VORTEX_DEPLOY_PR', NULL);
$deploy_pr = getenv_default('VORTEX_DEPLOY_LAGOON_PR', 'VORTEX_DEPLOY_PR', NULL);

// The PR head branch to deploy.
$deploy_pr_head = getenv_default('VORTEX_DEPLOY_PR_HEAD', NULL);
$deploy_pr_head = getenv_default('VORTEX_DEPLOY_LAGOON_PR_HEAD', 'VORTEX_DEPLOY_PR_HEAD', NULL);

// The PR base branch (the branch the PR is raised against).
$deploy_pr_base_branch = getenv_default('VORTEX_DEPLOY_PR_BASE_BRANCH', 'develop');

// The Lagoon project to perform deployment for.
$lagoon_project = getenv_required('LAGOON_PROJECT');
$deploy_pr_base_branch = getenv_default('VORTEX_DEPLOY_LAGOON_PR_BASE_BRANCH', 'VORTEX_DEPLOY_PR_BASE_BRANCH', 'develop');

// The Lagoon instance name to interact with.
$lagoon_instance = getenv_default('VORTEX_DEPLOY_LAGOON_INSTANCE', 'amazeeio');
Expand All @@ -54,30 +59,37 @@ $lagoon_instance_port = getenv_default('VORTEX_DEPLOY_LAGOON_INSTANCE_PORT', '32

// SSH key fingerprint used to connect to remote.
//
// Falls back to VORTEX_SSH_FINGERPRINT.
$ssh_fingerprint = getenv_default('VORTEX_DEPLOY_SSH_FINGERPRINT', 'VORTEX_SSH_FINGERPRINT', NULL);
// Falls back to VORTEX_DEPLOY_SSH_FINGERPRINT, then VORTEX_SSH_FINGERPRINT.
$ssh_fingerprint = getenv_default('VORTEX_DEPLOY_LAGOON_SSH_FINGERPRINT', 'VORTEX_DEPLOY_SSH_FINGERPRINT', 'VORTEX_SSH_FINGERPRINT', NULL);

// Default SSH file used if custom fingerprint is not provided.
//
// Falls back to VORTEX_SSH_FILE.
$ssh_file = getenv_default('VORTEX_DEPLOY_SSH_FILE', 'VORTEX_SSH_FILE', getenv('HOME') . '/.ssh/id_rsa');
// Falls back to VORTEX_DEPLOY_SSH_FILE, then VORTEX_SSH_FILE.
$ssh_file = getenv_default('VORTEX_DEPLOY_LAGOON_SSH_FILE', 'VORTEX_DEPLOY_SSH_FILE', 'VORTEX_SSH_FILE', getenv('HOME') . '/.ssh/id_rsa');

// Flag to control failure behavior when Lagoon environment limits are exceeded.
$deploy_lagoon_fail_when_env_limit_exceeded = getenv_default('VORTEX_DEPLOY_LAGOON_FAIL_ENV_LIMIT_EXCEEDED', FALSE);

// Location of the Lagoon CLI binary.
$lagooncli_path = getenv_default('VORTEX_LAGOONCLI_PATH', sys_get_temp_dir());
$lagooncli_path = getenv_default('VORTEX_DEPLOY_LAGOON_LAGOONCLI_PATH', 'VORTEX_LAGOONCLI_PATH', sys_get_temp_dir());

// Flag to force the installation of Lagoon CLI.
$lagooncli_force_install = getenv_default('VORTEX_LAGOONCLI_FORCE_INSTALL', FALSE);
$lagooncli_force_install = getenv_default('VORTEX_DEPLOY_LAGOON_LAGOONCLI_FORCE_INSTALL', 'VORTEX_LAGOONCLI_FORCE_INSTALL', FALSE);

// Lagoon CLI version to use.
$lagooncli_version = getenv_default('VORTEX_LAGOONCLI_VERSION', 'v0.32.0');
$lagooncli_version = getenv_default('VORTEX_DEPLOY_LAGOON_LAGOONCLI_VERSION', 'VORTEX_LAGOONCLI_VERSION', 'v0.32.0');

// -----------------------------------------------------------------------------

info('Started LAGOON deployment.');

// Lagoon does not support tag deployments. Exit successfully with a message.
if ($deploy_mode === 'tag') {
note('Lagoon does not support tag deployments. Skipping.');
pass('Finished LAGOON deployment.');
quit(0);
}

// Track exit status to return at the end.
$exit_code = 0;

Expand All @@ -90,9 +102,9 @@ if (empty($deploy_branch) && empty($deploy_pr)) {
}

// Setup SSH.
putenv('VORTEX_SSH_PREFIX=DEPLOY');
!empty($ssh_fingerprint) && putenv('VORTEX_DEPLOY_SSH_FINGERPRINT=' . $ssh_fingerprint);
!empty($ssh_file) && putenv('VORTEX_DEPLOY_SSH_FILE=' . $ssh_file);
putenv('VORTEX_SSH_PREFIX=DEPLOY_LAGOON');
!empty($ssh_fingerprint) && putenv('VORTEX_DEPLOY_LAGOON_SSH_FINGERPRINT=' . $ssh_fingerprint);
!empty($ssh_file) && putenv('VORTEX_DEPLOY_LAGOON_SSH_FILE=' . $ssh_file);
passthru(__DIR__ . '/setup-ssh', $ssh_exit_code);
if ($ssh_exit_code !== 0) {
quit($ssh_exit_code);
Expand Down
10 changes: 5 additions & 5 deletions .vortex/tooling/src/login-container-registry
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ execute_override(basename(__FILE__));
// Container registry URL.
//
// Examples: docker.io, gcr.io, ghcr.io
$registry = getenv_default('VORTEX_CONTAINER_REGISTRY', 'docker.io');
$registry = getenv_default('VORTEX_LOGIN_CONTAINER_REGISTRY', 'VORTEX_CONTAINER_REGISTRY', 'docker.io');

// Container registry username.
$user = getenv_default('VORTEX_CONTAINER_REGISTRY_USER', NULL);
$user = getenv_default('VORTEX_LOGIN_CONTAINER_REGISTRY_USER', 'VORTEX_CONTAINER_REGISTRY_USER', NULL);

// Container registry password.
$pass = getenv_default('VORTEX_CONTAINER_REGISTRY_PASS', NULL);
$pass = getenv_default('VORTEX_LOGIN_CONTAINER_REGISTRY_PASS', 'VORTEX_CONTAINER_REGISTRY_PASS', NULL);

// Docker configuration directory.
$docker_config = getenv_default('DOCKER_CONFIG', getenv('HOME') . '/.docker');
$docker_config = getenv_default('VORTEX_LOGIN_CONTAINER_REGISTRY_DOCKER_CONFIG', 'DOCKER_CONFIG', getenv('HOME') . '/.docker');

// -----------------------------------------------------------------------------

Expand All @@ -47,5 +47,5 @@ elseif (!empty($user) && !empty($pass)) {
}
}
else {
note('Skipping login to the container registry as either VORTEX_CONTAINER_REGISTRY_USER or VORTEX_CONTAINER_REGISTRY_PASS was not provided.');
note('Skipping login to the container registry as either VORTEX_LOGIN_CONTAINER_REGISTRY_USER or VORTEX_CONTAINER_REGISTRY_USER or VORTEX_LOGIN_CONTAINER_REGISTRY_PASS or VORTEX_CONTAINER_REGISTRY_PASS was not provided.');
}
34 changes: 31 additions & 3 deletions .vortex/tooling/src/notify
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,22 @@ $event = getenv('VORTEX_NOTIFY_EVENT') ?: 'post_deployment';
// Notification project name.
$project = getenv('VORTEX_NOTIFY_PROJECT') ?: getenv('VORTEX_PROJECT');

// Notification deployment label (branch name, PR number, or custom identifier).
// Notification git branch name.
$branch = getenv_required('VORTEX_NOTIFY_BRANCH');

// Notification git commit SHA.
$sha = getenv_required('VORTEX_NOTIFY_SHA');

// Notification pull request number.
$pr_number = getenv_default('VORTEX_NOTIFY_PR_NUMBER', '');

// Notification deployment label (human-readable identifier for display).
$label = getenv_required('VORTEX_NOTIFY_LABEL');

// Notification environment URL (where the site was deployed).
$env_url = getenv('VORTEX_NOTIFY_ENVIRONMENT_URL');
$env_url = getenv_required('VORTEX_NOTIFY_ENVIRONMENT_URL');

// Notification login URL (defaults to ENVIRONMENT_URL/user/login).
// Notification login URL.
$login_url = getenv_default('VORTEX_NOTIFY_LOGIN_URL', $env_url . '/user/login');

// Notification skip flag.
Expand All @@ -62,6 +71,25 @@ if (!in_array($event, ['pre_deployment', 'post_deployment'])) {
fail('Unsupported event %s provided.', $event);
}

// Export variables so notification scripts can use them.
putenv('VORTEX_NOTIFY_BRANCH=' . $branch);
putenv('VORTEX_NOTIFY_SHA=' . $sha);
putenv('VORTEX_NOTIFY_PR_NUMBER=' . $pr_number);
putenv('VORTEX_NOTIFY_LABEL=' . $label);
putenv('VORTEX_NOTIFY_ENVIRONMENT_URL=' . $env_url);
putenv('VORTEX_NOTIFY_LOGIN_URL=' . $login_url);

info('Notification summary:');
note('Project : ' . $project);
note('Branch : ' . $branch);
note('SHA : ' . $sha);
note('PR Number : ' . ($pr_number ?: '<none>'));
note('Label : ' . $label);
note('Environment URL: ' . $env_url);
note('Login URL : ' . $login_url);
note('Event : ' . $event);
note('Channels : ' . implode(',', $channels));

foreach ($channels as $channel) {
$script = __DIR__ . ('/notify-' . $channel);

Expand Down
Loading