A build tool for creating custom Bottlerocket variants.
This project is a work in progress and is not ready for outside contributors yet. Issues marked as "good first issue" are intended for team members at this time. There is a design doc describing how Twoliter is intended to be built, here
We welcome ideas and requirements in the form of issues and comments!
This section includes information for maintainers about testing and releasing Twoliter.
If you run cargo test
you will get the default features which includes the feature integ-tests
.
These will be quite slow as some of them do complete builds.
If you don't have time for that, run cargo test --no-default-features
to run only the fast tests.
In general, if you have changes to Twoliter and want to try them out in a Twoliter project, it is as simple as building the Twoliter binary and using it in your project. Different projects will have different ways of making sure the correct Twoliter binary is being used. For example, Bottlerocket has a script and Makefile.toml variables that ensure the correct version of Twoliter is being used to build Bottlerocket. The following sections describe how to use those mechanisms to use a non-released version of Twoliter.
The process of testing changes to Twoliter in Bottlerocket is as follows:
cargo make
commands with the following environment
variables.# The URL to the Twoliter git repository. This can be anything that git remote add would accept.
# Here we are using a path on the local filesystem.
TWOLITER_REPO=file:///home/myuser/repos/twoliter
# The sha of the commit you want to use. Make sure changes have been committed!
TWOLITER_VERSION=a8b30def
# These need to be set as follows.
TWOLITER_ALLOW_SOURCE_INSTALL=true
TWOLITER_ALLOW_BINARY_INSTALL=false
TWOLITER_SKIP_VERSION_CHECK=true
So, for example, to build a Bottlerocket image using a commit on a fork, I would look like this:
rm -rf tools/twoliter
cargo make -e=TWOLITER_REPO=https://github.com/webern/twoliter \
-e=TWOLITER_VERSION=11afef09 \
-e=TWOLITER_ALLOW_SOURCE_INSTALL=true \
-e=TWOLITER_ALLOW_BINARY_INSTALL=false \
-e=TWOLITER_SKIP_VERSION_CHECK=true \
build-variant
Another way you can test your Twoliter changes in the Bottlerocket repo is by building twoliter and
moving it into the right place, then telling cargo make
not to install Twoliter at all.
For example, if you have set TWOLITER_REPO
and BOTTLEROCKET_REPO
to the respective local git repositories, then:
cd $TWOLITER_REPO
cargo build --release --package twoliter --bin twoliter
rm -rf $BOTTLEROCKET_REPO/tools/twoliter
mkdir -p $BOTTLEROCKET_REPO/tools/twoliter
cp $TWOLITER_REPO/target/release/twoliter $BOTTLEROCKET_REPO/tools/twoliter
cd $BOTTLEROCKET_REPO
cargo make \
-e=TWOLITER_ALLOW_SOURCE_INSTALL=false \
-e=TWOLITER_ALLOW_BINARY_INSTALL=false \
-e=TWOLITER_SKIP_VERSION_CHECK=true \
build-variant
A release consists of a semver tag in the form v0.0.0
.
We also use release-candidate tags in the form v0.0.0-rc1
.
We use a fork of cargo-dist
to facilitate binary releases.
The purpose of the cargo-dist
fork is to enable cross-compilation with cross
We do not release Twoliter into crates.io
.
cargo-dist
is run by GitHub Actions, and the release workflow requires an additional approver to run the release action.
To perform a release:
rc
version for the twoliter
crate, e.g. 0.0.4-rc1
.v0.0.4-rc1
.cargo make
cargo make ami
cargo make test --help
rm -rf tools/twoliter
cargo make -e=TWOLITER_REPO=https://github.com/YOUR_GIT_ALIAS/twoliter \
-e=TWOLITER_VERSION=HASH_OF_COMMIT \
-e=TWOLITER_ALLOW_SOURCE_INSTALL=true \
-e=TWOLITER_ALLOW_BINARY_INSTALL=false \
-e=TWOLITER_SKIP_VERSION_CHECK=true
-rc
in the version string.v0.0.4
.