Set cri-dockerd version at build time

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
This commit is contained in:
Brad Davidson 2023-01-21 01:31:16 +00:00 committed by Brad Davidson
parent f72649d1bd
commit 3cb6fa5cc7
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.20230121003321-6e0d61b90abb // k3s/release-1.26
github.com/Mirantis/cri-dockerd => github.com/k3s-io/cri-dockerd v0.3.2-0.20230123224936-bcd78c2d21d8 // k3s/release-1.26
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

4
go.sum
View File

@ -598,8 +598,8 @@ github.com/k3s-io/cadvisor v0.46.0-k3s1 h1:gaxTdqiMHl3nbvlF4Jq2D3J+vTiLwhI8rYBAq
github.com/k3s-io/cadvisor v0.46.0-k3s1/go.mod h1:n0SMyEENgkEGCmhaMRife+OArnPEHEK2z8NQf5n+Szw=
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.20230121003321-6e0d61b90abb h1:Y6cQWNtUjmfRG+7htOnBfFptfiHLIFPWID6Raztk1fs=
github.com/k3s-io/cri-dockerd v0.3.1-0.20230121003321-6e0d61b90abb/go.mod h1:AKPfBiTA3gcGRikXXmPlzX8nNoePITaiRQrRnE4Kc60=
github.com/k3s-io/cri-dockerd v0.3.2-0.20230123224936-bcd78c2d21d8 h1:FY36hRMFOGjLgd+pR7j2IehUDksjQdGy+6pvEhYbPCw=
github.com/k3s-io/cri-dockerd v0.3.2-0.20230123224936-bcd78c2d21d8/go.mod h1:AKPfBiTA3gcGRikXXmPlzX8nNoePITaiRQrRnE4Kc60=
github.com/k3s-io/cri-tools v1.26.0-rc.0-k3s1 h1:yWVy9pS0T1BWBMZBPRy2Q29gaLmaGknQHSnx+HStrVM=
github.com/k3s-io/cri-tools v1.26.0-rc.0-k3s1/go.mod h1:tARBj7XZ6i52ChmdHcHgcN0viYrfkANLHZWIEIsGcbs=
github.com/k3s-io/etcd/api/v3 v3.5.5-k3s1 h1:FnbCDHFALWvm7eZWptonEIdpl/qy6nrye7bEzC9uURk=

View File

@ -10,6 +10,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"
@ -25,6 +26,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

@ -47,6 +47,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}')