From a031d9178a993cecda10acb41c8f192174c39e62 Mon Sep 17 00:00:00 2001 From: Matthew James Briggs Date: Thu, 31 Aug 2023 12:18:38 -0700 Subject: [PATCH] build: allow skipping of twoliter install The cargo install of Twoliter was causing a call out to the git repository even if Twoliter was already installed. This is a problem in intentionally offline environments. Furthermore, in the future we plan to curl a binary release of Twoliter, which means we will need a way to skip the installation there as well. This commit introduces a Makefile.toml variable SKIP_TWOLITER_INSTALL which can be used to skip the installation of Twoliter when it has already been installed. --- Makefile.toml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Makefile.toml b/Makefile.toml index a4934e85971..e9dfd00ba06 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -3,6 +3,11 @@ skip_core_tasks = true [env] BUILDSYS_ROOT_DIR = "${CARGO_MAKE_WORKING_DIRECTORY}" +# The build tool, Twoliter, needs to be installed to run a Bottlerocket build. +# If you need to build in an offline environment, first you should run `cargo +# make fetch` in an online environment. Subsequently in the offline environment +# you need to set this to true. `cargo make -e TWOLITER_SKIP_INSTALL=true build` +TWOLITER_SKIP_INSTALL = "false" # TODO - replace with crates.io version when published TWOLITER_GIT = "https://github.com/bottlerocket-os/twoliter" TWOLITER_REV = "v0.0.2" @@ -242,8 +247,15 @@ fi ] } [tasks.install-twoliter] +script_runner = "bash" script = [ ''' +if [ "${TWOLITER_SKIP_INSTALL}" = "true" ]; then + echo "TWOLITER_SKIP_INSTALL=${TWOLITER_SKIP_INSTALL}" + echo "Skipping Twoliter installation" + exit 0 +fi + cargo install \ --locked \ --root "${TWOLITER_INSTALL_ROOT}" \