feat: Complete PII cleanup and fully automatic pipeline

🧹 PII Cleanup & Security:
- Remove all hardcoded domains (darknex.us, hndrx.co)
- Remove all hardcoded emails (admin@ references)
- Replace all personal info with environment variables
- Repository now 100% generic and reusable

🚀 Fully Automatic Pipeline:
- Pipeline now runs automatically develop → staging → production
- No manual intervention required for production promotions
- Auto-promotion triggers after successful tests
- All workflows use commit-specific image tags

🔧 Environment Variables:
- All manifests use ${VARIABLE_NAME} syntax
- All scripts source from .env file
- GitHub Actions use secrets for sensitive data
- Complete .env.example template provided

📚 Documentation:
- New comprehensive WORKFLOWS.md with pipeline details
- New PIPELINE_QUICK_REFERENCE.md for quick reference
- Updated all docs to use generic placeholders
- Added security/privacy section to README

🔐 Security Enhancements:
- Updated .gitignore for all sensitive files
- Created PII verification script (verify-pii-removal.sh)
- Created cleanup automation script (cleanup-pii.sh)
- Repository verified PII-free and production-ready

BREAKING: Repository now requires .env configuration
- Copy .env.example to .env and configure for your environment
- Set GitHub repository secrets for CI/CD workflows
- All deployments now use environment-specific configuration
This commit is contained in:
Greg
2025-07-01 17:30:26 -07:00
parent 6ffbe5dc31
commit 82fc2a6691
31 changed files with 737 additions and 127 deletions

View File

@@ -80,4 +80,7 @@ jobs:
echo "### 🔗 Next Steps" >> $GITHUB_STEP_SUMMARY
echo "- Staging deployment will start automatically" >> $GITHUB_STEP_SUMMARY
echo "- Staging tests will run automatically" >> $GITHUB_STEP_SUMMARY
echo "- Production promotion requires manual approval via staging → main merge" >> $GITHUB_STEP_SUMMARY
echo "- Production promotion will happen automatically after staging tests pass" >> $GITHUB_STEP_SUMMARY
echo "- Production deployment will happen automatically after promotion" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "🚀 **Fully Automatic Pipeline** - No manual intervention required!" >> $GITHUB_STEP_SUMMARY

View File

@@ -8,7 +8,7 @@ on:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ghndrx/k8s-game-2048
IMAGE_NAME: ${GITHUB_REPOSITORY}
jobs:
build:

View File

@@ -1,6 +1,8 @@
name: Deploy to Production
on:
push:
branches: [ main ]
workflow_dispatch:
inputs:
image_tag:
@@ -8,17 +10,12 @@ on:
required: false
default: 'latest'
confirmation:
description: 'Type "DEPLOY" to confirm production deployment'
description: 'Type "DEPLOY" to confirm manual production deployment'
required: true
source_environment:
description: 'Source environment (staging or manual)'
required: false
default: 'staging'
workflow_run:
workflows: ["Deploy to Staging"]
types:
- completed
branches: [ main, master ]
env:
REGISTRY: ghcr.io
@@ -30,7 +27,7 @@ jobs:
runs-on: ubuntu-latest
if: |
(github.event_name == 'workflow_dispatch' && github.event.inputs.confirmation == 'DEPLOY') ||
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
(github.event_name == 'push' && github.ref == 'refs/heads/main')
steps:
- name: Checkout repository
@@ -40,9 +37,11 @@ jobs:
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
IMAGE_TAG="${{ github.event.inputs.image_tag || 'latest' }}"
echo "🔧 Manual production deployment with image: $IMAGE_TAG"
else
# For production deployment, use the main branch commit tag
# For automatic production deployment, use the main branch commit tag
IMAGE_TAG="main-$(echo "${{ github.sha }}" | cut -c1-7)"
echo "🚀 Automatic production deployment with image: $IMAGE_TAG"
fi
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV
echo "Deploying image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$IMAGE_TAG"

View File

@@ -15,7 +15,7 @@ jobs:
- name: Check Development Status
run: |
echo "🧪 Checking Development Environment..."
DEV_URL="https://game-2048-dev.game-2048-dev.dev.wa.darknex.us"
DEV_URL="https://${{ secrets.DEV_DOMAIN }}"
DEV_STATUS=$(curl -s -o /dev/null -w "%{http_code}" -L --max-time 30 "$DEV_URL" || echo "000")
DEV_VERSION=$(curl -s -L --max-time 30 "$DEV_URL" | grep -o '<title>[^<]*</title>' | sed 's/<title>\(.*\)<\/title>/\1/' || echo "Unknown")
@@ -28,7 +28,7 @@ jobs:
- name: Check Staging Status
run: |
echo "🎭 Checking Staging Environment..."
STAGING_URL="https://game-2048-staging.game-2048-staging.staging.wa.darknex.us"
STAGING_URL="https://${{ secrets.STAGING_DOMAIN }}"
STAGING_STATUS=$(curl -s -o /dev/null -w "%{http_code}" -L --max-time 30 "$STAGING_URL" || echo "000")
STAGING_VERSION=$(curl -s -L --max-time 30 "$STAGING_URL" | grep -o '<title>[^<]*</title>' | sed 's/<title>\(.*\)<\/title>/\1/' || echo "Unknown")
@@ -41,7 +41,7 @@ jobs:
- name: Check Production Status
run: |
echo "🚀 Checking Production Environment..."
PROD_URL="https://game-2048-prod.game-2048-prod.wa.darknex.us"
PROD_URL="https://${{ secrets.PROD_DOMAIN }}"
PROD_STATUS=$(curl -s -o /dev/null -w "%{http_code}" -L --max-time 30 "$PROD_URL" || echo "000")
PROD_VERSION=$(curl -s -L --max-time 30 "$PROD_URL" | grep -o '<title>[^<]*</title>' | sed 's/<title>\(.*\)<\/title>/\1/' || echo "Unknown")
@@ -64,7 +64,7 @@ jobs:
else
DEV_ICON="❌"
fi
echo "| 🧪 Development | $DEV_ICON HTTP $DEV_STATUS | $DEV_VERSION | https://game-2048-dev.game-2048-dev.dev.wa.darknex.us |" >> $GITHUB_STEP_SUMMARY
echo "| 🧪 Development | $DEV_ICON HTTP $DEV_STATUS | $DEV_VERSION | https://${{ secrets.DEV_DOMAIN }} |" >> $GITHUB_STEP_SUMMARY
# Staging status
if [ "$STAGING_STATUS" = "200" ]; then
@@ -72,7 +72,7 @@ jobs:
else
STAGING_ICON="❌"
fi
echo "| 🎭 Staging | $STAGING_ICON HTTP $STAGING_STATUS | $STAGING_VERSION | https://game-2048-staging.game-2048-staging.staging.wa.darknex.us |" >> $GITHUB_STEP_SUMMARY
echo "| 🎭 Staging | $STAGING_ICON HTTP $STAGING_STATUS | $STAGING_VERSION | https://${{ secrets.STAGING_DOMAIN }} |" >> $GITHUB_STEP_SUMMARY
# Production status
if [ "$PROD_STATUS" = "200" ]; then
@@ -80,12 +80,14 @@ jobs:
else
PROD_ICON="❌"
fi
echo "| 🚀 Production | $PROD_ICON HTTP $PROD_STATUS | $PROD_VERSION | https://game-2048-prod.game-2048-prod.wa.darknex.us |" >> $GITHUB_STEP_SUMMARY
echo "| 🚀 Production | $PROD_ICON HTTP $PROD_STATUS | $PROD_VERSION | https://${{ secrets.PROD_DOMAIN }} |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 🔧 Manual Actions Available" >> $GITHUB_STEP_SUMMARY
echo "- **Deploy to Production**: Run 'Deploy to Production' workflow (requires typing 'DEPLOY')" >> $GITHUB_STEP_SUMMARY
echo "- **Promote to Production**: Run 'Promote to Production' workflow (requires typing 'PROMOTE')" >> $GITHUB_STEP_SUMMARY
echo "- **Run Smoke Tests**: Run 'Smoke Tests' workflow on any environment" >> $GITHUB_STEP_SUMMARY
echo "### 🔧 Emergency Actions Available" >> $GITHUB_STEP_SUMMARY
echo "- **Emergency Deploy**: Run 'Deploy to Production' workflow (requires typing 'DEPLOY')" >> $GITHUB_STEP_SUMMARY
echo "- **Force Promotion**: Run 'Auto-Promote to Production' workflow" >> $GITHUB_STEP_SUMMARY
echo "- **Test Environment**: Run 'Smoke Tests' workflow on any environment" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Note**: Pipeline is fully automatic - manual actions only for emergencies" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "📅 **Generated**: $(date -u '+%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_STEP_SUMMARY

View File

@@ -6,7 +6,7 @@ on:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ghndrx/k8s-game-2048
IMAGE_NAME: ${GITHUB_REPOSITORY}
jobs:
validate:

View File

@@ -1,4 +1,4 @@
name: Promote to Production
name: Auto-Promote to Production
on:
workflow_run:
@@ -8,11 +8,8 @@ on:
branches: [ staging ]
workflow_dispatch:
inputs:
confirmation:
description: 'Type "PROMOTE" to confirm staging → production promotion'
required: true
skip_tests:
description: 'Skip staging tests (use only if staging is already validated)'
description: 'Emergency override: Skip staging tests (use only if staging is already validated)'
required: false
default: false
type: boolean
@@ -23,7 +20,7 @@ jobs:
runs-on: ubuntu-latest
environment: staging
if: |
(github.event_name == 'workflow_dispatch' && github.event.inputs.confirmation == 'PROMOTE') ||
(github.event_name == 'workflow_dispatch') ||
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
steps:
@@ -43,12 +40,18 @@ jobs:
run: |
echo "✅ Staging smoke tests passed - proceeding with auto-promotion to production"
- name: Auto-promotion to production
if: github.event_name == 'workflow_run'
run: |
echo "<22> Staging smoke tests passed - automatically promoting to production"
echo "📋 Trigger: Automatic after staging tests"
echo "✅ No manual intervention required"
- name: Manual promotion confirmation
if: github.event_name == 'workflow_dispatch'
run: |
echo "🔒 Manual promotion to production confirmed"
echo "🔧 Manual promotion to production triggered"
echo "📋 Trigger: ${{ github.event_name }}"
echo "🎯 Confirmation: ${{ github.event.inputs.confirmation }}"
echo "⚡ Skip tests: ${{ github.event.inputs.skip_tests }}"
- name: Auto-promote staging to main branch
@@ -56,7 +59,7 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
console.log('🎯 All staging smoke tests passed! Auto-promoting staging to main branch...');
console.log('🚀 All staging smoke tests passed! Auto-promoting staging to main for production deployment...');
// Create a merge from staging to main
try {
@@ -99,9 +102,9 @@ jobs:
echo "### 🎮 Deployment Status" >> $GITHUB_STEP_SUMMARY
# Use canonical domain format (these are the Knative domains)
DEV_URL="https://game-2048-dev.game-2048-dev.dev.wa.darknex.us"
STAGING_URL="https://game-2048-staging.game-2048-staging.staging.wa.darknex.us"
PROD_URL="https://game-2048-prod.game-2048-prod.wa.darknex.us"
DEV_URL="https://${{ secrets.DEV_DOMAIN }}"
STAGING_URL="https://${{ secrets.STAGING_DOMAIN }}"
PROD_URL="https://${{ secrets.PROD_DOMAIN }}"
echo "- **Development**: ✅ Live at $DEV_URL" >> $GITHUB_STEP_SUMMARY
echo "- **Staging**: ✅ Live at $STAGING_URL" >> $GITHUB_STEP_SUMMARY

View File

@@ -44,15 +44,15 @@ jobs:
run: |
case "${{ matrix.environment }}" in
dev)
echo "CANONICAL_DOMAIN=https://game-2048-dev.game-2048-dev.dev.wa.darknex.us" >> $GITHUB_ENV
echo "CANONICAL_DOMAIN=https://${{ secrets.DEV_DOMAIN }}" >> $GITHUB_ENV
echo "ENV_NAME=development" >> $GITHUB_ENV
;;
staging)
echo "CANONICAL_DOMAIN=https://game-2048-staging.game-2048-staging.staging.wa.darknex.us" >> $GITHUB_ENV
echo "CANONICAL_DOMAIN=https://${{ secrets.STAGING_DOMAIN }}" >> $GITHUB_ENV
echo "ENV_NAME=staging" >> $GITHUB_ENV
;;
prod)
echo "CANONICAL_DOMAIN=https://game-2048-prod.game-2048-prod.wa.darknex.us" >> $GITHUB_ENV
echo "CANONICAL_DOMAIN=https://${{ secrets.PROD_DOMAIN }}" >> $GITHUB_ENV
echo "ENV_NAME=production" >> $GITHUB_ENV
;;
esac
@@ -157,9 +157,9 @@ jobs:
# Canonical domains (Knative domains only)
canonical_domains=(
"game-2048-dev.game-2048-dev.dev.wa.darknex.us"
"game-2048-staging.game-2048-staging.staging.wa.darknex.us"
"game-2048-prod.game-2048-prod.wa.darknex.us"
"${{ secrets.DEV_DOMAIN }}"
"${{ secrets.STAGING_DOMAIN }}"
"${{ secrets.PROD_DOMAIN }}"
)
for domain in "${canonical_domains[@]}"; do
@@ -179,9 +179,9 @@ jobs:
# Canonical domains (Knative domains only)
canonical_domains=(
"game-2048-dev.game-2048-dev.dev.wa.darknex.us"
"game-2048-staging.game-2048-staging.staging.wa.darknex.us"
"game-2048-prod.game-2048-prod.wa.darknex.us"
"${{ secrets.DEV_DOMAIN }}"
"${{ secrets.STAGING_DOMAIN }}"
"${{ secrets.PROD_DOMAIN }}"
)
for domain in "${canonical_domains[@]}"; do
@@ -231,9 +231,9 @@ jobs:
echo "### Tested Canonical Domains" >> $GITHUB_STEP_SUMMARY
# Use canonical domain format
DEV_URL="https://game-2048-dev.game-2048-dev.dev.wa.darknex.us"
STAGING_URL="https://game-2048-staging.game-2048-staging.staging.wa.darknex.us"
PROD_URL="https://game-2048-prod.game-2048-prod.wa.darknex.us"
DEV_URL="https://${{ secrets.DEV_DOMAIN }}"
STAGING_URL="https://${{ secrets.STAGING_DOMAIN }}"
PROD_URL="https://${{ secrets.PROD_DOMAIN }}"
echo "- 🧪 Development: $DEV_URL" >> $GITHUB_STEP_SUMMARY
echo "- 🎭 Staging: $STAGING_URL" >> $GITHUB_STEP_SUMMARY