Skip to content

tests: ensure system test presubmit runs in release PRs regardless if CHANGELOG is modified#16916

Draft
parthea wants to merge 2 commits intomainfrom
update-system-test-config
Draft

tests: ensure system test presubmit runs in release PRs regardless if CHANGELOG is modified#16916
parthea wants to merge 2 commits intomainfrom
update-system-test-config

Conversation

@parthea
Copy link
Copy Markdown
Contributor

@parthea parthea commented May 1, 2026

Fixes #16905

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the .kokoro/system.sh script to use an array for files_to_check, expanding the set of files monitored for changes to include setup.py, pyproject.toml, and versioning files. It is recommended to use the --name-only flag with git diff to improve efficiency, as the script only requires a count of changed files rather than the full diff content.

Comment thread .kokoro/system.sh
Comment on lines +150 to +153
echo "checking changes with 'git diff ${KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH}...${KOKORO_GITHUB_PULL_REQUEST_COMMIT} -- ${files_to_check[*]}'"
set +e
package_modified=$(git diff "${KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH}...${KOKORO_GITHUB_PULL_REQUEST_COMMIT}" -- ${files_to_check} | wc -l)
# Passing the array expanded as arguments to git diff
package_modified=$(git diff "${KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH}...${KOKORO_GITHUB_PULL_REQUEST_COMMIT}" -- "${files_to_check[@]}" | wc -l)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Using git diff without output-limiting flags generates the full patch content, which is inefficient when you only need to determine if any changes occurred. Adding the --name-only flag improves performance by only retrieving the list of changed filenames, which is sufficient for the wc -l check. Additionally, ensure that the PR commit and target branch are properly fetched, as pull requests can originate from forked repositories.

Suggested change
echo "checking changes with 'git diff ${KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH}...${KOKORO_GITHUB_PULL_REQUEST_COMMIT} -- ${files_to_check[*]}'"
set +e
package_modified=$(git diff "${KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH}...${KOKORO_GITHUB_PULL_REQUEST_COMMIT}" -- ${files_to_check} | wc -l)
# Passing the array expanded as arguments to git diff
package_modified=$(git diff "${KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH}...${KOKORO_GITHUB_PULL_REQUEST_COMMIT}" -- "${files_to_check[@]}" | wc -l)
echo "checking changes with 'git diff --name-only ${KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH}...${KOKORO_GITHUB_PULL_REQUEST_COMMIT} -- ${files_to_check[*]}'"
set +e
# Passing the array expanded as arguments to git diff
package_modified=$(git diff --name-only "${KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH}...${KOKORO_GITHUB_PULL_REQUEST_COMMIT}" -- "${files_to_check[@]}" | wc -l)
References
  1. When fetching a specific commit in a Git repository, consider that pull requests can originate from forked repositories, which might affect how the commit is fetched.

@parthea parthea changed the title tests: ensure system test presubmit runs in release PRs regardless if CHANGELOG is changed tests: ensure system test presubmit runs in release PRs regardless if CHANGELOG is modified May 1, 2026
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.

System tests not running in latest Release PR

1 participant