Set cri-dockerd version at build time

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
pull/6838/head
Brad Davidson 2023-01-21 01:31:16 +00:00 committed by Brad Davidson
parent 3897a9e8d1
commit be26a6e618
5 changed files with 16 additions and 4 deletions

2
go.mod
View File

@ -4,7 +4,7 @@ go 1.19
replace (
github.com/Microsoft/hcsshim => github.com/Microsoft/hcsshim v0.8.22
github.com/Mirantis/cri-dockerd => github.com/k3s-io/cri-dockerd v0.3.1-0.20230121003339-6a10f78a13eb // k3s/release-1.24
github.com/Mirantis/cri-dockerd => github.com/k3s-io/cri-dockerd v0.3.2-0.20230123224751-84abd1adca2f // k3s/release-1.24
github.com/cloudnativelabs/kube-router => github.com/k3s-io/kube-router v1.5.2-0.20221026101626-e01045262706
github.com/containerd/cgroups => github.com/containerd/cgroups v1.0.1
github.com/containerd/containerd => github.com/k3s-io/containerd v1.5.16-k3s1 // k3s-release/1.5

4
go.sum
View File

@ -617,8 +617,8 @@ github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8
github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes=
github.com/k3s-io/containerd v1.5.16-k3s1 h1:r8WBp1DJS5OfGWV4XMohQ3SkQnreZRK1E4lT02xUXiA=
github.com/k3s-io/containerd v1.5.16-k3s1/go.mod h1:vCILl/gWFsZXZVuIrDefia9pbKe7cpWbpavHNET9axM=
github.com/k3s-io/cri-dockerd v0.3.1-0.20230121003339-6a10f78a13eb h1:5l5tdPPyOVp4pa+3ddv/SmDCSxg+DNFjzv64ZFhsOJo=
github.com/k3s-io/cri-dockerd v0.3.1-0.20230121003339-6a10f78a13eb/go.mod h1:ueOhVo7Wl03vKTKYFWNVUvVJ2LNDkmWfSs4z2Th8Um4=
github.com/k3s-io/cri-dockerd v0.3.2-0.20230123224751-84abd1adca2f h1:IE2u6OszvDDSiKEK5cqFYN6Dv6JwJa2CBHOsfyhwWck=
github.com/k3s-io/cri-dockerd v0.3.2-0.20230123224751-84abd1adca2f/go.mod h1:ueOhVo7Wl03vKTKYFWNVUvVJ2LNDkmWfSs4z2Th8Um4=
github.com/k3s-io/cri-tools v1.24.0-k3s1 h1:Em7IZ/ElBFbHlPLjV0w2ttORxFl5upBxnbP/9IlT/3c=
github.com/k3s-io/cri-tools v1.24.0-k3s1/go.mod h1:w4C33mk2AZdmAVybCyVbHYJUKdbr1sRelBTG7lduYh0=
github.com/k3s-io/etcd/api/v3 v3.5.3-k3s1 h1:XY2oUIIy2+DR7zXk/BVqQ4f2qFHbd2VTAGrnrT4IxhA=

View File

@ -7,6 +7,7 @@ import (
"strings"
"github.com/Mirantis/cri-dockerd/cmd"
"github.com/Mirantis/cri-dockerd/cmd/version"
"github.com/k3s-io/k3s/pkg/cgroups"
"github.com/k3s-io/k3s/pkg/daemons/config"
"github.com/sirupsen/logrus"
@ -22,6 +23,7 @@ func Run(ctx context.Context, cfg *config.Node) error {
command := cmd.NewDockerCRICommand(ctx.Done())
command.SetArgs(args)
logrus.Infof("Running cri-dockerd %s", config.ArgString(args))
logrus.Infof("cri-dockerd version %s", version.FullVersion())
go func() {
defer func() {

View File

@ -15,6 +15,7 @@ PKG_K8S_BASE="k8s.io/component-base"
PKG_K8S_CLIENT="k8s.io/client-go/pkg"
PKG_CNI_PLUGINS="github.com/containernetworking/plugins"
PKG_KUBE_ROUTER="github.com/cloudnativelabs/kube-router"
PKG_CRI_DOCKERD="github.com/Mirantis/cri-dockerd"
buildDate=$(date -u '+%Y-%m-%dT%H:%M:%SZ')
@ -40,11 +41,15 @@ VERSIONFLAGS="
-X ${PKG_CNI_PLUGINS}/pkg/utils/buildversion.BuildVersion=${VERSION_CNIPLUGINS}
-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.Commit=HEAD
-X ${PKG_CNI_PLUGINS}/plugins/meta/flannel.buildDate=${buildDate}
-X ${PKG_KUBE_ROUTER}/pkg/version.Version=${VERSION_KUBE_ROUTER}
-X ${PKG_KUBE_ROUTER}/pkg/version.BuildDate=${buildDate}
-X ${PKG_CRI_DOCKERD}/cmd/version.Version=${VERSION_CRI_DOCKERD}
-X ${PKG_CRI_DOCKERD}/cmd/version.GitCommit=HEAD
-X ${PKG_CRI_DOCKERD}/cmd/version.BuildTime=${buildDate}
"
if [ -n "${DEBUG}" ]; then

View File

@ -46,6 +46,11 @@ if [ -z "$VERSION_FLANNEL" ]; then
VERSION_FLANNEL="v0.0.0"
fi
VERSION_CRI_DOCKERD=$(grep github.com/Mirantis/cri-dockerd go.mod | head -n1 | awk '{print $4}')
if [ -z "$VERSION_CRI_DOCKERD" ]; then
VERSION_CRI_DOCKERD="v0.0.0"
fi
VERSION_CNIPLUGINS="v1.1.1-k3s1"
VERSION_KUBE_ROUTER=$(grep github.com/k3s-io/kube-router go.mod | head -n1 | awk '{print $4}')