ci: skip backend-specific jobs when no changes detected - #6545
Conversation
There was a problem hiding this comment.
🟡 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.
There was a problem hiding this comment.
🔵 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
usagestops at the first blank line (line 10), before the Usage, Arguments, Options, and Exit codes sections. Consequently--helpomits 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
mapfilereports its own success and does not propagate a failure from the process substitution, so agit differror (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/tointernal/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
2e5daf0 to
9b13bf5
Compare
There was a problem hiding this comment.
🟡 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
9b13bf5 to
e86c58b
Compare
There was a problem hiding this comment.
🟡 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
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>
e86c58b to
c568b50
Compare
There was a problem hiding this comment.
🟡 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
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>
c568b50 to
b559cde
Compare
There was a problem hiding this comment.
🟡 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
|
@Rakshith-R and @iPraveenParihar , this should be ready now. |
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.