CI Skip Testing Fix (#5063)

## Motivation

While testing the Skip CI functionality, it revealed a minor issue where
the CI skip check fails when a branch is built at the exact commit where
it diverged from develop. CI is still run by default if a failure is
detected.

When git log <merge-base>..HEAD returns no files (because HEAD equals
merge-base), the command grep -v '^$' exits with error code 1, causing
the skip check to fail.

## Technical Details

Added || true to the grep commands so empty output is handled gracefully
instead of causing a script failure.

## Test Plan

- Simulate the failures and ensure the grep failure is handled
gracefully.

## Test Result

- Simulated grep failures using an empty string. The script handles the
error correctly.
- Verified the CI skip functionality skips CI when non-relevant file
changes are made.
- Verified the CI skip functionality does not skip CI when relevant file
changes are made.

## Submission Checklist

- [x] Look over the contributing guidelines at
https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
This commit is contained in:
andrew clark
2026-03-04 22:01:25 -07:00
committed by GitHub
parent 5d5e8a1f8a
commit 35a7659418

4
Jenkinsfile vendored
View File

@@ -287,12 +287,12 @@ def shouldRunCICheck() {
if [ "$CHANGE_ID" != "" ]; then
# For PR builds, get all files touched in any commit
echo "PR build detected, checking all touched files against origin/$CHANGE_TARGET" >&2
git log --name-only --pretty=format: origin/$CHANGE_TARGET..HEAD -- projects/composablekernel/ | sort -u | grep -v '^$'
git log --name-only --pretty=format: origin/$CHANGE_TARGET..HEAD -- projects/composablekernel/ | sort -u | grep -v '^$' || true
else
# For feature branch builds, compare against merge-base with base branch
MERGE_BASE=$(git merge-base HEAD origin/$BASE_BRANCH 2>/dev/null || echo "HEAD~1")
echo "Branch build detected, checking all touched files since merge-base: $MERGE_BASE" >&2
git log --name-only --pretty=format: $MERGE_BASE..HEAD -- projects/composablekernel/ | sort -u | grep -v '^$'
git log --name-only --pretty=format: $MERGE_BASE..HEAD -- projects/composablekernel/ | sort -u | grep -v '^$' || true
fi
'''
).trim().split('\n')