From 8a12a8fc7abb8f3b75391d415beb0670cd28892c Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Tue, 21 Mar 2017 09:41:59 -0400 Subject: [PATCH] main: default travis commit range is unreliable https://github.com/opencontainers/runc/pull/1378#issuecomment-287920287 points to an alternate approach. Reported-by: Mrunal Patel Signed-off-by: Vincent Batts --- .travis.yml | 10 ++++++++-- main.go | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2195e74..b053bff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 ./... \ No newline at end of file diff --git a/main.go b/main.go index 486be86..65d4bb0 100644 --- a/main.go +++ b/main.go @@ -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") }