7.8 KiB
Executable File
title, status, scope
| title | status | scope |
|---|---|---|
| CI Sequencing and Parallelization | draft | ci/pipeline, ci/integration, ci/coverage, ci/security |
1. Introduction
This plan reorders CI job dependencies so lint remains first, integration runs after image build, E2E depends on integration-gate, and coverage/security jobs run in parallel with E2E once integration has passed.
Objectives:
- Keep
lintas the earliest gate beforebuild-image. - Ensure integration tests run after
build-imageand beforee2e. - Make
e2edepend onintegration-gate. - Start coverage and security jobs after
integration-gateso they complete while E2E runs. - Preserve strict gating: if a required stage is skipped or fails, downstream gates fail.
2. Research Findings
2.1 Current CI Ordering
lintruns first and gatesbuild-image.- Integration jobs depend on
build-image, thenintegration-gateaggregates results. e2edepends only onbuild-image.- Coverage and security jobs depend on
build-image(CodeQL has no dependencies). codecov-uploaddepends oncoverage-gateande2e.pipeline-gateevaluates gate jobs based on input flags, not on integration status.
2.2 Impact of Current Ordering
- E2E can run without integration tests completing.
- Coverage and security jobs start before or during integration, competing for runners.
security-codeqlcan start immediately, cluttering early logs.
3. Technical Specifications
3.1 Target Dependency Graph
setup -> lint -> build-image
build-image -> integration-* -> integration-gate
integration-gate -> e2e -> e2e-gate
integration-gate -> coverage-* -> coverage-gate
integration-gate -> security-* -> security-gate
coverage-gate + e2e -> codecov-upload -> codecov-gate
pipeline-gate depends on lint, build-image, integration-gate, e2e-gate, coverage-gate, codecov-gate, security-gate
3.2 Job Dependency Updates
Update .github/workflows/ci-pipeline.yml:
-
e2e:needs:build-image,integration-gate.if: requireneeds.integration-gate.result == 'success'andneeds.build-image.result == 'success'and the existingrun_e2einput guard.- Keep
build-imageinneedsforimage_refoutputs.
-
e2e-gate:- Keep
needs: e2e. - Update
ifguard to require integration to have run (see Section 3.4) so skips are treated consistently.
- Keep
-
coverage-backendandcoverage-frontend:needs:integration-gate.if: existingrun_coverageinput guard ANDneeds.integration-gate.result == 'success'.- No
build-imagedependency is required for coverage tests.
-
security-codeql:- Add
needs: integration-gate. if: existingrun_security_scansguard ANDneeds.integration-gate.result == 'success'AND the existing fork guard.
- Add
-
security-trivyandsecurity-supply-chain:needs:build-image,integration-gate.if: existing guards ANDneeds.integration-gate.result == 'success'.
-
security-gate:- Keep
needson all security jobs. if: same as today, plus integration-enabled guard (Section 3.4).
- Keep
3.3 Parallelization Strategy
- Once
integration-gatesucceeds, starte2e,coverage-*, andsecurity-*concurrently. - This ensures non-E2E work completes during the longer E2E runtime window.
3.4 Enablement and Strict Gating Logic
Adjust enablement expressions so skip behavior is intentional and strict:
- Define an integration-enabled expression for reuse:
integration_enabled = needs.build-image.outputs.run_integration == 'true'
- Define an integration-gate pass-or-skip expression for reuse:
integration_gate_ok = needs.integration-gate.result == 'success' || needs.integration-gate.result == 'skipped'
Update gate conditions to include integration_enabled:
-
e2eande2e-gate:- Only enabled if
run_e2eis not false. - Add guard:
always() && integration_gate_okso fork PRs (integration skipped) still run.
- Only enabled if
-
coverage-*,coverage-gate,codecov-upload,codecov-gate:- Only enabled if
run_coverageis not false. - Add guard:
always() && integration_gate_okso fork PRs (integration skipped) still run.
- Only enabled if
-
security-*,security-gate:- Only enabled if
run_security_scansis not false (and fork guard for CodeQL/Trivy/SBOM). - Add guard:
always() && integration_gate_okso fork PRs (integration skipped) still run.
- Only enabled if
-
pipeline-gate:- Update enabled checks (
e2e_enabled,coverage_enabled,security_enabled) to useintegration_gate_ok(notintegration_enabled). - Keep strict gating: when enabled, skipped results remain failures.
- Update enabled checks (
3.5 Artifact and Output Dependencies
codecov-uploadcontinues to depend one2efor E2E coverage artifacts and oncoverage-gatefor unit coverage.security-trivyandsecurity-supply-chaincontinue usingneeds.build-image.outputs.image_ref_dockerhub.
3.6 Data Flow and Runners
- Integration is isolated to its phase, reducing early runner contention.
- The post-integration phase allows
e2e,coverage-*, andsecurity-*to run in parallel.
4. Implementation Plan
Phase 1: Playwright Tests (Behavior Baseline)
- No UI behavior changes are expected; treat as baseline verification only.
Phase 2: Dependency Rewire
- Update
e2eto requireintegration-gateandbuild-image. - Add
integration-gatetocoverage-*andsecurity-*needs. - Move
security-codeqlbehindintegration-gate.
Phase 3: Strict Gating Alignment
- Update job
ifconditions to includeintegration_enabled. - Update
pipeline-gateenablement logic to match new gating rules.
Phase 4: Validation
- Verify that
lint -> build-image -> integration -> e2eis enforced. - Confirm coverage and security jobs start only after integration succeeds.
- Confirm
codecov-uploadandcodecov-gatestill run after coverage and E2E are complete.
5. Acceptance Criteria (EARS)
- WHEN a pipeline starts, THE SYSTEM SHALL run
lintbeforebuild-image. - WHEN
build-imagesucceeds and integration is enabled, THE SYSTEM SHALL run all integration tests and aggregate them inintegration-gate. - WHEN
integration-gatesucceeds or is skipped and E2E is enabled, THE SYSTEM SHALL starte2eand require it to pass beforee2e-gatesucceeds. - WHEN
integration-gatesucceeds or is skipped and coverage is enabled, THE SYSTEM SHALL startcoverage-backendandcoverage-frontendin parallel with E2E. - WHEN
integration-gatesucceeds or is skipped and security scans are enabled, THE SYSTEM SHALL startsecurity-codeql,security-trivy, andsecurity-supply-chainin parallel with E2E. - WHEN integration is skipped for fork PRs (
run_integration=false), THE SYSTEM SHALL still rune2e,coverage-*, andsecurity-*if their respective enablement flags are true. - IF
integration-gateis not successful while integration is enabled, THEN THE SYSTEM SHALL skipe2e,coverage-*, andsecurity-*and fail the appropriate gates. - WHEN coverage and E2E complete successfully, THE SYSTEM SHALL run
codecov-uploadandcodecov-gate.
6. Risks and Mitigations
-
Risk: Coupling coverage/security to integration could reduce flexibility for ad-hoc runs. Mitigation: Keep
run_integrationdefault true; document that disabling integration disables downstream stages. -
Risk: CodeQL no longer starts early, increasing total elapsed time for that job. Mitigation: CodeQL runs in parallel with E2E to keep total pipeline time stable.
-
Risk: Misaligned gate logic could mark expected skips as failures. Mitigation: Centralize enablement logic (
integration_enabled) and apply consistently in jobifconditions andpipeline-gate.
7. Confidence Score
Confidence: 88 percent
Rationale: The sequencing changes are localized to job needs and if expressions. The main uncertainty is ensuring gate logic stays strict while respecting the new integration-first requirement.