提交 53c32049 编写于 作者: LinuxSuRen's avatar LinuxSuRen

Allow users to specific goos via env variable

Signed-off-by: LinuxSuRen's avatarrick <rick@jenkins-zh.cn>
上级 c5de21af
......@@ -20,13 +20,18 @@ tag_for_branch() {
REPO=${REPO:-kubespheredev}
TAG=$(tag_for_branch $1)
docker build -f build/ks-apiserver/Dockerfile -t $REPO/ks-apiserver:$TAG .
docker build -f build/ks-controller-manager/Dockerfile -t $REPO/ks-controller-manager:$TAG .
# Push image to dockerhub, need to support multiple push
cat ~/.docker/config.json | grep index.docker.io
if [[ $? != 0 ]]; then
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
fi
docker build -f build/ks-apiserver/Dockerfile -t $REPO/ks-apiserver:$TAG .
docker push $REPO/ks-apiserver:$TAG
# print the full docker image path for your convience
docker images --digests | grep $REPO/ks-apiserver | grep $TAG | awk '{print $1":"$2"@"$3}'
docker build -f build/ks-controller-manager/Dockerfile -t $REPO/ks-controller-manager:$TAG .
docker push $REPO/ks-controller-manager:$TAG
# print the full docker image path for your convience
docker images --digests | grep $REPO/ks-controller-manager | grep $TAG | awk '{print $1":"$2"@"$3}'
......@@ -41,6 +41,12 @@ BUILD_GOARCH=${GOARCH:-$(go env GOARCH)}
GOBINARY=${GOBINARY:-go}
LDFLAGS=$(kube::version::ldflags)
# we need to build a particular binary instead of default one in some cases
KS_BUILD_GOOS=${KS_BUILD_GOOS:-""}
if [[ "${KS_BUILD_GOOS}" != "" ]]; then
BUILD_GOOS=${KS_BUILD_GOOS}
fi
# forgoing -i (incremental build) because it will be deprecated by tool chain.
time GOOS=${BUILD_GOOS} CGO_ENABLED=0 GOARCH=${BUILD_GOARCH} ${GOBINARY} build \
-ldflags="${LDFLAGS}" \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册