summaryrefslogtreecommitdiffstats
path: root/recipes-networking/cni
diff options
context:
space:
mode:
authorMark Asselstine <mark.asselstine@windriver.com>2020-03-06 16:53:42 -0500
committerBruce Ashfield <bruce.ashfield@gmail.com>2020-03-13 21:53:26 -0400
commitde94eb157240b1b15c2da091b203a03cbd69f7cf (patch)
treea9ca0f6e87853709e8432981aa1f7b300c03035d /recipes-networking/cni
parente65c3761e08ad5e4a7d33a8ccfb13d0a533d3343 (diff)
downloadmeta-virtualization-de94eb157240b1b15c2da091b203a03cbd69f7cf.tar.gz
cni: prevent go from downloading stuff in the background
While testing the cni uprev by building in a container with network=none the following error was found: go: github.com/Microsoft/go-winio@v0.4.11: Get https://proxy.golang.org/github.com/%21microsoft/go-winio/@v/v0.4.11.mod: dial tcp: lookup proxy.golang.org on 128.224.144.130:53: dial udp 128.224.144.130:53: connect: network is unreachable After some digging through the go documentation it was found that the '-mod=vendor' is required for 'go build' to use shipped vendor modules when building modules. This can be confirmed by look at the 'build_linux.sh' script which is found in the plugins repo. By using '-mod=vendor' and also ensuring things are properly placed in the GOPATH (ie $B) we can avoid having to create many of the links we had been previously. We also put all the build artifacts into $B to avoid mixing source and build. Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Diffstat (limited to 'recipes-networking/cni')
-rw-r--r--recipes-networking/cni/cni_git.bb32
1 files changed, 9 insertions, 23 deletions
diff --git a/recipes-networking/cni/cni_git.bb b/recipes-networking/cni/cni_git.bb
index a81e6ccc..3ad939bd 100644
--- a/recipes-networking/cni/cni_git.bb
+++ b/recipes-networking/cni/cni_git.bb
@@ -14,7 +14,7 @@ SRCREV_cni = "4cfb7b568922a3c79a23e438dc52fe537fc9687e"
14SRCREV_plugins = "1f33fb729ae2b8900785f896df2dc1f6fe5e8239" 14SRCREV_plugins = "1f33fb729ae2b8900785f896df2dc1f6fe5e8239"
15SRC_URI = "\ 15SRC_URI = "\
16 git://github.com/containernetworking/cni.git;nobranch=1;name=cni \ 16 git://github.com/containernetworking/cni.git;nobranch=1;name=cni \
17 git://github.com/containernetworking/plugins.git;nobranch=1;destsuffix=plugins;name=plugins \ 17 git://github.com/containernetworking/plugins.git;nobranch=1;destsuffix=${S}/src/github.com/containernetworking/plugins;name=plugins \
18 " 18 "
19 19
20RPROVIDES_${PN} += "kubernetes-cni" 20RPROVIDES_${PN} += "kubernetes-cni"
@@ -30,36 +30,22 @@ inherit go
30inherit goarch 30inherit goarch
31 31
32do_compile() { 32do_compile() {
33 # link fixups for compilation 33 mkdir -p ${S}/src/github.com/containernetworking
34 rm -f ${S}/src/import/vendor/src 34 ln -sfr ${S}/src/import ${S}/src/github.com/containernetworking/cni
35 mkdir -p ${S}/src/import/vendor/
36 ln -sf ./ ${S}/src/import/vendor/src
37 rm -rf ${S}/src/import/plugins
38 rm -rf ${S}/src/import/vendor/github.com/containernetworking/plugins
39 35
40 mkdir -p ${S}/src/import/vendor/github.com/containernetworking/cni 36 cd ${B}/src/github.com/containernetworking/cni/libcni
41
42 ln -sf ../../../../libcni ${S}/src/import/vendor/github.com/containernetworking/cni/libcni
43 ln -sf ../../../../pkg ${S}/src/import/vendor/github.com/containernetworking/cni/pkg
44 ln -sf ../../../../cnitool ${S}/src/import/vendor/github.com/containernetworking/cni/cnitool
45 ln -sf ${WORKDIR}/plugins ${S}/src/import/vendor/github.com/containernetworking/plugins
46
47 export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
48 export CGO_ENABLED="1"
49
50 cd ${S}/src/import/vendor/github.com/containernetworking/cni/libcni
51 ${GO} build 37 ${GO} build
52 38
53 cd ${S}/src/import/vendor/github.com/containernetworking/cni/cnitool 39 cd ${B}/src/github.com/containernetworking/cni/cnitool
54 ${GO} build 40 ${GO} build
55 41
56 cd ${S}/src/import/vendor/github.com/containernetworking/plugins/ 42 cd ${B}/src/github.com/containernetworking/plugins
57 PLUGINS="$(ls -d plugins/meta/*; ls -d plugins/ipam/*; ls -d plugins/main/* | grep -v windows)" 43 PLUGINS="$(ls -d plugins/meta/*; ls -d plugins/ipam/*; ls -d plugins/main/* | grep -v windows)"
58 mkdir -p ${WORKDIR}/plugins/bin/ 44 mkdir -p ${B}/plugins/bin/
59 for p in $PLUGINS; do 45 for p in $PLUGINS; do
60 plugin="$(basename "$p")" 46 plugin="$(basename "$p")"
61 echo "building: $p" 47 echo "building: $p"
62 ${GO} build -o ${WORKDIR}/plugins/bin/$plugin github.com/containernetworking/plugins/$p 48 ${GO} build -mod=vendor -o ${B}/plugins/bin/$plugin github.com/containernetworking/plugins/$p
63 done 49 done
64} 50}
65 51
@@ -70,7 +56,7 @@ do_install() {
70 install -d ${D}/${sysconfdir}/cni/net.d 56 install -d ${D}/${sysconfdir}/cni/net.d
71 57
72 install -m 755 ${S}/src/import/cnitool/cnitool ${D}/${localbindir} 58 install -m 755 ${S}/src/import/cnitool/cnitool ${D}/${localbindir}
73 install -m 755 -D ${WORKDIR}/plugins/bin/* ${D}/${localbindir} 59 install -m 755 -D ${B}/plugins/bin/* ${D}/${localbindir}
74 60
75 # Parts of k8s expect the cni binaries to be available in /opt/cni 61 # Parts of k8s expect the cni binaries to be available in /opt/cni
76 install -d ${D}/opt/cni 62 install -d ${D}/opt/cni