run
Kurtosis can be used to run a Starlark script or a runnable package in an enclave.
A single Starlark script can be ran with:
kurtosis run script.star
Adding the --dry-run flag will print the changes without executing them.
A Kurtosis package on your local machine can be run with:
kurtosis run /path/to/package/on/your/machine
A Kurtosis package published to GitHub can be run like so:
kurtosis run github.com/package-author/package-repo
If you want to run a non-main branch, tag or commit use the following syntax
kurtosis run github.com/package-author/package-repo@tag-branch-commit
Arguments
Package behaviour can be customized by passing in JSON/YAML-serialized arguments when calling kurtosis run.
For example, if your package's run function looks like this...
def run(plan, some_parameter, some_other_parameter="Default value"):
...then you can pass in values for some_parameter and some_other_parameter like so:
kurtosis run github.com/USERNAME/REPO '{"some_parameter": 5, "some_other_parameter": "New value"}'
Kurtosis deserializes the JSON, with each key treated as a separate parameter passed to the run function in Starlark.
This is the equivalent to the following Starlark:
run(plan, some_parameter = 5, some_other_parameter = "New value")
By default, Kurtosis deserializes JSON objects (anything in {}) as dictionaries in Starlark. However, sometimes you need to pass a struct as a parameter instead.
To have Kurtosis deserialize a JSON object as a struct instead of a dictionary, simply add "_kurtosis_parser": "struct" to the object.
For example, this command...
kurtosis run github.com/USERNAME/REPO '{"some_parameter": {"_kurtosis_parser": "struct", "some_property": "Property value"}}'
...is equivalent to this Starlark:
run(plan, some_parameter = struct(some_property = "Property value"))
Extra Configuration
kurtosis run has additional flags that can further modify its behaviour:
The
--args-fileflag can be used to send in a JSON/YAML file, from a local file through the filepath or from remote using the URL, as an argument to the Kurtosis Package. Note that if you pass in package arguments as CLI arguments and via the flag, the CLI arguments will be the one used. For example:kurtosis run github.com/kurtosis-tech/ethereum-package --args-file "devnet-5.json"or
kurtosis run github.com/kurtosis-tech/ethereum-package --args-file "https://www.myhost.com/devnet-5.json"The
--dry-runflag can be used to print the changes proposed by the script without executing themThe
--parallelismflag can be used to specify to what degree of parallelism certain commands can be run. For example: if the script contains anadd_servicesinstruction and is run with--parallelism 100, up to 100 services will be run at one time.The
--enclaveflag can be used to instruct Kurtosis to run the script inside the specified enclave or create a new enclave (with the given enclave identifier) if one does not exist. If this flag is not used, Kurtosis will create a new enclave with an auto-generated name, and run the script or package inside it.The
--verbosityflag can be used to set the verbosity of the command output. The options includeBRIEF,DETAILED, orEXECUTABLE. If unset, this flag defaults toBRIEFfor a concise and explicit output. UseDETAILEDto display the exhaustive list of arguments for each command. Meanwhile,EXECUTABLEwill generate executable Starlark instructions.The
--main-function-nameflag can be used to set the name of Starlark function inside the package thatkurtosis runwill call. The default value isrun, meaning Starlark will look for a function calledrunin the file defined by the--main-fileflag (which defaults tomain.star). Regardless of the function, Kurtosis expects the main function to have a parameter calledplaninto which Kurtosis will inject the Kurtosis plan.For example:
To run the
start_nodefunction in amain.starfile, simple use:kurtosis run main.star --main-function-name start_nodeWhere
start_nodeis a function defined inmain.starlike so:# --------------- main.star --------------------
def start_node(plan, args):
# your codeThe
--main-fileflag sets the main file in which Kurtosis looks for the main function defined via the--main-function-nameflag. This can be thought of as the entrypoint file. This flag takes a filepath relative to the package's root, and defaults tomain.star. For example, if your package isgithub.com/my-org/my-packagebut your main file is located in subdirectories likegithub.com/my-org/my-package/src/internal/my-file.star, you should set this flag like--main-file src/internal/my-file.star.Example of using the
--main-function-nameflagFor example, to run the
start_nodefunction in amain.starfile, simple use:kurtosis run main.star --main-function-name start_nodeWhere
start_nodeis a function defined inmain.starlike so:# main.star code
def start_node(plan,args):
# your codeThe
--productionflag can be used to make sure services restart in case of failure (default behavior is not restart)The
--no-connectflag can be used to disable user services port forwarding (default behavior is to forward the ports)The
--image-downloadflag can be used to determine what is the behavior to fetch images tagged as latest during the package deployment. Usemissingto fetch the latest image only if not available in local cache and usealwaysto always fetch the latest image from remote repository (default behavior ismissing).The
--experimentalflag can be used to enable experimental or incubating features. Please reach out to Kurtosis team if you wish to try any of those.