mirror of
https://github.com/cnrancher/kube-explorer.git
synced 2025-08-19 23:17:10 +00:00
fix(ci): Fix multi-arch build problem
Added build linux/arm64 binary to default ci
This commit is contained in:
parent
4dc1acb1f2
commit
2b39db9f07
@ -27,6 +27,8 @@ steps:
|
|||||||
image: rancher/dapper:v0.6.0
|
image: rancher/dapper:v0.6.0
|
||||||
commands:
|
commands:
|
||||||
- dapper ci
|
- dapper ci
|
||||||
|
environment:
|
||||||
|
CROSS: "${DRONE_BUILD_EVENT}"
|
||||||
privileged: true
|
privileged: true
|
||||||
volumes:
|
volumes:
|
||||||
- name: docker
|
- name: docker
|
||||||
@ -120,7 +122,7 @@ steps:
|
|||||||
- dapper ci
|
- dapper ci
|
||||||
privileged: true
|
privileged: true
|
||||||
environment:
|
environment:
|
||||||
CROSS: 1
|
CROSS: "${DRONE_BUILD_EVENT}"
|
||||||
volumes:
|
volumes:
|
||||||
- name: docker
|
- name: docker
|
||||||
path: /var/run/docker.sock
|
path: /var/run/docker.sock
|
||||||
|
@ -14,7 +14,18 @@ LD_INJECT_VALUES="-X github.com/rancher/steve/pkg/version.Version=$VERSION
|
|||||||
|
|
||||||
pushd $GIT_SOURCE
|
pushd $GIT_SOURCE
|
||||||
|
|
||||||
if [ -n "$CROSS" ]; then
|
case "$CROSS" in
|
||||||
|
"push")
|
||||||
|
for ARCH in ${OS_ARCH_ARG_LINUX}; do
|
||||||
|
OUTPUT_BIN="bin/kube-explorer-linux-$ARCH"
|
||||||
|
echo "Building binary for linux/$ARCH..."
|
||||||
|
GOARCH=$ARCH GOOS=linux CGO_ENABLED=0 go build -tags embed \
|
||||||
|
-ldflags \
|
||||||
|
"$LD_INJECT_VALUES $LINKFLAGS" \
|
||||||
|
-o ${OUTPUT_BIN}
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
"tag")
|
||||||
for ARCH in ${OS_ARCH_ARG_LINUX}; do
|
for ARCH in ${OS_ARCH_ARG_LINUX}; do
|
||||||
OUTPUT_BIN="bin/kube-explorer-linux-$ARCH"
|
OUTPUT_BIN="bin/kube-explorer-linux-$ARCH"
|
||||||
echo "Building binary for linux/$ARCH..."
|
echo "Building binary for linux/$ARCH..."
|
||||||
@ -41,13 +52,15 @@ if [ -n "$CROSS" ]; then
|
|||||||
"$LD_INJECT_VALUES" \
|
"$LD_INJECT_VALUES" \
|
||||||
-o ${OUTPUT_BIN}
|
-o ${OUTPUT_BIN}
|
||||||
done
|
done
|
||||||
else
|
;;
|
||||||
|
*)
|
||||||
# only build one for current platform
|
# only build one for current platform
|
||||||
CGO_ENABLED=0 go build -tags embed \
|
CGO_ENABLED=0 go build -tags embed \
|
||||||
-ldflags \
|
-ldflags \
|
||||||
"$LD_INJECT_VALUES $LINKFLAGS" \
|
"$LD_INJECT_VALUES $LINKFLAGS" \
|
||||||
-o "bin/kube-explorer-$(uname | tr '[:upper:]' '[:lower:]')-${ARCH}"
|
-o "bin/kube-explorer-$(uname | tr '[:upper:]' '[:lower:]')-${ARCH}"
|
||||||
fi
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
mkdir -p $DAPPER_SOURCE/bin
|
mkdir -p $DAPPER_SOURCE/bin
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user