Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(version): Makefile and version enhancement #62

Merged
merged 1 commit into from
Mar 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# list only csi source code directories
PACKAGES = $(shell go list ./... | grep -v 'vendor\|pkg/generated')

UNIT_TEST_PACKAGES = $(shell go list ./... | grep -v 'vendor\|pkg/generated\|tests')

# Lint our code. Reference: https://golang.org/cmd/vet/
VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods \
-nilfunc -printf -rangeloops -shift -structtags -unsafeptr
Expand Down Expand Up @@ -36,7 +38,7 @@ CSI_DRIVER=zfs-driver
BUILD_DATE = $(shell date +'%Y%m%d%H%M%S')

.PHONY: all
all: zfs-driver-image
all: test zfs-driver-image

.PHONY: clean
clean:
Expand All @@ -54,7 +56,7 @@ format:
.PHONY: test
test: format
@echo "--> Running go test" ;
@go test $(PACKAGES)
@go test $(UNIT_TEST_PACKAGES)

# Bootstrap downloads tools required
# during build
Expand Down
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

19 changes: 18 additions & 1 deletion buildscripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,25 @@ if [[ -n "$TRAVIS_TAG" ]] && [[ $TRAVIS_TAG != *"RC"* ]]; then
echo "released" > BUILDMETA
fi

CURRENT_BRANCH=""
if [ -z ${TRAVIS_BRANCH} ];
then
CURRENT_BRANCH=$(git branch | grep \* | cut -d ' ' -f2)
else
CURRENT_BRANCH=${TRAVIS_BRANCH}
fi

# Get the version details
VERSION="$(cat $GOPATH/src/github.com/openebs/zfs-localpv/VERSION)"
if [ -n "$TRAVIS_TAG" ]; then
VERSION="$(git describe --tags `git rev-list --tags --max-count=1`)"
else
BUILDDATE=`date +%m-%d-%Y`
SHORT_COMMIT="$(git rev-parse --short HEAD)"
VERSION="$CURRENT_BRANCH-$SHORT_COMMIT:$BUILDDATE"
fi

echo -e "\nbuilding the ZFS Driver version :- $VERSION\n"

VERSION_META="$(cat $GOPATH/src/github.com/openebs/zfs-localpv/BUILDMETA)"

# Determine the arch/os combos we're building for
Expand Down