Skip to content

Commit

Permalink
Merge pull request bottlerocket-os#3429 from webern/tools-install
Browse files Browse the repository at this point in the history
update twoliter and remove tools
  • Loading branch information
webern authored Sep 14, 2023
2 parents 721176b + cf77c9b commit c4d2da8
Show file tree
Hide file tree
Showing 93 changed files with 234 additions and 24,538 deletions.
98 changes: 65 additions & 33 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,38 @@ 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"

# Skip installing Twoliter if it is already installed its version
# matches the requested version.
TWOLITER_REUSE_EXISTING_INSTALL="true"

# Allow Twoliter to be installed Twoliter from a binary distribution if binaries
# are expected to exist for the host OS and architecture.
TWOLITER_ALLOW_BINARY_INSTALL="true"

# Allow Twoliter to be installed by building from sourcecode.
TWOLITER_ALLOW_SOURCE_INSTALL="true"

# Where Twoliter will be installed.
TWOLITER_INSTALL_DIR = "${BUILDSYS_ROOT_DIR}/tools/twoliter"

# For binary installation, this should be a released version (prefixed with a v,
# for example v0.1.0). For the git sourcecode installation method, this can be
# any git rev, e.g. a tag, sha, or branch name.
TWOLITER_VERSION = "v0.0.3"

# For binary installation method, this is GitHub repository that has binary
# release artifacts attached to it, for example
# https://github.com/bottlerocket-os/twoliter For git sourcecode installation,
# this is any URI that can be used in a git clone command.
TWOLITER_REPO = "https://github.com/bottlerocket-os/twoliter"

# The logging verbosity for Twoliter: error, warn, info, debug, trace
TWOLITER_LOG_LEVEL = "info"
TWOLITER_INSTALL_ROOT = "${BUILDSYS_ROOT_DIR}/tools"
TWOLITER_BIN_DIR = "${TWOLITER_INSTALL_ROOT}/bin"
TWOLITER = "${TWOLITER_BIN_DIR}/twoliter"

# The project file that configures Twoliter.
TWOLITER_PROJECT = "${BUILDSYS_ROOT_DIR}/Twoliter.toml"

BUILDSYS_ARCH = { script = ['echo "${BUILDSYS_ARCH:-$(uname -m)}"'] }
BUILDSYS_BUILD_DIR = "${BUILDSYS_ROOT_DIR}/build"
BUILDSYS_PACKAGES_DIR = "${BUILDSYS_BUILD_DIR}/rpms"
Expand Down Expand Up @@ -150,6 +169,8 @@ TESTSYS_TEST_CONFIG_PATH = "${BUILDSYS_ROOT_DIR}/Test.toml"
# Certain variables are defined here to allow us to override a component value
# on the command line.

TWOLITER = "${TWOLITER_INSTALL_DIR}/twoliter"

# Depends on ${BUILDSYS_ARCH}, ${BUILDSYS_REGISTRY}, ${BUILDSYS_SDK_NAME}, and
# ${BUILDSYS_SDK_VERSION}.
BUILDSYS_SDK_IMAGE = { script = [ "echo ${BUILDSYS_REGISTRY}/${BUILDSYS_SDK_NAME}-sdk-${BUILDSYS_ARCH}:${BUILDSYS_SDK_VERSION}" ] }
Expand Down Expand Up @@ -250,19 +271,25 @@ fi
script_runner = "bash"
script = [
'''
if [ "${TWOLITER_SKIP_INSTALL}" = "true" ]; then
echo "TWOLITER_SKIP_INSTALL=${TWOLITER_SKIP_INSTALL}"
echo "Skipping Twoliter installation"
exit 0
declare -a flags
if [ "${TWOLITER_REUSE_EXISTING_INSTALL}" = "true" ]; then
flags+=("--reuse-existing-install")
fi
if [ "${TWOLITER_ALLOW_BINARY_INSTALL}" = "true" ]; then
flags+=("--allow-binary-install")
fi
if [ "${TWOLITER_ALLOW_SOURCE_INSTALL}" = "true" ]; then
flags+=("--allow-from-source")
fi
cargo install \
--locked \
--root "${TWOLITER_INSTALL_ROOT}" \
--quiet \
--git "${TWOLITER_GIT}" \
--rev "${TWOLITER_REV}" \
twoliter
"${BUILDSYS_TOOLS_DIR}/install-twoliter.sh" \
--repo "${TWOLITER_REPO}" \
--version "${TWOLITER_VERSION}" \
--directory "${TWOLITER_INSTALL_DIR}" \
"${flags[@]}"
'''
]

Expand All @@ -279,6 +306,17 @@ args = [
"${@}",
]

[tasks.deprecated]
dependencies = ["install-twoliter"]
script_runner = "bash"
script = [
'''
echo "The '${CARGO_MAKE_TASK}' task is deprecated."
echo "All it does is ensure that Twoliter is installed."
echo "You should do this with 'cargo make install-twoliter' instead.",
'''
]

[tasks.setup]
run_task = "run-twoliter"

Expand Down Expand Up @@ -326,18 +364,15 @@ run_task = "run-twoliter"
run_task = "run-twoliter"

[tasks.build-tools]
run_task = "run-twoliter"
run_task = "deprecated"

# Note: this is separate from publish-tools because publish-tools takes a while
# to build and isn't needed to build an image.
[tasks.publish-setup-tools]
run_task = "run-twoliter"

[tasks.infra-tools]
run_task = "run-twoliter"
run_task = "deprecated"

[tasks.publish-tools]
run_task = "run-twoliter"
run_task = "deprecated"

[tasks.build-sbkeys]
run_task = "run-twoliter"
Expand Down Expand Up @@ -370,10 +405,7 @@ run_task = "run-twoliter"
run_task = "run-twoliter"

[tasks.tuftool]
run_task = "run-twoliter"

[tasks.create-infra]
run_task = "run-twoliter"
run_task = "deprecated"

[tasks.publish-setup]
run_task = "run-twoliter"
Expand Down Expand Up @@ -472,7 +504,7 @@ run_task = "run-twoliter"
run_task = "run-twoliter"

[tasks.test-tools]
run_task = "run-twoliter"
run_task = "deprecated"

[tasks.setup-test]
run_task = "run-twoliter"
Expand Down
1 change: 1 addition & 0 deletions tools/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/bin
/twoliter
/.crates.toml
/.crates2.json
Loading

0 comments on commit c4d2da8

Please sign in to comment.