mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
ce109602cb
The command rm -f will succeed even if run for a file that does not exist. Hence it is superfluous to existence check a file that we want to purge with rm -f, which makes the script a bit simpler to read. Change-Id: If4eafea568301f418e0dd533e7175781ebf6000a Signed-off-by: Joakim Roubert <joakimr@axis.com>
65 lines
1.5 KiB
Bash
Executable File
65 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e -x
|
|
|
|
cd $(dirname $0)/..
|
|
|
|
. ./scripts/version.sh
|
|
|
|
GO=${GO-go}
|
|
|
|
rm -rf bin/crictl bin/kubectl bin/k3s-agent bin/k3s-server bin/kubectl bin/k3s build/data
|
|
ln -s containerd bin/k3s-agent
|
|
ln -s containerd bin/k3s-server
|
|
ln -s containerd bin/kubectl
|
|
ln -s containerd bin/crictl
|
|
for i in bridge flannel host-local loopback portmap; do
|
|
rm -f bin/$i
|
|
ln -s cni bin/$i
|
|
done
|
|
|
|
cp contrib/util/check-config.sh bin/check-config
|
|
|
|
rm -rf build/data
|
|
mkdir -p build/data build/out
|
|
mkdir -p dist/artifacts
|
|
|
|
(
|
|
set +x
|
|
cd bin
|
|
find . -not -path '*/\.*' -type f -exec sha256sum {} \; | sed -e 's| \./| |' | sort -k2 >.sha256sums
|
|
(
|
|
for f in $(find . -type l); do
|
|
echo $f $(readlink $f)
|
|
done
|
|
) | sed -e 's|^\./||' | sort >.links
|
|
set -x
|
|
)
|
|
|
|
tar cvzf ./build/out/data.tar.gz --exclude ./bin/hyperkube ./bin ./etc
|
|
HASH=$(sha256sum ./build/out/data.tar.gz | awk '{print $1}')
|
|
|
|
cp ./build/out/data.tar.gz ./build/data/${HASH}.tgz
|
|
|
|
BIN_SUFFIX="-${ARCH}"
|
|
if [ ${ARCH} = amd64 ]; then
|
|
BIN_SUFFIX=""
|
|
elif [ ${ARCH} = arm ]; then
|
|
BIN_SUFFIX="-armhf"
|
|
fi
|
|
|
|
CMD_NAME=dist/artifacts/k3s${BIN_SUFFIX}
|
|
|
|
"${GO}" generate
|
|
LDFLAGS="
|
|
-X github.com/rancher/k3s/pkg/version.Version=$VERSION
|
|
-X github.com/rancher/k3s/pkg/version.GitCommit=${COMMIT:0:8}
|
|
-w -s
|
|
"
|
|
STATIC="-extldflags '-static'"
|
|
if [ "$DQLITE" = "true" ]; then
|
|
DQLITE_TAGS="dqlite"
|
|
fi
|
|
CGO_ENABLED=0 "${GO}" build -tags "$DQLITE_TAGS" -ldflags "$LDFLAGS $STATIC" -o ${CMD_NAME} ./cmd/k3s/main.go
|
|
|
|
./scripts/build-upload ${CMD_NAME} ${COMMIT}
|