JetBrains CodeCanvas 2024.1 Help

Lifecycle Scripts

CodeCanvas lets you run your custom scripts at different stages of a dev environment's lifecycle. This can be helpful in various automation scenarios like work time tracking, personalized environment setup, project configuration, or any other custom actions.

To configure lifecycle scripts, use the Lifecycle scripts section of a dev environment template. You can add your custom scripts to the following stages:

  • On initialization

    Run your script when a dev environment is initialized. This event is triggered only once when the environment is created for the first time. This stage is the earliest in the lifecycle – it happens before any actions in the environment like warm-up or environment activation (personal user parameters aren't available at this stage). Use this event to install IDE plugins or adjust project configuration, e.g., create local.properties or .env files.

    Warm-up: The initialization script runs in warm-up environments as well. If the script was run during the warm-up, it won't be executed in the user's environment.

  • On activation

    Run your script every time a dev environment is activated. This event is triggered every time a user activates the environment, for example, by creating it, taking it from the standby pool, or re-activating it after it is stopped. Personal user parameters are available at this stage. You can use this event to run update automation or to initialize services that require authentication. For example, this is a perfect stage to run docker-compose up that starts external services like databases, cache servers, etc.

    Warm-up: The activation script doesn't run in warm-up environments.

For each stage, you can add a script that will be run in the environment's container and a timeout for the script execution. Note that running scripts affects the environment's start and stop times, so use this feature with caution.

Last modified: 02 July 2024