From 3cb6fa5cc780229c9d2628175bd3ee827b471841 Mon Sep 17 00:00:00 2001 From: Brad Davidson Date: Sat, 21 Jan 2023 01:31:16 +0000 Subject: [PATCH] Set cri-dockerd version at build time Signed-off-by: Brad Davidson --- go.mod | 2 +- go.sum | 4 ++-- pkg/agent/cridockerd/cridockerd.go | 2 ++ scripts/build | 7 ++++++- scripts/version.sh | 5 +++++ 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 514e56b745..ed59b44c23 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index ab12f80351..563f0a7797 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/pkg/agent/cridockerd/cridockerd.go b/pkg/agent/cridockerd/cridockerd.go index 433250b395..a93c4e756a 100644 --- a/pkg/agent/cridockerd/cridockerd.go +++ b/pkg/agent/cridockerd/cridockerd.go @@ -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() { diff --git a/scripts/build b/scripts/build index 8f121aa875..71d8a00647 100755 --- a/scripts/build +++ b/scripts/build @@ -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 diff --git a/scripts/version.sh b/scripts/version.sh index ead9836e6f..6795299ae6 100755 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -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}')