Define containerd and cri-tools version

This commit is contained in:
Erik Wilson 2019-07-09 20:54:13 -07:00
parent df20cdfcee
commit 70090a8ad3
3 changed files with 33 additions and 3 deletions

View File

@ -4,8 +4,20 @@ set -e -x
source $(dirname $0)/version.sh source $(dirname $0)/version.sh
cd $(dirname $0)/.. cd $(dirname $0)/..
PKG="github.com/rancher/k3s"
PKG_CONTAINERD="github.com/containerd/containerd"
PKG_RANCHER_CONTAINERD="github.com/rancher/containerd"
PKG_CRICTL="github.com/kubernetes-sigs/cri-tools"
LDFLAGS="
-X $PKG/pkg/version.Version=$VERSION
-X $PKG/pkg/version.GitCommit=${COMMIT:0:8}
-X $PKG/vendor/$PKG_CONTAINERD/version.Version=$VERSION_CONTAINERD
-X $PKG/vendor/$PKG_CONTAINERD/version.Package=$PKG_RANCHER_CONTAINERD
-X $PKG/vendor/$PKG_CRICTL/pkg/version.Version=$VERSION_CRICTL
-w -s
"
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'" STATIC="-extldflags '-static'"
STATIC_SQLITE="-extldflags '-static -lm -ldl -lz -lpthread'" STATIC_SQLITE="-extldflags '-static -lm -ldl -lz -lpthread'"
TAGS="ctrd apparmor seccomp no_btrfs netgo osusergo" TAGS="ctrd apparmor seccomp no_btrfs netgo osusergo"
@ -23,7 +35,18 @@ if [ -z "$GOARM" ] && [ "arm" = "$(go env GOARCH)" ]; then
GOARM=7 GOARM=7
fi fi
rm -f bin/k3s-agent bin/hyperkube bin/containerd bin/cni ./bin/runc bin/containerd-shim bin/k3s-server bin/kubectl bin/crictl bin/ctr rm -f \
bin/k3s-agent \
bin/hyperkube \
bin/containerd \
bin/cni \
bin/runc \
bin/containerd-shim \
bin/k3s-server \
bin/kubectl \
bin/crictl \
bin/ctr
# echo Building agent # echo Building agent
# CGO_ENABLED=1 go build -tags "$TAGS" -ldflags "$LDFLAGS $STATIC" -o bin/k3s-agent ./cmd/agent/main.go # CGO_ENABLED=1 go build -tags "$TAGS" -ldflags "$LDFLAGS $STATIC" -o bin/k3s-agent ./cmd/agent/main.go
echo Building server echo Building server

View File

@ -38,6 +38,10 @@ cp -f ./bin/hyperkube dist/artifacts/hyperkube${BIN_SUFFIX}
CMD_NAME=dist/artifacts/k3s${BIN_SUFFIX} CMD_NAME=dist/artifacts/k3s${BIN_SUFFIX}
go generate 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" 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'" STATIC="-extldflags '-static'"
CGO_ENABLED=0 go build -ldflags "$LDFLAGS $STATIC" -o ${CMD_NAME} ./cmd/k3s/main.go CGO_ENABLED=0 go build -ldflags "$LDFLAGS $STATIC" -o ${CMD_NAME} ./cmd/k3s/main.go

View File

@ -15,3 +15,6 @@ fi
ARCH=$(go env GOARCH) ARCH=$(go env GOARCH)
SUFFIX="-${ARCH}" SUFFIX="-${ARCH}"
VERSION_CONTAINERD=$(grep ^github.com/containerd/containerd $(dirname $0)/../vendor.conf | awk '{print $2}')
VERSION_CRICTL=$(grep ^github.com/kubernetes-sigs/cri-tools $(dirname $0)/../vendor.conf | awk '{print $2}')