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
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ VORTEX_NOTIFY_EMAIL_RECIPIENTS="webmaster@your-site-domain.example|Webmaster"
#;> NOTIFICATIONS_EMAIL

#;< NOTIFICATIONS_JIRA
# JIRA user email.
VORTEX_NOTIFY_JIRA_USER=user@example.com
# JIRA user email address.
VORTEX_NOTIFY_JIRA_USER_EMAIL=user@example.com
#;> NOTIFICATIONS_JIRA

#;< NOTIFICATIONS_WEBHOOK
Expand Down
39 changes: 14 additions & 25 deletions .lagoon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,14 @@ tasks:

#;< !NOTIFICATIONS
- run:
name: Notify about pre-deployment.
name: Send pre-deployment notifications
command: |
if [ -n "$LAGOON_PR_NUMBER" ]; then
export VORTEX_NOTIFY_SHA=${LAGOON_PR_HEAD_SHA#origin/}
export VORTEX_NOTIFY_BRANCH=$LAGOON_PR_HEAD_BRANCH
export VORTEX_NOTIFY_PR_NUMBER="${LAGOON_PR_NUMBER:-}"
else
export VORTEX_NOTIFY_SHA=$LAGOON_GIT_SHA
export VORTEX_NOTIFY_BRANCH=$LAGOON_GIT_BRANCH
fi
VORTEX_NOTIFY_PROJECT=$LAGOON_PROJECT \
VORTEX_NOTIFY_ENVIRONMENT_URL=$LAGOON_ROUTE \
VORTEX_NOTIFY_EVENT=pre_deployment ./scripts/vortex/notify.sh || true
export VORTEX_NOTIFY_PROJECT=$LAGOON_PROJECT
export VORTEX_NOTIFY_ENVIRONMENT_URL=$LAGOON_ROUTE
export VORTEX_NOTIFY_LABEL="$LAGOON_GIT_BRANCH"
[ -n "$LAGOON_PR_NUMBER" ] && export VORTEX_NOTIFY_LABEL="PR-${LAGOON_PR_NUMBER}"
export VORTEX_NOTIFY_EVENT=pre_deployment
./scripts/vortex/notify.sh
Comment thread
coderabbitai[bot] marked this conversation as resolved.
service: cli
shell: bash
#;> !NOTIFICATIONS
Expand Down Expand Up @@ -93,20 +88,14 @@ tasks:

#;< !NOTIFICATIONS
- run:
name: Send deployment notifications
name: Send post-deployment notifications
command: |
if [ -n "$LAGOON_PR_NUMBER" ]; then
export VORTEX_NOTIFY_SHA=${LAGOON_PR_HEAD_SHA#origin/}
export VORTEX_NOTIFY_BRANCH=$LAGOON_PR_HEAD_BRANCH
export VORTEX_NOTIFY_PR_NUMBER="${LAGOON_PR_NUMBER:-}"
else
export VORTEX_NOTIFY_SHA=$LAGOON_GIT_SHA
export VORTEX_NOTIFY_BRANCH=$LAGOON_GIT_BRANCH
fi
VORTEX_NOTIFY_EVENT=post_deployment \
VORTEX_NOTIFY_PROJECT=$LAGOON_PROJECT \
VORTEX_NOTIFY_ENVIRONMENT_URL=$LAGOON_ROUTE \
./scripts/vortex/notify.sh || true
export VORTEX_NOTIFY_PROJECT=$LAGOON_PROJECT
export VORTEX_NOTIFY_ENVIRONMENT_URL=$LAGOON_ROUTE
export VORTEX_NOTIFY_LABEL="$LAGOON_GIT_BRANCH"
[ -n "$LAGOON_PR_NUMBER" ] && export VORTEX_NOTIFY_LABEL="PR-${LAGOON_PR_NUMBER}"
export VORTEX_NOTIFY_EVENT=post_deployment
./scripts/vortex/notify.sh
Comment thread
AlexSkrypnyk marked this conversation as resolved.
service: cli
shell: bash
#;> !NOTIFICATIONS
Expand Down
119 changes: 118 additions & 1 deletion .vortex/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ UPDATE_FIXTURES=1 composer test # Update test fixtures
- `phpunit/` - Functional tests for complete workflows
- `bats/` - Unit tests for individual shell scripts
- `bats/fixtures/` - Test fixtures and mock data
- `manual/` - Manual integration tests with real external services

**Commands** (from `.vortex/`):

Expand All @@ -120,7 +121,7 @@ cd tests && ./vendor/bin/phpunit # Run PHPUnit workflow tests

## Testing Architecture Overview

Vortex uses **three independent testing systems**, each serving different parts of the codebase:
Vortex uses **four independent testing systems**, each serving different parts of the codebase:

### 1. Documentation Tests (.vortex/docs/)

Expand Down Expand Up @@ -178,6 +179,27 @@ Vortex uses **three independent testing systems**, each serving different parts
- **PHPUnit Functional**: End-to-end workflow testing
- **BATS Unit**: Individual shell script testing with mocking

### 4. Manual Integration Tests (.vortex/tests/manual/)

**Scope**: Manual verification of notification integrations with real external services

**Technology**: Bash scripts + Real service APIs (Slack, JIRA, etc.)

**What it Tests**:

- Actual notification message formatting in live services
- Real API authentication and authorization
- Service-specific rendering (Slack rich attachments, JIRA ADF)
- End-to-end integration workflows (comment posting, issue transitions)

**Test Types**:

- **Manual Slack Tests**: Branch and PR deployment notifications to real Slack channels
- **Manual JIRA Tests**: Comment creation, transitions, and assignments on real JIRA issues
- **Authentication Verification**: API token validation and permission checks

**Key Difference**: These tests use REAL services (not mocks) and require manual verification of output, complementing automated tests by validating actual service integration and message appearance.

## Template BATS Testing System (.vortex/tests/bats/)

### Overview
Expand Down Expand Up @@ -305,6 +327,53 @@ bats tests/bats/unit/notify.bats
./lint.scripts.sh # Shell script linting
```

### 4. Manual Integration Tests (.vortex/tests/manual/)

**Purpose**: Manually verify notification integrations with real external services

**Technology**: Bash scripts that invoke actual notification endpoints

**What to Test**:

- Real Slack webhook message formatting and delivery
- JIRA comment creation, issue transitions, and assignments
- Actual service API authentication and responses

**Available Scripts**:

```bash
# Slack notifications (requires SLACK_WEBHOOK_URL)
export SLACK_WEBHOOK_URL="your-webhook-url"
.vortex/tests/manual/try-slack-notification.sh branch # Test branch deployment
.vortex/tests/manual/try-slack-notification.sh pr # Test PR deployment

# JIRA notifications (requires JIRA_TOKEN)
export JIRA_TOKEN="your-api-token"
export JIRA_USER="your-email@example.com" # Optional (default: alex@drevops.com)
export JIRA_ENDPOINT="https://your-domain.atlassian.net" # Optional (default: https://drevops.atlassian.net)
Comment thread
AlexSkrypnyk marked this conversation as resolved.
export JIRA_ISSUE="PROJECT-123" # Optional (default: DEMO-2)
.vortex/tests/manual/try-jira-notification.sh branch # Test branch deployment
.vortex/tests/manual/try-jira-notification.sh pr # Test PR deployment

# JIRA authentication test (requires JIRA_TOKEN)
export JIRA_TOKEN="your-api-token"
.vortex/tests/manual/try-jira-auth.sh # Verify JIRA API access
```

**When to Use**:

- During notification script refactoring to verify real output formatting
- Before committing major notification changes
- To debug integration issues with external services
- After API updates to test compatibility

**Important Notes**:

- ⚠️ These send REAL notifications to live services (use test channels/projects)
- 🔐 Never commit credentials to version control
- 📚 See `.vortex/tests/manual/README.md` for comprehensive documentation
- 🧪 Manual tests complement automated BATS tests (real services vs mocks)

## Installer Fixture System

### Architecture
Expand Down Expand Up @@ -710,6 +779,11 @@ Each system:
├── phpunit/ # Workflow functional tests
│ ├── Functional/ # End-to-end workflow tests
│ └── Traits/ # Shared test functionality
├── manual/ # Manual integration tests
│ ├── try-slack-notification.sh # Slack webhook testing
│ ├── try-jira-notification.sh # JIRA API testing
│ ├── try-jira-auth.sh # JIRA authentication testing
│ └── README.md # Manual testing documentation
├── composer.json # PHP dependencies for template tests
└── [test scripts] # Individual test executables
```
Expand Down Expand Up @@ -769,6 +843,14 @@ Each system:
- Follow prefix rules: all-or-nothing for output assertions
- Prefer named arguments for complex parameters

**Manual Integration Tests**:

- Use manual scripts in `.vortex/tests/manual/` when refactoring notification integrations
- Always test with real services before updating automated BATS tests
- Verify message formatting in actual Slack/JIRA UI, not just script output
- Keep credentials in environment variables, never commit to version control
- Use test channels/projects to avoid cluttering production systems

## System-Specific Troubleshooting

### 1. Documentation Issues (.vortex/docs/)
Expand Down Expand Up @@ -832,6 +914,41 @@ UPDATE_FIXTURES=1 ./vendor/bin/phpunit --filter 'testInstall.*"scenario_name"'
- **PHPUnit workflow tests**: Slower (integration level, ~minutes)
- **Installer tests**: Slowest (full installation simulation, ~minutes)

### 4. Manual Integration Test Issues (.vortex/tests/manual/)

**Missing Credentials**:

```bash
# Verify environment variables are set
echo $SLACK_WEBHOOK_URL
echo $JIRA_TOKEN

# If not set, export them
export SLACK_WEBHOOK_URL="your-webhook-url"
export JIRA_TOKEN="your-api-token"
```

**Authentication Failures**:

- Use try-jira-auth.sh to diagnose JIRA authentication issues
- Verify API token has required permissions (comment, transition, assign)
- Check endpoint URL format (https://domain.atlassian.net)
- Ensure token hasn't expired or been revoked

**Message Format Issues**:

- Compare actual output in Slack/JIRA with expected format
- Check for JSON encoding issues in JIRA ADF format
- Verify URL formatting (links vs inline cards)
- Test both branch and PR scenarios to catch conditional logic issues

**Integration Failures**:

- Confirm services are accessible (not blocked by firewall/VPN)
- Verify webhook URLs are valid and not revoked
- Check issue keys exist and are accessible by user
- Review service-specific rate limits or quotas

## Shell Script Development Patterns

### Script Structure Best Practices
Expand Down
Loading