How to build and test locally
This guide shows you how to use Bluebuild CLI to do the following things locally, without depending on the BlueBuild GitHub Action:
- preview the
Containerfilegenerated yourrecipe.ymllocally; - test your
recipe.ymlbuild process locally before pushing to GitHub; - install a locally built image onto a virtual machine;
- rebase your currently running operating system onto a locally built image;
Installing BlueBuild CLI
Section titled “Installing BlueBuild CLI”The BlueBuild CLI tool is installed by default on images built using BlueBuild. There are also several methods available for installing the BlueBuild CLI tool, documented in the BlueBuild CLI README.
Using BlueBuild CLI
Section titled “Using BlueBuild CLI”The repository README has general instructions for using the bluebuild CLI tool. Example use cases for some of the commands follow in the sections below. You can also view the help text for the commands using the --help argument on every subcommand.
Generate
Section titled “Generate”The generate command allows you to create the Containerfile used to build your recipe. It will print to stdout unless you use the --output/-o <FILE_PATH> argument:
bluebuild generate ./recipes/recipe.yml -o ContainerfileIf your recipe makes use of the from-file: syntax, it can sometimes get confusing to know the exact order of all the module calls in your recipe. You can make use of the --display-full-recipe/-d argument and it will generate your full recipe.yml file with all recipe snippets included:
bluebuild generate -d ./recipes/recipe.ymlThe build command builds an image from a recipe; you can use this command to test your recipe locally before pushing the recipe to GitHub:
bluebuild build ./recipes/recipe.ymlYou can see that the BlueBuild GitHub Action uses the same build command, with additional --push and --registry options for pushing successful build to ghcr.io or similar image repositories.
You can see the complete list of available options using bluebuild build --help.
Switch
Section titled “Switch”The switch command is a workflow command. It will build your image, export it to a .tar.gz file, and call rpm-ostree rebase/rpm-ostree upgrade with the file as the target instead of a OCI image:
bluebuild switch ./recipes/recipe.ymlTo trigger an immediate reboot for either command, you can pass in the --reboot/-r argument.