|
70 | 70 | jobs: |
71 | 71 | docker-build: |
72 | 72 | # ============================================================================ |
73 | | - # DOCKER BUILD JOB - When does it run? |
| 73 | + # DOCKER BUILD JOB SCENARIOS |
74 | 74 | # ============================================================================ |
75 | | - # ✅ RUNS ONLY WHEN: |
76 | | - # - Trigger = Manual (workflow_dispatch) |
77 | | - # AND "Build and push Docker image" checkbox = ✅ CHECKED |
| 75 | + # Condition: Manual trigger + "Build Docker image" checkbox checked |
78 | 76 | # |
79 | | - # ❌ SKIPPED WHEN: |
80 | | - # - Any automatic trigger (Pull Request, Schedule, Workflow Run) |
81 | | - # - Manual trigger but "Build and push Docker image" = ❌ UNCHECKED |
82 | | - # - Manual trigger but checkbox not provided (defaults to false) |
| 77 | + # | Trigger Type | Build Checkbox | Result | Image Used | |
| 78 | + # |-----------------|----------------|----------|-----------------------| |
| 79 | + # | Pull Request | N/A | ❌ SKIP | Branch image | |
| 80 | + # | Schedule | N/A | ❌ SKIP | latest_waf | |
| 81 | + # | Workflow Run | N/A | ❌ SKIP | Branch image | |
| 82 | + # | Manual | ✅ Checked | ✅ RUN | Custom unique tag | |
| 83 | + # | Manual | ❌ Unchecked | ❌ SKIP | Branch image | |
83 | 84 | # |
84 | | - # SIMPLE RULE: Only builds Docker when you manually trigger AND check the box! |
| 85 | + # Output: IMAGE_TAG (if runs) → Used by deploy job for custom deployments |
85 | 86 | # ============================================================================ |
86 | 87 | if: github.event_name == 'workflow_dispatch' && github.event.inputs.build_docker_image == 'true' |
87 | 88 | runs-on: ubuntu-latest |
@@ -135,18 +136,19 @@ jobs: |
135 | 136 |
|
136 | 137 | deploy: |
137 | 138 | # ============================================================================ |
138 | | - # DEPLOY JOB - When does it run? |
| 139 | + # DEPLOY JOB SCENARIOS |
139 | 140 | # ============================================================================ |
140 | | - # ✅ RUNS WHEN: |
141 | | - # - ANY automatic trigger (Pull Request, Schedule, Workflow Run) = ALWAYS RUNS |
142 | | - # - Manual trigger with "Existing WebApp URL" = EMPTY/BLANK |
143 | | - # - Manual trigger with "Existing WebApp URL" = NOT PROVIDED |
| 141 | + # Condition: Auto trigger OR Manual with no existing webapp URL |
144 | 142 | # |
145 | | - # ❌ SKIPPED WHEN: |
146 | | - # - Manual trigger with "Existing WebApp URL" = PROVIDED/FILLED |
147 | | - # (Why skip? Because you want to test existing app, not deploy new one!) |
| 143 | + # | Trigger Type | Existing URL | Result | Purpose | |
| 144 | + # |-----------------|-----------------|----------|------------------------| |
| 145 | + # | Pull Request | N/A | ✅ RUN | Test PR changes | |
| 146 | + # | Schedule | N/A | ✅ RUN | Regular validation | |
| 147 | + # | Workflow Run | N/A | ✅ RUN | Deploy after build | |
| 148 | + # | Manual | Empty/None | ✅ RUN | Fresh deployment | |
| 149 | + # | Manual | Provided URL | ❌ SKIP | Test existing only | |
148 | 150 | # |
149 | | - # SIMPLE RULE: Deploys new infrastructure unless you provide existing webapp URL! |
| 151 | + # Dependencies: Waits for docker-build (uses always() if build skips) |
150 | 152 | # ============================================================================ |
151 | 153 | if: always() && (github.event_name != 'workflow_dispatch' || github.event.inputs.existing_webapp_url == '' || github.event.inputs.existing_webapp_url == null) |
152 | 154 | needs: [docker-build] |
@@ -555,44 +557,44 @@ jobs: |
555 | 557 |
|
556 | 558 | e2e-test: |
557 | 559 | # ============================================================================ |
558 | | - # E2E TEST JOB - When does it run? |
| 560 | + # E2E TEST JOB SCENARIOS |
559 | 561 | # ============================================================================ |
560 | | - # ✅ RUNS WHEN: |
561 | | - # - Deploy job succeeded AND "Run end-to-end tests" = ✅ CHECKED (default) |
562 | | - # - Manual trigger with "Existing WebApp URL" provided AND tests = ✅ CHECKED |
563 | | - # - Any automatic trigger (tests always run by default if deploy succeeds) |
| 562 | + # Condition: Webapp available (deployed OR existing) AND tests enabled |
564 | 563 | # |
565 | | - # ❌ SKIPPED WHEN: |
566 | | - # - Deploy job failed or was skipped |
567 | | - # - Manual trigger with "Run end-to-end tests" = ❌ UNCHECKED |
568 | | - # - No webapp available (neither deployed nor existing URL provided) |
| 564 | + # | Deploy Result | Existing URL | Test Checkbox | Result | Test Target | |
| 565 | + # |---------------|--------------|--------------- |----------|----------------| |
| 566 | + # | Success | N/A | Auto/✅/Default | ✅ RUN | Deployed URL | |
| 567 | + # | Success | Provided | Auto/✅/Default | ✅ RUN | Existing URL | |
| 568 | + # | Failed | Provided | Auto/✅/Default | ✅ RUN | Existing URL | |
| 569 | + # | Failed | N/A | Any | ❌ SKIP | No URL | |
| 570 | + # | Success | N/A | ❌ Unchecked | ❌ SKIP | Tests disabled | |
| 571 | + # | Success | Provided | ❌ Unchecked | ❌ SKIP | Tests disabled | |
569 | 572 | # |
570 | | - # SIMPLE RULE: Tests run against any available webapp unless you uncheck the box! |
| 573 | + # URL Priority: existing_webapp_url || deployed WEBAPP_URL |
571 | 574 | # ============================================================================ |
572 | | - if: (needs.deploy.result == 'success' || github.event.inputs.existing_webapp_url != '') && (github.event_name != 'workflow_dispatch' || github.event.inputs.run_e2e_tests == 'true' || github.event.inputs.run_e2e_tests == null) |
573 | | - needs: [deploy] |
| 575 | + if: always() && ((needs.deploy.result == 'success' && needs.deploy.outputs.WEBAPP_URL != '') || (github.event.inputs.existing_webapp_url != '' && github.event.inputs.existing_webapp_url != null)) && (github.event_name != 'workflow_dispatch' || github.event.inputs.run_e2e_tests == 'true' || github.event.inputs.run_e2e_tests == null) |
| 576 | + needs: [docker-build, deploy] |
574 | 577 | uses: ./.github/workflows/test-automation.yml |
575 | 578 | with: |
576 | 579 | DOCGEN_URL: ${{ github.event.inputs.existing_webapp_url || needs.deploy.outputs.WEBAPP_URL }} |
577 | 580 | secrets: inherit |
578 | 581 |
|
579 | 582 | cleanup-deployment: |
580 | 583 | # ============================================================================ |
581 | | - # CLEANUP JOB - When does it run? |
| 584 | + # CLEANUP JOB SCENARIOS |
582 | 585 | # ============================================================================ |
583 | | - # ✅ RUNS WHEN: |
584 | | - # - Deploy job succeeded (created new resources to clean up) |
585 | | - # - Resource group was created (has RESOURCE_GROUP_NAME output) |
586 | | - # - "Existing WebApp URL" = EMPTY (means we deployed new stuff to clean) |
587 | | - # - "Cleanup deployed resources" = ✅ CHECKED (default) OR not manual trigger |
| 586 | + # Condition: Deploy succeeded + Resource group created + No existing URL + Cleanup enabled |
588 | 587 | # |
589 | | - # ❌ SKIPPED WHEN: |
590 | | - # - Deploy job failed (nothing to clean up) |
591 | | - # - "Existing WebApp URL" provided (didn't deploy new resources) |
592 | | - # - Manual trigger with "Cleanup deployed resources" = ❌ UNCHECKED |
593 | | - # - No resource group name available (deployment didn't create resources) |
| 588 | + # | Deploy Result | Resource Group | Existing URL | Cleanup Checkbox | Result | Actions | |
| 589 | + # |---------------|----------------|--------------|------------------|----------|------------------| |
| 590 | + # | Success | Created | N/A | Auto/✅/Default | ✅ RUN | Delete RG + ACR | |
| 591 | + # | Success | Created | N/A | ❌ Unchecked | ❌ SKIP | Keep resources | |
| 592 | + # | Success | Created | Provided | Any | ❌ SKIP | No new resources | |
| 593 | + # | Failed | N/A | Any | Any | ❌ SKIP | Nothing to clean | |
| 594 | + # | Success | None | Any | Any | ❌ SKIP | No resources | |
594 | 595 | # |
595 | | - # SIMPLE RULE: Cleans up newly deployed resources unless you uncheck the box! |
| 596 | + # Actions: Deletes resource group + custom Docker images (preserves standard tags) |
| 597 | + # Dependencies: Waits for all jobs (docker-build, deploy, e2e-test) |
596 | 598 | # ============================================================================ |
597 | 599 | if: always() && needs.deploy.result == 'success' && needs.deploy.outputs.RESOURCE_GROUP_NAME != '' && github.event.inputs.existing_webapp_url == '' && (github.event_name != 'workflow_dispatch' || github.event.inputs.cleanup_resources == 'true' || github.event.inputs.cleanup_resources == null) |
598 | 600 | needs: [docker-build, deploy, e2e-test] |
|
0 commit comments