Skip to content

build(ci): decide "does this need a build" in one reusable workflow - #1965

Merged
lukaszlenart merged 3 commits into
mainfrom
build/ci-skip-process-docs
Sep 18, 2026
Merged

lukaszlenart merged 3 commits into
mainfrom
build/ci-skip-process-docs

Conversation

@lukaszlenart

@lukaszlenart lukaszlenart commented Sep 18, 2026

Copy link
Copy Markdown
Member

Summary

CLAUDE.md, AGENTS.md, SECURITY.md and THREAT_MODEL.md feed nothing in the build, packaging or runtime, yet every edit to them ran the full JDK matrix plus Sonar, CodeQL, OWASP and the ASF Jenkins build.

The first cut added them beside .claude/** in every paths-ignore — five copies of a list that must stay identical, plus a sixth in the maven.yml changes job. Path filters under on: can't be shared (no anchors, no variables), so the decision moves out of the triggers into one reusable workflow.

Changes

  • New changes.yml (workflow_call) — owns the skip list and outputs code. Lists changed files from the pull-request files API on pull_request, from the compare API on push, and builds for any other event (workflow_dispatch, workflow_call, a new branch) or whenever the list cannot be fetched. Patterns are anchored to the repository root: core/SECURITY.md or SECURITY.md.bak still build.
  • maven.yml — the inline changes job replaced by uses: ./.github/workflows/changes.yml; step-level gating on the build matrix unchanged, so Build and Test (JDK 17) keeps reporting and the PR stays mergeable.
  • sonar.yml, codeql.yml, owasp.yml — every paths-ignore removed; each gets a changes job and gates its real job with needs/if.
  • codeql.yml permissions — Sonar S8233 flagged the workflow-level security-events: write / id-token: write. The analyze job has always had its own block (which replaces the workflow-level one), so those grants never reached it; the workflow level is now contents: read and security-events: write stays on the job that uploads. Effective permissions unchanged.
  • Jenkinsfile — Jenkins can't call a GitHub reusable workflow, so its own copy of the filter is extended to the same anchored pattern; the two copies cross-reference each other.

Cost: each GitHub workflow now starts one short runner per event to evaluate the filter instead of not triggering at all.

Verification

CI change, no ticket.

🤖 Generated with Claude Code

CLAUDE.md, AGENTS.md, SECURITY.md and THREAT_MODEL.md feed nothing in the
build, packaging or runtime, yet every edit to them ran the full matrix plus
Sonar, CodeQL and OWASP. Adding them beside .claude/ in each workflow's
paths-ignore would have meant five copies of one list that must stay
identical, plus a sixth in the maven.yml `changes` job that keeps the
required "Build and Test" check reporting.

Path filters under `on:` cannot be shared, so the decision moves out of the
triggers into a reusable workflow, changes.yml, that owns the list and
outputs `code`. It lists the changed files from the pull-request files API
or, on push, the compare API, and builds for any other event or whenever
the list cannot be fetched. The four workflows call it and gate on its
output; maven.yml keeps gating at step level for the required check.
Patterns are anchored to the repository root.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@lukaszlenart
lukaszlenart force-pushed the build/ci-skip-process-docs branch from 0d7498d to ed08a6c Compare September 18, 2026 04:41
@lukaszlenart lukaszlenart changed the title build(ci): skip the build round trip when only the root process docs change build(ci): decide "does this need a build" in one reusable workflow Sep 18, 2026
@lukaszlenart
lukaszlenart marked this pull request as ready for review September 18, 2026 04:45
lukaszlenart and others added 2 commits September 18, 2026 06:50
Sonar S8233 flags workflow-level write permissions. The analyze job already
carries its own permissions block, which replaces the workflow-level one, so
the workflow-level security-events and id-token writes never reached it.
Keep contents: read at workflow level and the security-events write on the
job that uploads.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The Jenkinsfile keeps its own copy of the filter because Jenkins cannot call
a GitHub reusable workflow. Extend it to the root process docs with the same
anchored pattern, and cross-reference the two copies.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@lukaszlenart
lukaszlenart merged commit 16fd322 into main Sep 18, 2026
15 of 16 checks passed
@lukaszlenart
lukaszlenart deleted the build/ci-skip-process-docs branch September 18, 2026 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant