mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-17 23:07:55 +00:00
rootfs: Install Rust only when necessary
For docker-based builds only install Rust when necessary. Further, execute the detect Rust version check only when intending to install Rust. As of today, this is the case when we intend to build the agent during rootfs build. Signed-off-by: Manuel Huber <mahuber@microsoft.com>
This commit is contained in:
@@ -385,12 +385,6 @@ build_rootfs_distro()
|
|||||||
mkdir -p ${ROOTFS_DIR}
|
mkdir -p ${ROOTFS_DIR}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# need to detect rustc's version too?
|
|
||||||
detect_rust_version ||
|
|
||||||
die "Could not detect the required rust version for AGENT_VERSION='${AGENT_VERSION:-main}'."
|
|
||||||
|
|
||||||
echo "Required rust version: $RUST_VERSION"
|
|
||||||
|
|
||||||
if [ "${SELINUX}" == "yes" ]; then
|
if [ "${SELINUX}" == "yes" ]; then
|
||||||
if [ "${AGENT_INIT}" == "yes" ]; then
|
if [ "${AGENT_INIT}" == "yes" ]; then
|
||||||
die "Guest SELinux with the agent init is not supported yet"
|
die "Guest SELinux with the agent init is not supported yet"
|
||||||
|
@@ -225,14 +225,23 @@ generate_dockerfile()
|
|||||||
|
|
||||||
[ -n "${http_proxy:-}" ] && readonly set_proxy="RUN sed -i '$ a proxy="${http_proxy:-}"' /etc/dnf/dnf.conf /etc/yum.conf; true"
|
[ -n "${http_proxy:-}" ] && readonly set_proxy="RUN sed -i '$ a proxy="${http_proxy:-}"' /etc/dnf/dnf.conf /etc/yum.conf; true"
|
||||||
|
|
||||||
# Rust agent
|
# Only install Rust if agent needs to be built
|
||||||
readonly install_rust="
|
local install_rust=""
|
||||||
|
|
||||||
|
if [ ! -z "${AGENT_SOURCE_BIN}" ] ; then
|
||||||
|
if [ "$RUST_VERSION" == "null" ]; then
|
||||||
|
detect_rust_version || \
|
||||||
|
die "Could not detect the required rust version for AGENT_VERSION='${AGENT_VERSION:-main}'."
|
||||||
|
fi
|
||||||
|
install_rust="
|
||||||
ENV http_proxy=${http_proxy:-}
|
ENV http_proxy=${http_proxy:-}
|
||||||
ENV https_proxy=${http_proxy:-}
|
ENV https_proxy=${http_proxy:-}
|
||||||
RUN curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSLf | \
|
RUN curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSLf | \
|
||||||
sh -s -- -y --default-toolchain ${RUST_VERSION} -t ${rustarch}-unknown-linux-${LIBC}
|
sh -s -- -y --default-toolchain ${RUST_VERSION} -t ${rustarch}-unknown-linux-${LIBC}
|
||||||
RUN . /root/.cargo/env; cargo install cargo-when
|
RUN . /root/.cargo/env; cargo install cargo-when
|
||||||
"
|
"
|
||||||
|
fi
|
||||||
|
|
||||||
pushd "${dir}"
|
pushd "${dir}"
|
||||||
|
|
||||||
sed \
|
sed \
|
||||||
|
Reference in New Issue
Block a user