Skip to content

Speed up "push" builds. #2480

@dhermes

Description

@dhermes

Travis has two build types that we use: "push" and "pull request". On a "pull request" commit the TRAVIS_BRANCH env. var. tells us what we are diff-ing against and makes it easy to limit the build jobs based on the changed files.

In "push" builds, the best we have is TRAVIS_COMMIT_RANGE but this is not a very dependable value. I propose we rely instead on the GitHub API to determine the changed files.

  1. Try our best to parse the PR number from the commit message (if this fails, just bail and run every single test)
  2. Verify the PR number by checking if the TRAVIS_COMMIT (and the HEAD commit in our local checkout) matches the merge_commit_sha in the PR endpoint: https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls/2450
  3. Once we have the PR, hit the PR files endpoint to get a list of changed files, e.g.: https://api.github.com/repos/GoogleCloudPlatform/google-cloud-python/pulls/2461/files

As an alternative to the first step, there is an "unpublished" API which helps associate a commit SHA with a PR. For example, see the parenthetical 2461 below:

screen_shot_001

which tells us that 4e8afa8 came as part of #2461. The actual API returns an SVG with the payload containing

          <li class="pull-request">(<a href="/GoogleCloudPlatform/google-cloud-python/pull/2461" title="Merged Pull Request: Clarify docs on last 5 minutes query">#2461</a>)</li>

The API simply requires the commit hash in TRAVIS_COMMIT (i.e. just the HEAD commit on our local checkout), e.g. https://github.com/GoogleCloudPlatform/google-cloud-python/branch_commits/4e8afa8c3877376d7e9a6df79e6a272ae1cdfee7


@tseaver @jonparrott PTAL and LMKWYT

FYI this will build on top of work done for #2277.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions