Skip to content

ci: skip backend-specific jobs when no changes detected - #6545

Open
nixpanic wants to merge 5 commits into
ceph:ci/centosfrom
nixpanic:ci/backend-change
Open

ci: skip backend-specific jobs when no changes detected#6545
nixpanic wants to merge 5 commits into
ceph:ci/centosfrom
nixpanic:ci/backend-change

Conversation

@nixpanic

@nixpanic nixpanic commented Sep 9, 2026

Copy link
Copy Markdown
Member

When a job is triggered for a specific backend (test_type is set and
non-empty), use scripts/inspect-changes.sh to check whether any commits in the
PR touch that backend. If none do, mark the job as SUCCESS and return early —
the same approach already used for doc-only changes.

Jobs where test_type is empty (run-all variant) are unaffected and continue to
run unconditionally.

scripts/inspect-changes.sh inspects the commits between two git references and
classifies each commit as touching one or more backends (cephfs, rbd, nfs,
nvmeof) or shared code.

@nixpanic
nixpanic requested review from a team as code owners September 9, 2026 08:19
@mergify mergify Bot added the component/testing Additional test cases or CI work label Sep 9, 2026
@Rakshith-R
Rakshith-R requested a balanced review from Copilot September 9, 2026 11:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Shallow-history traversal and ignored shared changes can produce incorrect backend decisions.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds backend-aware CI skipping for backend-specific jobs while leaving run-all variants unchanged.

Changes:

  • Adds commit and file-path classification by backend.
  • Integrates backend checks into mini-e2e and upgrade pipelines.
File summaries
File Description
scripts/inspect-changes.sh Classifies commits by backend or shared code.
mini-e2e.groovy Skips unaffected backend jobs.
mini-e2e-helm.groovy Adds backend-aware Helm job skipping.
mini-e2e-operator.groovy Adds backend-aware operator job skipping.
upgrade-tests.groovy Skips unaffected backend upgrade tests.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread scripts/inspect-changes.sh Outdated
Comment thread scripts/inspect-changes.sh Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Git failures can produce successful skips, and rename or mixed-documentation changes can be classified incorrectly.

Review details

Suppressed comments (4)

Previously missed (1) — in code that hasn't changed since the last review.

scripts/inspect-changes.sh:62

  • usage stops at the first blank line (line 10), before the Usage, Arguments, Options, and Exit codes sections. Consequently --help omits the actual command syntax and options it promises to print.

This issue also appears in the following locations of the same file:

  • line 150
  • line 151
  • line 188

scripts/inspect-changes.sh:152

  • mapfile reports its own success and does not propagate a failure from the process substitution, so a git diff error (for example, an unavailable merge base in this shallow checkout) becomes an empty list and exit code 1. Every new caller interprets 1 as “no backend changes” and marks the job successful. Capture the diff command's status explicitly and return 2 on failure before handling an actually empty result.
mapfile -t CHANGED_FILES < <(
    git -C "${REPO}" diff --name-only "${GIT_SINCE}...${GIT_UNTIL}" 2>/dev/null
)

scripts/inspect-changes.sh:151

  • Rename detection can collapse a cross-backend move to only its destination path. Moving a file from internal/cephfs/ to internal/rbd/, for example, then skips CephFS even though code was removed from it. Disable rename detection here so both the deletion and addition are classified.
    git -C "${REPO}" diff --name-only "${GIT_SINCE}...${GIT_UNTIL}" 2>/dev/null

scripts/inspect-changes.sh:191

  • A mixed PR containing documentation prevents every unrelated backend from being skipped: the earlier doc-only check returns success when any code also changed, and this branch then classifies each doc file as shared code. For example, a CephFS change plus a README update makes RBD, NFS, and NVMe-oF all match. Exclude documentation and other non-runtime paths before treating unmatched files as shared.
for f in "${CHANGED_FILES[@]}"; do
    if ! path_matches_prefixes "${f}" "${all_backend_prefixes[@]}"; then
        # shared file: counts as a change to every backend
        SHARED_FILES+=("${f}")
  • Files reviewed: 5/5 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A failed Git diff is currently mistaken for no backend changes, allowing required tests to be skipped.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 9/9 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread scripts/inspect-changes.sh Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Backend dependency mappings can incorrectly skip NFS and NVMe-oF tests after relevant CephFS or RBD changes.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 9/9 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread scripts/inspect-changes.sh Outdated
Comment thread scripts/inspect-changes.sh Outdated
scripts/inspect-changes.sh inspects the commits between two git
references and classifies each commit as touching one or more backends
(cephfs, rbd, nfs, nvmeof) or shared code.

A commit is attributed to a backend when its subject line starts with
the backend name as a commitlint type prefix, or when any of its
changed files fall under the backend's source paths
(internal/<backend>/ or internal/csi-addons/<backend>/).

A commit is attributed to shared code when at least one of its changed
files does not belong to any backend path.

Signed-off-by: Niels de Vos <ndevos@ibm.com>
Assisted-By: AskBob <askbob@ibm.com>
When a job is triggered for a specific backend (test_type is set and
non-empty), use scripts/inspect-changes.sh to check whether any commits
in the PR touch that backend. If none do, mark the job as SUCCESS and
return early — the same approach already used for doc-only changes.

Jobs where test_type is empty (run-all variant) are unaffected and
continue to run unconditionally.

Signed-off-by: Niels de Vos <ndevos@ibm.com>
Assisted-By: AskBob <askbob@ibm.com>
Replace the per-commit git log walk with a single three-dot diff
(git diff --name-only <since>...<until>).  The three-dot syntax
computes changed files relative to the merge base of the two refs,
so only files actually introduced by the PR branch are considered.

This is immune to shallow-clone depth: a pre-existing backend commit
on the base branch is no longer visible to the range, eliminating
false matches that could prevent a backend job from being skipped.

As a consequence, commit-subject-type matching is removed — the
classification is now based entirely on changed file paths.

Signed-off-by: Niels de Vos <ndevos@ibm.com>
Assisted-By: AskBob <askbob@ibm.com>
A file that does not belong to any backend path is shared code.
Previously, shared files were only tracked for the no-backend
reporting mode and were invisible when --backend was given, causing
jobs to be incorrectly skipped when a PR only touched shared code
(e.g. internal/util/, pkg/, cmd/, e2e/ helpers).

Now shared files are always attributed to every backend in
BACKEND_FILES, so --backend=<x> returns exit 0 whenever the PR
contains any shared-code change.

Signed-off-by: Niels de Vos <ndevos@ibm.com>
Assisted-By: AskBob <askbob@ibm.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Rename handling can incorrectly skip jobs for an affected source backend.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 9/9 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread scripts/inspect-changes.sh Outdated
Add --doc-change-only to scripts/inspect-changes.sh, which exits 0
when every changed file matches the documentation patterns (docs/,
*.md, LICENSE, .mergify.yml, .github/, .gitignore,
.commitlintrc.yml), and exits 1 as soon as any non-documentation
file is found.

Documentation files are also filtered out during the backend/shared
classification loop, so a doc-only PR no longer counts as a shared
code change when --backend is used.

Remove scripts/skip-doc-change.sh and update all seven pipeline
Groovy scripts to call inspect-changes.sh --doc-change-only instead.
The condition in each pipeline is updated from doc_change == 1 to
doc_change == 0 to match the new exit-code semantics (exit 0 means
doc-only, skip tests).

Assisted-By: AskBob <askbob@ibm.com>
Signed-off-by: Niels de Vos <ndevos@ibm.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new shell invocations interpolate an unvalidated Jenkins parameter, permitting command injection.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 9/9 changed files
  • Comments generated: 4
  • Review effort level: Balanced

Comment thread mini-e2e-helm.groovy
Comment thread mini-e2e-operator.groovy
Comment thread mini-e2e.groovy
Comment thread upgrade-tests.groovy
@nixpanic

Copy link
Copy Markdown
Member Author

@Rakshith-R and @iPraveenParihar , this should be ready now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/testing Additional test cases or CI work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants