cni: pass BuildVersion info to avoid runtime warning

The default value of BuildVersion is 'unknown' and it
requires an override at link time to embed such version
info into binary.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Changqing Li <changqing.li@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
This commit is contained in:
Changqing Li 2024-04-24 16:11:55 +08:00 committed by Bruce Ashfield
parent b50d4899fa
commit 7ccaa4ac22

View File

@ -34,6 +34,7 @@ LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=fa818a259cbed7ce8bc2a22d35a464
GO_IMPORT = "import"
PV = "v1.2.0-rc0+git${SRCREV_cni}"
CNI_VERSION = "v1.2.0"
inherit go
inherit goarch
@ -68,7 +69,7 @@ do_compile() {
for p in $PLUGINS; do
plugin="$(basename "$p")"
echo "building: $p"
${GO} build ${GOBUILDFLAGS} -o ${B}/plugins/bin/$plugin github.com/containernetworking/plugins/$p
${GO} build ${GOBUILDFLAGS} -ldflags '-X github.com/containernetworking/plugins/pkg/utils/buildversion.BuildVersion=${CNI_VERSION}' -o ${B}/plugins/bin/$plugin github.com/containernetworking/plugins/$p
done
}