Skip to content

Commit

Permalink
main: default travis commit range is unreliable
Browse files Browse the repository at this point in the history
opencontainers/runc#1378 (comment)
points to an alternate approach.

Reported-by: Mrunal Patel <mrunalp@gmail.com>
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
  • Loading branch information
vbatts committed Mar 21, 2017
1 parent 3fd57e3 commit 8a12a8f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions .travis.yml
Expand Up @@ -10,11 +10,17 @@ before_install:
- go get -u github.com/golang/lint/golint
- mkdir -p $GOPATH/src/github.com/vbatts && ln -sf $(pwd) $GOPATH/src/github.com/vbatts/git-validation && go get ./...

before_script:
- echo $TRAVIS_COMMIT
- echo $TRAVIS_BRANCH
- echo $TRAVIS_TAG
- echo $TRAVIS_BUILD_NUMBER
- echo $TRAVIS_REPO_SLUG

install: true

script:
- go vet -x ./...
- golint ./...
- go build .
- go test -v ./...

- go test -v ./...
4 changes: 2 additions & 2 deletions main.go
Expand Up @@ -50,8 +50,8 @@ func main() {
var commitRange = *flCommitRange
if commitRange == "" {
if strings.ToLower(os.Getenv("TRAVIS")) == "true" && !*flNoTravis {
if os.Getenv("TRAVIS_COMMIT_RANGE") != "" {
commitRange = os.Getenv("TRAVIS_COMMIT_RANGE")
if os.Getenv("TRAVIS_BRANCH") != "" {
commitRange = fmt.Sprintf("%s..FETCH_HEAD", os.Getenv("TRAVIS_BRANCH"))
} else if os.Getenv("TRAVIS_COMMIT") != "" {
commitRange = os.Getenv("TRAVIS_COMMIT")
}
Expand Down

0 comments on commit 8a12a8f

Please sign in to comment.