openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From houshen...@apache.org
Subject [incubator-openwhisk-wskdeploy] branch master updated: Fix the missing version for the binary
Date Thu, 05 Apr 2018 21:36:17 GMT
This is an automated email from the ASF dual-hosted git repository.

houshengbo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-wskdeploy.git


The following commit(s) were added to refs/heads/master by this push:
     new e2954e3  Fix the missing version for the binary
e2954e3 is described below

commit e2954e395ac554f88a8f98c0d935e87d9c0b13e2
Author: Vincent Hou <shou@us.ibm.com>
AuthorDate: Thu Apr 5 15:28:41 2018 -0400

    Fix the missing version for the binary
---
 .travis.yml                        | 17 +++++++++--------
 Makefile                           |  6 +++---
 tools/travis/build_tag_releases.sh |  3 ++-
 tools/travis/script.sh             |  7 ++++++-
 4 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 3107791..4ac1237 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -56,12 +56,16 @@ after_script:
 before_deploy:
 - export build_file_name=wskdeploy
 - go get github.com/inconshreveable/mousetrap
-- "./tools/travis/build_tag_releases.sh $build_file_name"
-- ./gradlew --console=plain releaseBinaries
-- export RELEASE_PKG_FILE="$(cd "$TRAVIS_BUILD_DIR/release" && ls ${zip_file_name}-*.tgz
${zip_file_name}-*.zip)"
-- echo "Deploying $RELEASE_PKG_FILE to GitHub releases."
 - export GIT_TAG="latest"
 - export TAG=false
+- if [ ! -z "$TRAVIS_TAG" ] ; then
+      export GIT_TAG=$TRAVIS_TAG;
+      export TAG=true;
+  fi
+- "./tools/travis/build_tag_releases.sh $build_file_name $GIT_TAG"
+- ./gradlew --console=plain releaseBinaries -PpackageVersion=$GIT_TAG
+- export RELEASE_PKG_FILE="$(cd "$TRAVIS_BUILD_DIR/release" && ls ${zip_file_name}-*.tgz
${zip_file_name}-*.zip)"
+- echo "Deploying $RELEASE_PKG_FILE to GitHub releases."
 - if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_EVENT_TYPE" == "push" ] &&
[ "$TRAVIS_OS_NAME" == "linux" ] ; then
       git config --global user.email "builds@travis-ci.com";
       git config --global user.name "Travis CI";
@@ -70,10 +74,7 @@ before_deploy:
       GIT_COMMITTER_DATE="$(git show --format=%aD | head -1)" git tag $GIT_TAG -a -m "Generated
tag from Travis CI build $TRAVIS_BUILD_NUMBER";
       git push -f -q https://$API_KEY@github.com/apache/incubator-openwhisk-wskdeploy $GIT_TAG;
   fi
-- if [ ! -z "$TRAVIS_TAG" ] ; then
-      export GIT_TAG=$TRAVIS_TAG;
-      export TAG=true;
-  fi
+- echo "The event type is $TRAVIS_EVENT_TYPE."
 - echo "The GIT_TAG of this Travis build is $GIT_TAG."
 
 deploy:
diff --git a/Makefile b/Makefile
index 97c50f0..291fc2a 100644
--- a/Makefile
+++ b/Makefile
@@ -19,7 +19,7 @@ SOURCEDIR=.
 SOURCES := $(shell find $(SOURCEDIR) -name '*.go')
 BINARY=wskdeploy
 
-VERSION=1.0.0
+VERSION=latest
 
 BUILD=`git rev-parse HEAD`
 
@@ -27,14 +27,14 @@ deps:
 	@echo "Installing dependencies"
 	godep restore -v
 
-LDFLAGS=-ldflags "-X main.Version=`date -u '+%Y-%m-%dT%H:%M:%S'` -X main.Build=`git rev-parse
HEAD` "
+LDFLAGS=-ldflags "-X main.Version=${VERSION} -X main.Build=`git rev-parse HEAD` "
 
 test: deps
 	@echo "Testing"
 	go test ./... -tags=unit
 
 # Build the project
-build: test
+build:
 	go build ${LDFLAGS} -o ${BINARY}
 
 # Run the integration test against OpenWhisk
diff --git a/tools/travis/build_tag_releases.sh b/tools/travis/build_tag_releases.sh
index 83bf9f3..799c547 100755
--- a/tools/travis/build_tag_releases.sh
+++ b/tools/travis/build_tag_releases.sh
@@ -23,6 +23,7 @@
 declare -a os_list=("linux" "darwin" "windows")
 declare -a arc_list=("amd64" "386")
 build_file_name=${1:-"wskdeploy"}
+build_version=${2:-"$TRAVIS_TAG"}
 
 for os in "${os_list[@]}"
 do
@@ -37,7 +38,7 @@ do
             os_name="mac"
         fi
         cd $TRAVIS_BUILD_DIR
-        GOOS=$os GOARCH=$arc go build -o build/$os/$wskdeploy
+        GOOS=$os GOARCH=$arc go build -ldflags "-X main.Version=$build_version" -o build/$os/$wskdeploy
         cd build/$os
         if [[ "$os" == "linux" ]]; then
             tar -czvf "$TRAVIS_BUILD_DIR/$build_file_name-$TRAVIS_TAG-$os_name-$arc.tgz"
$wskdeploy
diff --git a/tools/travis/script.sh b/tools/travis/script.sh
index cfc82f5..b0c7d5f 100755
--- a/tools/travis/script.sh
+++ b/tools/travis/script.sh
@@ -28,7 +28,12 @@ ROOTDIR="$SCRIPTDIR/../.."
 cd $TRAVIS_BUILD_DIR
 ./tools/travis/scancode.sh
 make lint
-make build
+make test
+BUILD_VERSION="latest"
+if [ ! -z "$TRAVIS_TAG" ] ; then
+    BUILD_VERSION=$TRAVIS_TAG
+fi
+make build VERSION=$BUILD_VERSION
 export PATH=$PATH:$TRAVIS_BUILD_DIR
 
 HOMEDIR="$(dirname "$TRAVIS_BUILD_DIR")"

-- 
To stop receiving notification emails like this one, please contact
houshengbo@apache.org.

Mime
View raw message