From d8a2a42e3503d6bc3898a9d62f8882a624a76e6c Mon Sep 17 00:00:00 2001 From: Umputun Date: Sat, 7 Jul 2018 13:58:31 -0500 Subject: [PATCH] try to switch to drone version on non-tagged --- Dockerfile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1355dcf2..044c803c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,8 +12,12 @@ ARG TRAVIS_PULL_REQUEST ARG TRAVIS_PULL_REQUEST_SHA ARG TRAVIS_REPO_SLUG ARG TRAVIS_TAG + +ARG DRONE ARG DRONE_TAG ARG DRONE_COMMIT +ARG DRONE_BRANCH +ARG DRONE_PULL_REQUEST WORKDIR /go/src/github.com/umputun/remark/backend @@ -32,13 +36,13 @@ RUN if [ -z "$COVERALLS_TOKEN" ] ; then \ echo coverall not enabled ; \ else goveralls -coverprofile=.cover/cover.out -service=travis-ci -repotoken $COVERALLS_TOKEN || echo "coverall failed!"; fi -# get revision from git. if DRONE_TAG presented use DRONE_* git env to make version +# get revision from git. if DRONE presented use DRONE_* git env to make version RUN \ cd /go/src/github.com/umputun/remark && version=$(/script/git-rev.sh) && cd backend \ echo "git version=$version" && \ - if [ -z "$DRONE_TAG" ] ; then \ + if [ -z "$DRONE" ] ; then \ echo "runs outside of drone" ; \ - else version=${DRONE_TAG}-${DRONE_COMMIT:0:7}-$(date +%Y%m%d-%H:%M:%S); fi && \ + else version=${DRONE_TAG}${DRONE_BRANCH}${DRONE_PULL_REQUEST}-${DRONE_COMMIT:0:7}-$(date +%Y%m%d-%H:%M:%S); fi && \ echo "final version=$version" && \ go build -o remark -ldflags "-X main.revision=${version} -s -w" ./app