Recipes have two execution stages that you can customize:
Build-time: when recipe is getting saved, after validation.
Launch-time: when a workspace is being launched from a recipe.
Run-time: when a workspace is running (your active coding, app runtime environment)
Irrespective of the stage, command blocks will be executed in the order in which they are specified in the recipe.
What won't work
Anything that requires user-input to proceed. Build- and launch-time steps are executed by processes in a completely headless mode. As such, if your setup command requires user-input or needs to be attached to a TTY, it will unfortunately not work. You will see it get stuck in the logs, and the best you will be able to do is cancel that build.
Common cases where this is true:
Adding -y for apt-get operations: sudo apt-get install -y curl
This stage should be used when caching of the build is helpful, i.e., pre-builds. Our builder uses the YAML specification to create container images that are then run as workspaces, the build images are layered and cached to improve subsequent workspace launch times.
Each command block can be thought of as a layer in a Docker image. They are wrapped in a script and executed within a bash context. In case directory is specified:
if absolute, it will be used
if relative, it will be relative to /home/devzero
if unspecified, it will default to /home/devzero
name is used to help reference and understand what is being achieved in a command block.
Note When invoking binaries, its always best-practice to reference them by their absolute paths. For example, /usr/local/go/bin/go instead of go. This relates to the following warning block.
Warning Environment variable set by calling export are not going to be available in subsequent command blocks. To use them in subsequent blocks, either write to some file, or to /etc/environment. Please see the previous info section for more ways to better utilize this.
While recipe builds are cached, updating a lower layer (eg: the first step in your build steps) will cause the cache to get invalidated for all future steps. Therefore, if you edit step 1 in a 5-step recipe, steps 2, 3, 4 and 5 will get rebuilt. If you just edit step 5, the previous steps will be served out of the cache.