composer-cli

Authors:Brian C. Lane <bcl@redhat.com>

composer-cli is used to interact with the lorax-composer API server, managing blueprints, exploring available packages, and building new images.

It requires lorax-composer to be installed on the local system, and the user running it needs to be a member of the weldr group. They do not need to be root, but all of the security precautions apply.

composer-cli cmdline arguments

Lorax Composer commandline tool

usage: composer-cli [-h] [-j] [-s SOCKET] [--log LOG] [-a APIVER]
                    [--test TESTMODE] [-V]
                    ...

Positional Arguments

args

Named Arguments

-j, --json

Output the raw JSON response instead of the normal output.

Default: False

-s, --socket

Path to the socket file to listen on

Default: “/run/weldr/api.socket”

--log

Path to logfile (./composer-cli.log)

Default: “./composer-cli.log”

-a, --api

API Version to use

Default: “0”

--test

Pass test mode to compose. 1=Mock compose with fail. 2=Mock compose with finished.

Default: 0

-V

show program’s version number and exit

Default: False

compose start <blueprint> <type> Start a compose using the selected blueprint and output type.
types List the supported output types. status List the status of all running and finished composes. log <uuid> [<size>kB] Show the last 1kB of the compose log. cancel <uuid> Cancel a running compose and delete any intermediate results. delete <uuid,…> Delete the listed compose results. info <uuid> Show detailed information on the compose. metadata <uuid> Download the metadata use to create the compose to <uuid>-metadata.tar logs <uuid> Download the compose logs to <uuid>-logs.tar results <uuid> Download all of the compose results; metadata, logs, and image to <uuid>.tar image <uuid> Download the output image from the compose. Filename depends on the type.
blueprints list List the names of the available blueprints.

show <blueprint,…> Display the blueprint in TOML format. changes <blueprint,…> Display the changes for each blueprint. diff <blueprint-name> Display the differences between 2 versions of a blueprint.

<from-commit> Commit hash or NEWEST <to-commit> Commit hash, NEWEST, or WORKSPACE

save <blueprint,…> Save the blueprint to a file, <blueprint-name>.toml delete <blueprint> Delete a blueprint from the server depsolve <blueprint,…> Display the packages needed to install the blueprint. push <blueprint> Push a blueprint TOML file to the server. freeze <blueprint,…> Display the frozen blueprint’s modules and packages. freeze show <blueprint,…> Display the frozen blueprint in TOML format. freeze save <blueprint,…> Save the frozen blueprint to a file, <blueprint-name>.frozen.toml. tag <blueprint> Tag the most recent blueprint commit as a release. undo <blueprint> <commit> Undo changes to a blueprint by reverting to the selected commit. workspace <blueprint> Push the blueprint TOML to the temporary workspace storage.

modules list List the available modules. projects list List the available projects. projects info <project,…> Show details about the listed projects.

Edit a Blueprint

Start out by listing the available blueprints using composer-cli blueprints list, pick one and save it to the local directory by running composer-cli blueprints save http-server. If there are no blueprints available you can copy one of the examples from the test suite.

Edit the file (it will be saved with a .toml extension) and chance the description, add a package or module to it. Send it back to the server by running composer-cli blueprints push http-server.toml. You can verify that it was saved by viewing the changelog - composer-cli blueprints changes http-server.

Build an image

Build a qcow2 disk image from this blueprint by running composer-cli compose start http-server qcow2. It will print a UUID that you can use to keep track of the build. You can also cancel the build if needed.

The available types of images is displayed by composer-cli compose types. Currently this consists of: ext4-filesystem, live-iso, partitioned-disk, qcow2, tar

Monitor the build status

Monitor it using composer-cli compose status, which will show the status of all the builds on the system. You can view the end of the anaconda build logs once it is in the RUNNING state using composer-cli compose log UUID where UUID is the UUID returned by the start command.

Once the build is in the FINISHED state you can download the image.

Download the image

Downloading the final image is done with composer-cli compose image UUID and it will save the qcow2 image as UUID-disk.qcow2 which you can then use to boot a VM like this:

qemu-kvm --name test-image -m 1024 -hda ./UUID-disk.qcow2