Skip to content

Commit

Permalink
Merge pull request #609 from k82cn/vc_449
Browse files Browse the repository at this point in the history
Fixed build error of release-pkg.
  • Loading branch information
volcano-sh-bot authored Dec 15, 2019
2 parents c064572 + 1b806db commit 33fa0fd
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 9 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ jobs:
- echo "publish release to github & dockerhub"
deploy:
- provider: script
script: make TAG=${TRAVIS_TAG} RELEASE_VER=${TRAVIS_TAG} release
script:
- make TAG=${TRAVIS_TAG} RELEASE_VER=${TRAVIS_TAG} release-env
- make TAG=${TRAVIS_TAG} RELEASE_VER=${TRAVIS_TAG} release
on:
tags: true
- provider: releases
Expand Down
15 changes: 7 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,9 @@ RELEASE_DIR=_output/release
REL_OSARCH=linux/amd64
REPO_PATH=volcano.sh/volcano
IMAGE_PREFIX=volcanosh/vc
# If tag not explicitly set in users default to the git sha.
TAG ?= $(shell git rev-parse --verify HEAD)
RELEASE_VER=v0.2
GitSHA=`git rev-parse HEAD`
Date=`date "+%Y-%m-%d %H:%M:%S"`
LD_FLAGS=" \
-X '${REPO_PATH}/pkg/version.GitSHA=${GitSHA}' \
-X '${REPO_PATH}/pkg/version.Built=${Date}' \
-X '${REPO_PATH}/pkg/version.Version=${RELEASE_VER}'"

include Makefile.def

.EXPORT_ALL_VARIABLES:

Expand Down Expand Up @@ -77,6 +71,11 @@ e2e-test-kind:
generate-yaml: init
./hack/generate-yaml.sh

release-env:
./hack/build-env.sh release

dev-env:
./hack/build-env.sh dev

release: images generate-yaml
./hack/publish.sh
Expand Down
10 changes: 10 additions & 0 deletions Makefile.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

# If tag not explicitly set in users default to the git sha.
TAG ?= $(shell git rev-parse --verify HEAD)
GitSHA=`git rev-parse HEAD`
Date=`date "+%Y-%m-%d %H:%M:%S"`
LD_FLAGS=" \
-X '${REPO_PATH}/pkg/version.GitSHA=${GitSHA}' \
-X '${REPO_PATH}/pkg/version.Built=${Date}' \
-X '${REPO_PATH}/pkg/version.Version=${RELEASE_VER}'"

10 changes: 10 additions & 0 deletions defs/Makefile.dev.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

# If tag not explicitly set in users default to the git sha.
TAG ?= $(shell git rev-parse --verify HEAD)
GitSHA=`git rev-parse HEAD`
Date=`date "+%Y-%m-%d %H:%M:%S"`
LD_FLAGS=" \
-X '${REPO_PATH}/pkg/version.GitSHA=${GitSHA}' \
-X '${REPO_PATH}/pkg/version.Built=${Date}' \
-X '${REPO_PATH}/pkg/version.Version=${RELEASE_VER}'"

10 changes: 10 additions & 0 deletions defs/Makefile.release.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

# If tag not explicitly set in users default to the git sha.
TAG=__release_ver__
GitSHA=__git_sha__
Date=`date "+%Y-%m-%d %H:%M:%S"`
LD_FLAGS=" \
-X '${REPO_PATH}/pkg/version.GitSHA=${GitSHA}' \
-X '${REPO_PATH}/pkg/version.Built=${Date}' \
-X '${REPO_PATH}/pkg/version.Version=${RELEASE_VER}'"

10 changes: 10 additions & 0 deletions hack/build-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

ENV=$1

GitSHA=`git rev-parse HEAD`

cp defs/Makefile.${ENV}.def Makefile.def

sed -i "s/__git_sha__/"${GitSHA}"/g" Makefile.def
sed -i "s/__release_ver__/"${RELEASE_VER}"/g" Makefile.def

0 comments on commit 33fa0fd

Please sign in to comment.