[check_stability] Improve "changed file" detection #5416
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@jgraham I'd like to call out the change from
..
to...
in particular asthis has the potential to impact use cases beyond "TravisCI pull request."
The "check stability" script is intended to run only those tests that
have been effected by a given changeset. It calculates the relevant set
of test files by analyzing the git repository's history.
Previously, the script referenced an environment variable provided by
TravisCI named
TRAVIS_COMMIT_RANGE
when running for GitHub.com pullrequests. That variable is documented [1] as follows:
Beyond being somewhat imprecise, that value has been found to be
incorrect in some cases [2]. The definition leaves open the possibility
for race conditions resulting from changes to the target branch over the
course of the TravisCI build life cycle.
Update the "changed file" detection heuristic to instead use the
TRAVIS_BRANCH
variable, whose definition is much more precise and lesssusceptible to race conditions of the type described above. In addition,
update the operator used to specify git endpoints in the subsequent
invocation of
git diff
as this syntax is distinct from that used tospecify ranges [3].
[1] https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables
[2] travis-ci/travis-ci#7578
[3] https://git-scm.com/docs/git-diff#_description
This change is