diff --git a/.github/workflows/monthly-capacity-report.yml b/.github/workflows/monthly-capacity-report.yml
index 52b59b4b0..ff140581f 100644
--- a/.github/workflows/monthly-capacity-report.yml
+++ b/.github/workflows/monthly-capacity-report.yml
@@ -13,39 +13,84 @@ permissions:
id-token: write # Required for AWS OIDC authentication
jobs:
- generate-report:
+ export-dashboards:
runs-on: ubuntu-latest
- environment: prod
+ environment: reporting
+ strategy:
+ matrix:
+ env_config:
+ - name: Prod
+ dashboard: Demand_And_Capacity_Prod
+ account_secret: AWS_PROD_ACCOUNT_ID
+ - name: Preprod
+ dashboard: Demand_And_Capacity_Preprod
+ account_secret: AWS_PREPROD_ACCOUNT_ID
+ - name: Test
+ dashboard: Demand_And_Capacity_Test
+ account_secret: AWS_TEST_ACCOUNT_ID
+ - name: Dev
+ dashboard: Demand_And_Capacity_Dev
+ account_secret: AWS_DEV_ACCOUNT_ID
steps:
- name: Checkout code
- uses: actions/checkout@v6
+ uses: actions/checkout@v4
- name: Set up Python
- uses: actions/setup-python@v6
+ uses: actions/setup-python@v5
with:
python-version: "3.11"
- - name: "Configure AWS Credentials"
+ - name: Configure AWS Credentials (${{ matrix.env_config.name }})
uses: aws-actions/configure-aws-credentials@v5
with:
- role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/service-roles/github-actions-api-deployment-role
+ role-to-assume: arn:aws:iam::${{ secrets[matrix.env_config.account_secret] }}:role/service-roles/github-actions-api-deployment-role
aws-region: eu-west-2
- - name: Generate dashboard report
+ - name: Export Dashboard (${{ matrix.env_config.name }})
run: |
chmod +x scripts/export_dashboard_image.sh
- ./scripts/export_dashboard_image.sh Demand_And_Capacity_Prod
+ ./scripts/export_dashboard_image.sh ${{ matrix.env_config.dashboard }} ${{ matrix.env_config.name }}
env:
AWS_REGION: eu-west-2
+ - name: Upload dashboard export
+ uses: actions/upload-artifact@v4
+ with:
+ name: dashboard-${{ matrix.env_config.name }}
+ path: dashboard_exports/**/*
+
+ generate-report:
+ runs-on: ubuntu-latest
+ needs: export-dashboards
+ environment: reporting
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v6
+
+ - name: Set up Python
+ uses: actions/setup-python@v6
+ with:
+ python-version: "3.11"
+
+ - name: Download all dashboard exports
+ uses: actions/download-artifact@v4
+ with:
+ path: dashboard_exports
+ pattern: dashboard-*
+ merge-multiple: true
+
+ - name: Generate Combined Report
+ run: python3 scripts/generate_dashboard_report.py --input dashboard_exports
+
- name: Upload report as artifact
uses: actions/upload-artifact@v5
with:
name: capacity-report
path: |
- dashboard_exports/*.html
- dashboard_exports/*.png
+ dashboard_exports/**/*.html
+ dashboard_exports/**/*.png
retention-days: 90
- name: Send to Slack
@@ -54,21 +99,20 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_D_AND_C_WEBHOOK }}
run: |
# Get the latest HTML report
- REPORT_FILE=$(ls -t dashboard_exports/dashboard_report_*.html | head -1)
+ REPORT_FILE=$(find dashboard_exports -name "dashboard_report_*.html" | head -n 1)
REPORT_NAME=$(basename "$REPORT_FILE")
# GitHub Actions URL
GITHUB_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
- # Send Slack notification with simple variables for Workflow Automation
+ # Send Slack notification
curl -X POST "$SLACK_WEBHOOK_URL" \
-H 'Content-Type: application/json' \
-d @- <
No images found for {env_name}
" + + html = f""" +