From 870c48a499369cbd322a623bfa71a11a5b7e64c1 Mon Sep 17 00:00:00 2001 From: Umputun Date: Wed, 23 May 2018 01:09:43 -0500 Subject: [PATCH] add travis arguments --- .travis.yml | 2 +- Dockerfile | 8 +++++++- app/migrator/backup_test.go | 6 +++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index ce10622f..17e48090 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,4 +3,4 @@ install: - docker-compose --version script: - - docker build --build-arg COVERALLS_TOKEN=$COVERALLS_TOKEN . + - docker build --build-arg COVERALLS_TOKEN=$COVERALLS_TOKEN --build-arg TRAVIS_JOB_ID=$TRAVIS_JOB_ID --build-arg TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST --build-arg TRAVIS_BRANCH=$TRAVIS_BRANCH . diff --git a/Dockerfile b/Dockerfile index 5c5536f9..b877b68a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,10 @@ FROM umputun/baseimage:buildgo-latest as build-backend ARG COVERALLS_TOKEN ENV COVERALLS_TOKEN=$COVERALLS_TOKEN +ARG TRAVIS_JOB_ID +ARG TRAVIS_PULL_REQUEST +ARG TRAVIS_BRANCH + WORKDIR /go/src/github.com/umputun/remark ADD app /go/src/github.com/umputun/remark/app @@ -22,7 +26,9 @@ RUN if [ "x$COVERALLS_TOKEN" = "x" ] ; then \ else go get github.com/mattn/goveralls && \ goveralls -coverprofile=.cover/cover.out -service=travis-ci -repotoken $COVERALLS_TOKEN; fi -RUN go build -o remark -ldflags "-X main.revision=$(git rev-parse --abbrev-ref HEAD)-$(git describe --abbrev=7 --always --tags)-$(date +%Y%m%d-%H:%M:%S) -s -w" ./app +RUN \ + echo "rev=$(git rev-parse --abbrev-ref HEAD)" && \ + go build -o remark -ldflags "-X main.revision=$(git rev-parse --abbrev-ref HEAD)-$(git describe --abbrev=7 --always --tags)-$(date +%Y%m%d-%H:%M:%S) -s -w" ./app FROM node:9.4-alpine as build-frontend diff --git a/app/migrator/backup_test.go b/app/migrator/backup_test.go index 474fb051..55cbc231 100644 --- a/app/migrator/backup_test.go +++ b/app/migrator/backup_test.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/assert" ) -func TestMigrator_RemoveOldBackupFiles(t *testing.T) { +func TestBackup_RemoveOldBackupFiles(t *testing.T) { loc := "/tmp/remark-backups.test" defer os.RemoveAll(loc) @@ -37,7 +37,7 @@ func TestMigrator_RemoveOldBackupFiles(t *testing.T) { assert.Equal(t, "backup-site2-20171210.gz", ff[3].Name()) } -func TestMigrator_MakeBackup(t *testing.T) { +func TestBackup_MakeBackup(t *testing.T) { loc := "/tmp/remark-backups.test" defer os.RemoveAll(loc) os.MkdirAll(loc, 0700) @@ -53,7 +53,7 @@ func TestMigrator_MakeBackup(t *testing.T) { assert.Equal(t, int64(52), fi.Size()) } -func TestMigrator_Do(t *testing.T) { +func TestBackup_Do(t *testing.T) { loc := "/tmp/remark-backups.test" defer os.RemoveAll(loc) os.MkdirAll(loc, 0700)