-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fail fast on Travis for multiple queued builds in same PR
Adjust installation of jq on osx --only-dependencies is not what I want there Rearrange travis steps before_install steps are fatal by default, script steps are not (travis runs all of them and marks the build as failed if any returns nonzero exit code) Fail faster on osx May as well do check-whitespace before installing deps Add fast fail for branch builds too Make sure branch section does not apply to PRs
- Loading branch information
Showing
2 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/sh | ||
|
||
curlhdr="Accept: application/vnd.travis-ci.2+json" | ||
endpoint="https://api.travis-ci.org/repos/$TRAVIS_REPO_SLUG" | ||
|
||
# Fail fast for superseded builds to PR's | ||
if ! [ "$TRAVIS_PULL_REQUEST" = "false" ]; then | ||
if ! [ \"$TRAVIS_BUILD_NUMBER\" = $(curl -H "$curlhdr" $endpoint/builds?event_type=pull_request | \ | ||
jq ".builds | map(select(.pull_request_number == $TRAVIS_PULL_REQUEST))[0].number") ]; then | ||
echo "There are newer queued builds for this pull request, failing early." | ||
exit 1 | ||
fi | ||
else | ||
# And for non-latest push builds in branches other than master or release* | ||
case $TRAVIS_BRANCH in | ||
master | release*) | ||
;; | ||
*) | ||
if ! [ \"$TRAVIS_BUILD_NUMBER\" = $(curl -H "$curlhdr" \ | ||
$endpoint/branches/$TRAVIS_BRANCH | jq ".branch.number") ]; then | ||
echo "There are newer queued builds for this branch, failing early." | ||
exit 1 | ||
fi | ||
;; | ||
esac | ||
fi |