1 Star 0 Fork 0

coolops/kubekey

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
build.sh 1.18 KB
一键复制 编辑 原始数据 按行查看 历史
pixiake 提交于 2020-09-21 11:38 . Refine version number
#! /bin/bash
GIT_COMMIT=$(git rev-parse HEAD)
GIT_SHA=$(git rev-parse --short HEAD)
GIT_TAG=$(git describe --tags --abbrev=0 --exact-match 2>/dev/null )
GIT_DIRTY=$(test -n "`git status --porcelain`" && echo "dirty" || echo "clean")
VERSION_METADATA=unreleased
VERSION=latest
# Clear the "unreleased" string in BuildMetadata
if [[ -n $GIT_TAG ]]
then
VERSION_METADATA=
VERSION=${GIT_TAG}
fi
LDFLAGS="-X github.com/kubesphere/kubekey/version.version=${VERSION}
-X github.com/kubesphere/kubekey/version.metadata=${VERSION_METADATA}
-X github.com/kubesphere/kubekey/version.gitCommit=${GIT_COMMIT}
-X github.com/kubesphere/kubekey/version.gitTreeState=${GIT_DIRTY}"
if [ -n "$1" ]; then
if [ "$1" == "-p" ] || [ "$1" == "--proxy" ]; then
# Using the most trusted Go module proxy in China
docker run --rm -e GO111MODULE=on -e GOPROXY=https://goproxy.cn -v "$PWD":/usr/src/myapp -w /usr/src/myapp golang:1.14.7 go build -ldflags "$LDFLAGS" -v -o output/kk
else
echo "The option should be '-p' or '--proxy'"
fi
else
docker run --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp golang:1.14.7 go build -ldflags "$LDFLAGS" -v -o output/kk
fi
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/coolops/kubekey.git
git@gitee.com:coolops/kubekey.git
coolops
kubekey
kubekey
master

搜索帮助