feat(ci): add conditional execution for expensive CI jobs #1823

Open
opened 2026-04-02 23:55:46 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: feature/ci-conditional-job-execution
  • Commit Message: feat(ci): add conditional execution for expensive CI jobs
  • Milestone: v3.8.0
  • Parent Epic: #1678

Background and Context

The CI pipeline currently runs all jobs unconditionally on every push and pull request. Several expensive jobs — e2e_tests, integration_tests, docker, helm, and build — execute even when the triggering change cannot possibly affect them (e.g., a documentation-only commit, a draft PR, or a change confined to test fixtures). This wastes shared runner capacity and increases developer feedback latency.

The benchmark-regression and benchmark-publish jobs already demonstrate the pattern: they use if: conditions to gate execution on event type. The remaining heavy jobs should follow the same approach.

Current Behavior

  • e2e_tests, integration_tests, docker, helm, and build run on every push to master/develop and every PR targeting those branches, regardless of what changed.
  • Draft PRs trigger the full suite, including LLM-API-dependent integration and E2E jobs.
  • Documentation-only commits (changes confined to docs/, *.md, *.rst) trigger Docker builds, Helm linting, and E2E test runs.
  • The status-check job unconditionally requires all jobs to succeed, which means skipped jobs currently cause it to fail if any conditional is added without updating status-check to handle skipped results.

Expected Behavior

  • e2e_tests and integration_tests are skipped on draft PRs and on pushes/PRs where all changed files match a docs-only path pattern.
  • docker and helm are skipped when no files under src/, Dockerfile*, k8s/, or pyproject.toml have changed.
  • build is skipped on draft PRs.
  • status-check treats skipped as an acceptable result for conditionally-gated jobs so that the overall status gate still passes when jobs are legitimately skipped.
  • All conditions are expressed as if: fields on the job definitions in .forgejo/workflows/ci.yml.

Acceptance Criteria

  • e2e_tests has an if: condition that skips it on draft PRs (forgejo.event.pull_request.draft == true) and on docs-only changesets.
  • integration_tests has an if: condition that skips it on draft PRs.
  • docker has an if: condition that skips it when no source, Dockerfile, or Helm files changed.
  • helm has an if: condition that skips it when no Helm chart or Kubernetes manifest files changed.
  • build has an if: condition that skips it on draft PRs.
  • status-check is updated to accept skipped as a passing result for all conditionally-gated jobs.
  • features/ci_workflow_validation.feature is updated with scenarios asserting the new conditional logic.
  • All nox stages pass locally after the changes.
  • Coverage remains ≥ 97%.

Supporting Information

  • Parent Epic: #1678 (CI Execution Time Optimization — Timeouts, Concurrency, and Coverage Artifact Sharing)
  • Existing conditional pattern in the same file: benchmark-regression (if: forgejo.event_name == 'pull_request') and benchmark-publish (if: forgejo.event_name == 'push' && ...).
  • Forgejo Actions if: expression syntax mirrors GitHub Actions; path-filter conditions can be implemented via a paths filter on the on: trigger or via a dedicated changed-files step.

Subtasks

  • Add if: condition to e2e_tests job to skip on draft PRs and docs-only changesets
  • Add if: condition to integration_tests job to skip on draft PRs
  • Add if: condition to docker job to skip when no source/Dockerfile/Helm files changed
  • Add if: condition to helm job to skip when no Helm/k8s files changed
  • Add if: condition to build job to skip on draft PRs
  • Update status-check to treat skipped as passing for all conditionally-gated jobs
  • Tests (Behave): Update features/ci_workflow_validation.feature with scenarios for each new condition
  • Tests (Robot): Add or update integration smoke test asserting ci.yml structure is valid
  • Verify coverage ≥ 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly (feat(ci): add conditional execution for expensive CI jobs), followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly (feature/ci-conditional-job-execution).
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
  • All nox stages pass.
  • Coverage ≥ 97%.

Automated by CleverAgents Bot
Supervisor: Unknown | Agent: ca-new-issue-creator

## Metadata - **Branch**: `feature/ci-conditional-job-execution` - **Commit Message**: `feat(ci): add conditional execution for expensive CI jobs` - **Milestone**: v3.8.0 - **Parent Epic**: #1678 ## Background and Context The CI pipeline currently runs all jobs unconditionally on every push and pull request. Several expensive jobs — `e2e_tests`, `integration_tests`, `docker`, `helm`, and `build` — execute even when the triggering change cannot possibly affect them (e.g., a documentation-only commit, a draft PR, or a change confined to test fixtures). This wastes shared runner capacity and increases developer feedback latency. The `benchmark-regression` and `benchmark-publish` jobs already demonstrate the pattern: they use `if:` conditions to gate execution on event type. The remaining heavy jobs should follow the same approach. ## Current Behavior - `e2e_tests`, `integration_tests`, `docker`, `helm`, and `build` run on every push to `master`/`develop` and every PR targeting those branches, regardless of what changed. - Draft PRs trigger the full suite, including LLM-API-dependent integration and E2E jobs. - Documentation-only commits (changes confined to `docs/`, `*.md`, `*.rst`) trigger Docker builds, Helm linting, and E2E test runs. - The `status-check` job unconditionally requires all jobs to succeed, which means skipped jobs currently cause it to fail if any conditional is added without updating `status-check` to handle `skipped` results. ## Expected Behavior - `e2e_tests` and `integration_tests` are skipped on draft PRs and on pushes/PRs where all changed files match a docs-only path pattern. - `docker` and `helm` are skipped when no files under `src/`, `Dockerfile*`, `k8s/`, or `pyproject.toml` have changed. - `build` is skipped on draft PRs. - `status-check` treats `skipped` as an acceptable result for conditionally-gated jobs so that the overall status gate still passes when jobs are legitimately skipped. - All conditions are expressed as `if:` fields on the job definitions in `.forgejo/workflows/ci.yml`. ## Acceptance Criteria - [ ] `e2e_tests` has an `if:` condition that skips it on draft PRs (`forgejo.event.pull_request.draft == true`) and on docs-only changesets. - [ ] `integration_tests` has an `if:` condition that skips it on draft PRs. - [ ] `docker` has an `if:` condition that skips it when no source, Dockerfile, or Helm files changed. - [ ] `helm` has an `if:` condition that skips it when no Helm chart or Kubernetes manifest files changed. - [ ] `build` has an `if:` condition that skips it on draft PRs. - [ ] `status-check` is updated to accept `skipped` as a passing result for all conditionally-gated jobs. - [ ] `features/ci_workflow_validation.feature` is updated with scenarios asserting the new conditional logic. - [ ] All nox stages pass locally after the changes. - [ ] Coverage remains ≥ 97%. ## Supporting Information - Parent Epic: #1678 (CI Execution Time Optimization — Timeouts, Concurrency, and Coverage Artifact Sharing) - Existing conditional pattern in the same file: `benchmark-regression` (`if: forgejo.event_name == 'pull_request'`) and `benchmark-publish` (`if: forgejo.event_name == 'push' && ...`). - Forgejo Actions `if:` expression syntax mirrors GitHub Actions; path-filter conditions can be implemented via a `paths` filter on the `on:` trigger or via a dedicated `changed-files` step. ## Subtasks - [ ] Add `if:` condition to `e2e_tests` job to skip on draft PRs and docs-only changesets - [ ] Add `if:` condition to `integration_tests` job to skip on draft PRs - [ ] Add `if:` condition to `docker` job to skip when no source/Dockerfile/Helm files changed - [ ] Add `if:` condition to `helm` job to skip when no Helm/k8s files changed - [ ] Add `if:` condition to `build` job to skip on draft PRs - [ ] Update `status-check` to treat `skipped` as passing for all conditionally-gated jobs - [ ] Tests (Behave): Update `features/ci_workflow_validation.feature` with scenarios for each new condition - [ ] Tests (Robot): Add or update integration smoke test asserting `ci.yml` structure is valid - [ ] Verify coverage ≥ 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly (`feat(ci): add conditional execution for expensive CI jobs`), followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly (`feature/ci-conditional-job-execution`). - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. - All nox stages pass. - Coverage ≥ 97%. --- **Automated by CleverAgents Bot** Supervisor: Unknown | Agent: ca-new-issue-creator
freemo added this to the v3.8.0 milestone 2026-04-02 23:57:23 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • MoSCoW: MoSCoW/Could Have — CI/test infrastructure improvement.

Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: ca-project-owner

Issue triaged by project owner: - **State**: Verified - **MoSCoW**: MoSCoW/Could Have — CI/test infrastructure improvement. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#1823
No description provided.