mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-05 10:50:18 +00:00
ci: Implement build step for CSI driver
This fully implements the compilation step for csi-kata-directvolume. This component can now be built by the CI running: $ cd tools/packaging/kata-deploy/local-build $ make csi-kata-directvolume-tarball A couple notes: * When installing the binary, we rename it from directvolplugin to csi-kata-directvolume on the fly to make it more readable. * We add go to the tools builder Dockerfile to support building this tool. * I've noticed the file install_libseccomp.sh gets created by the build process so I've added it to a .gitignore. Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
This commit is contained in:
1
src/tools/csi-kata-directvolume/.gitignore
vendored
Normal file
1
src/tools/csi-kata-directvolume/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
bin/
|
@@ -99,7 +99,7 @@ cloud-hypervisor-glibc-tarball:
|
|||||||
${MAKE} $@-build
|
${MAKE} $@-build
|
||||||
|
|
||||||
csi-kata-directvolume-tarball: copy-scripts-for-the-tools-build
|
csi-kata-directvolume-tarball: copy-scripts-for-the-tools-build
|
||||||
$(call DUMMY,$@)
|
${MAKE} $@-build
|
||||||
|
|
||||||
firecracker-tarball:
|
firecracker-tarball:
|
||||||
${MAKE} $@-build
|
${MAKE} $@-build
|
||||||
|
@@ -99,6 +99,7 @@ options:
|
|||||||
coco-guest-components
|
coco-guest-components
|
||||||
cloud-hypervisor
|
cloud-hypervisor
|
||||||
cloud-hypervisor-glibc
|
cloud-hypervisor-glibc
|
||||||
|
csi-kata-directvolume
|
||||||
firecracker
|
firecracker
|
||||||
genpolicy
|
genpolicy
|
||||||
kata-ctl
|
kata-ctl
|
||||||
@@ -1022,6 +1023,7 @@ install_tools_helper() {
|
|||||||
|
|
||||||
tool_binary=${tool}
|
tool_binary=${tool}
|
||||||
[ ${tool} = "agent-ctl" ] && tool_binary="kata-agent-ctl"
|
[ ${tool} = "agent-ctl" ] && tool_binary="kata-agent-ctl"
|
||||||
|
[ ${tool} = "csi-kata-directvolume" ] && tool_binary="directvolplugin"
|
||||||
[ ${tool} = "trace-forwarder" ] && tool_binary="kata-trace-forwarder"
|
[ ${tool} = "trace-forwarder" ] && tool_binary="kata-trace-forwarder"
|
||||||
binary=$(find ${repo_root_dir}/src/tools/${tool}/ -type f -name ${tool_binary})
|
binary=$(find ${repo_root_dir}/src/tools/${tool}/ -type f -name ${tool_binary})
|
||||||
|
|
||||||
@@ -1043,6 +1045,7 @@ install_tools_helper() {
|
|||||||
|
|
||||||
info "Install static ${tool_binary}"
|
info "Install static ${tool_binary}"
|
||||||
mkdir -p "${destdir}/opt/kata/bin/"
|
mkdir -p "${destdir}/opt/kata/bin/"
|
||||||
|
[ ${tool} = "csi-kata-directvolume" ] && tool_binary="csi-kata-directvolume"
|
||||||
install -D --mode ${binary_permissions} ${binary} "${destdir}/opt/kata/bin/${tool_binary}"
|
install -D --mode ${binary_permissions} ${binary} "${destdir}/opt/kata/bin/${tool_binary}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1054,6 +1057,10 @@ install_genpolicy() {
|
|||||||
install_tools_helper "genpolicy"
|
install_tools_helper "genpolicy"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
install_csi_kata_directvolume() {
|
||||||
|
install_tools_helper "csi-kata-directvolume"
|
||||||
|
}
|
||||||
|
|
||||||
install_kata_ctl() {
|
install_kata_ctl() {
|
||||||
install_tools_helper "kata-ctl"
|
install_tools_helper "kata-ctl"
|
||||||
}
|
}
|
||||||
@@ -1131,6 +1138,8 @@ handle_build() {
|
|||||||
|
|
||||||
cloud-hypervisor-glibc) install_clh_glibc ;;
|
cloud-hypervisor-glibc) install_clh_glibc ;;
|
||||||
|
|
||||||
|
csi-kata-directvolume) install_csi_kata_directvolume ;;
|
||||||
|
|
||||||
firecracker) install_firecracker ;;
|
firecracker) install_firecracker ;;
|
||||||
|
|
||||||
genpolicy) install_genpolicy ;;
|
genpolicy) install_genpolicy ;;
|
||||||
@@ -1350,6 +1359,7 @@ main() {
|
|||||||
agent-ctl
|
agent-ctl
|
||||||
cloud-hypervisor
|
cloud-hypervisor
|
||||||
coco-guest-components
|
coco-guest-components
|
||||||
|
csi-kata-directvolume
|
||||||
firecracker
|
firecracker
|
||||||
genpolicy
|
genpolicy
|
||||||
kata-ctl
|
kata-ctl
|
||||||
|
1
tools/packaging/static-build/tools/.gitignore
vendored
Normal file
1
tools/packaging/static-build/tools/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
install_libseccomp.sh
|
@@ -10,9 +10,12 @@ COPY install_libseccomp.sh /usr/bin/install_libseccomp.sh
|
|||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
ENV GO_HOME="/opt"
|
||||||
|
ENV GOCACHE="${GO_HOME}/.cache"
|
||||||
|
ENV GOMODCACHE="${GO_HOME}/.modcache"
|
||||||
ENV RUSTUP_HOME="/opt/rustup"
|
ENV RUSTUP_HOME="/opt/rustup"
|
||||||
ENV CARGO_HOME="/opt/cargo"
|
ENV CARGO_HOME="/opt/cargo"
|
||||||
ENV PATH="/opt/cargo/bin/:${PATH}"
|
ENV PATH="/opt/cargo/bin/:/opt/go/bin:${PATH}"
|
||||||
ENV OPT_LIB="/opt/lib"
|
ENV OPT_LIB="/opt/lib"
|
||||||
|
|
||||||
ENV LIBSECCOMP_LINK_TYPE=static
|
ENV LIBSECCOMP_LINK_TYPE=static
|
||||||
@@ -44,6 +47,11 @@ RUN apt-get update && \
|
|||||||
# Tools only build for x86_64
|
# Tools only build for x86_64
|
||||||
RUN rustup target add x86_64-unknown-linux-musl
|
RUN rustup target add x86_64-unknown-linux-musl
|
||||||
|
|
||||||
|
RUN kernelname=$(uname -s | tr '[:upper:]' '[:lower:]'); \
|
||||||
|
curl -OL "https://storage.googleapis.com/golang/go${GO_TOOLCHAIN}.${kernelname}-amd64.tar.gz" && \
|
||||||
|
tar -C "${GO_HOME}" -xzf "go${GO_TOOLCHAIN}.${kernelname}-amd64.tar.gz" && \
|
||||||
|
rm "go${GO_TOOLCHAIN}.${kernelname}-amd64.tar.gz"
|
||||||
|
|
||||||
# cmake looks for musl binutils
|
# cmake looks for musl binutils
|
||||||
# For setting CMAKE_AR, find_program searches for musl-ar.
|
# For setting CMAKE_AR, find_program searches for musl-ar.
|
||||||
# Symlink to system ar.
|
# Symlink to system ar.
|
||||||
|
@@ -20,6 +20,7 @@ container_image="${TOOLS_CONTAINER_BUILDER:-$(get_tools_image_name)}"
|
|||||||
|
|
||||||
docker pull ${container_image} || \
|
docker pull ${container_image} || \
|
||||||
(docker $BUILDX build $PLATFORM \
|
(docker $BUILDX build $PLATFORM \
|
||||||
|
--build-arg GO_TOOLCHAIN="$(get_from_kata_deps ".languages.golang.meta.newest-version")" \
|
||||||
--build-arg RUST_TOOLCHAIN="$(get_from_kata_deps ".languages.rust.meta.newest-version")" \
|
--build-arg RUST_TOOLCHAIN="$(get_from_kata_deps ".languages.rust.meta.newest-version")" \
|
||||||
-t "${container_image}" "${script_dir}" && \
|
-t "${container_image}" "${script_dir}" && \
|
||||||
# No-op unless PUSH_TO_REGISTRY is exported as "yes"
|
# No-op unless PUSH_TO_REGISTRY is exported as "yes"
|
||||||
|
Reference in New Issue
Block a user