multus-cni/build

29 lines
672 B
Plaintext
Raw Normal View History

2016-12-13 14:48:12 +00:00
#!/usr/bin/env bash
set -e
2019-06-07 09:36:14 +00:00
DEST_DIR="bin"
if [ ! -d ${DEST_DIR} ]; then
mkdir ${DEST_DIR}
fi
2016-12-13 14:48:12 +00:00
# Add version/commit/date into binary
# In case of TravisCI, need to check error code of 'git describe'.
set +e
git describe --tags --abbrev=0 > /dev/null 2>&1
if [ "$?" != "0" ]; then
VERSION="master"
else
VERSION=$(git describe --tags --abbrev=0)
fi
set -e
DATE=$(date --iso-8601=seconds)
COMMIT=$(git rev-parse --verify HEAD)
LDFLAGS="-X main.version=${VERSION:-master} -X main.commit=${COMMIT} -X main.date=${DATE}"
2019-06-07 09:36:14 +00:00
export GO111MODULE=on
export CGO_ENABLED=0
2016-12-13 14:48:12 +00:00
echo "Building plugins"
2019-06-07 09:36:14 +00:00
go build -o ${DEST_DIR}/multus -tags no_openssl -ldflags "${LDFLAGS}" "$@" ./multus