Add CNI Plugins and Flannel version to build scripts

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
This commit is contained in:
Brad Davidson 2022-04-19 14:48:04 -07:00 committed by Brad Davidson
parent 418c3fa858
commit 1caae63140
2 changed files with 13 additions and 4 deletions

View File

@ -13,6 +13,7 @@ PKG_K3S_CONTAINERD="github.com/k3s-io/containerd"
PKG_CRICTL="github.com/kubernetes-sigs/cri-tools/pkg" PKG_CRICTL="github.com/kubernetes-sigs/cri-tools/pkg"
PKG_K8S_BASE="k8s.io/component-base" PKG_K8S_BASE="k8s.io/component-base"
PKG_K8S_CLIENT="k8s.io/client-go/pkg" PKG_K8S_CLIENT="k8s.io/client-go/pkg"
PKG_CNI_PLUGINS="github.com/containernetworking/plugins"
buildDate=$(date -u '+%Y-%m-%dT%H:%M:%SZ') buildDate=$(date -u '+%Y-%m-%dT%H:%M:%SZ')
@ -35,8 +36,11 @@ VERSIONFLAGS="
-X ${PKG_CONTAINERD}/version.Version=${VERSION_CONTAINERD} -X ${PKG_CONTAINERD}/version.Version=${VERSION_CONTAINERD}
-X ${PKG_CONTAINERD}/version.Package=${PKG_K3S_CONTAINERD} -X ${PKG_CONTAINERD}/version.Package=${PKG_K3S_CONTAINERD}
-X ${PKG_CONTAINERD}/version.Version=${VERSION_CONTAINERD} -X ${PKG_CNI_PLUGINS}/pkg/utils/buildversion.BuildVersion=${VERSION_CNIPLUGINS}
-X ${PKG_CONTAINERD}/version.Package=${PKG_K3S_CONTAINERD} -X ${PKG_CNI_PLUGINS}/plugins/meta/flannel.Program=flannel
-X ${PKG_CNI_PLUGINS}/plugins/meta/flannel.Version=${VERSION_FLANNEL}
-X ${PKG_CNI_PLUGINS}/plugins/meta/flannel.Commit=${COMMIT}
-X ${PKG_CNI_PLUGINS}/plugins/meta/flannel.buildDate=${buildDate}
" "
LDFLAGS=" LDFLAGS="
-w -s" -w -s"
@ -101,7 +105,7 @@ if [ ! -x ${INSTALLBIN}/cni ]; then
WORKDIR=$TMPDIR/src/github.com/containernetworking/plugins WORKDIR=$TMPDIR/src/github.com/containernetworking/plugins
git clone -b $VERSION_CNIPLUGINS https://github.com/rancher/plugins.git $WORKDIR git clone -b $VERSION_CNIPLUGINS https://github.com/rancher/plugins.git $WORKDIR
cd $WORKDIR cd $WORKDIR
GO111MODULE=off GOPATH=$TMPDIR CGO_ENABLED=0 "${GO}" build -tags "$TAGS" -ldflags "$LDFLAGS $STATIC" -o $INSTALLBIN/cni GO111MODULE=off GOPATH=$TMPDIR CGO_ENABLED=0 "${GO}" build -tags "$TAGS" -ldflags "$VERSIONFLAGS $LDFLAGS $STATIC" -o $INSTALLBIN/cni
) )
fi fi

View File

@ -42,7 +42,12 @@ if [ -z "$VERSION_RUNC" ]; then
VERSION_RUNC="v0.0.0" VERSION_RUNC="v0.0.0"
fi fi
VERSION_CNIPLUGINS="v1.0.1-k3s1" VERSION_FLANNEL=$(grep github.com/flannel-io/flannel go.mod | head -n1 | awk '{print $2}')
if [ -z "$VERSION_FLANNEL" ]; then
VERSION_FLANNEL="v0.0.0"
fi
VERSION_CNIPLUGINS="v1.1.1-k3s1"
VERSION_ROOT="v0.11.0" VERSION_ROOT="v0.11.0"