Life cycle scripts are used to interact with the environment of a student, and to run commands on certain events while a student plays your track. Scripts are responsible for:
Setting up the scenario your students will follow, by configuring applications and starting services.
Checking the student's work, and providing feedback to student on their progress.
Enabling automated tests for your content by solving challenges.
You typically write scripts in Bash, but you can write them in any language supported on your environment.
You can also use life cycle scripts to publish events to external systems. For example, you can publish an event when a user starts a track. Use the script parameters to correlate these events with data in your own systems.
There are four types of challenge life cycle scripts:
And one track life cycle scripts:
The Instruqt platform injects a set of parameters, through environment variables, into every script. The following environment variables are available:
Environment Variable | Description |
| The ID of the track |
| The ID of the challenge that the script is running on. This can be empty, in case of a track cleanup script. |
| The ID of the participant. This value is guaranteed to be unique for every play of a track, i.e. when a user starts the same track twice, the IDs will differ. |
| The ID of the track invite. Will only be present if the user got access to the track via an invite. |
| The ID of the user. This value uniquely identifies a user. This value can be empty, in case a script is run as part of a pooled instance. |
| The full name of the user (as they have entered it when creating their account). * |
| The email address of the user * |
* This value will only be present if the user has given consent to share their details. For example, when a student started a track through a track invite.