Link Search Menu Expand Document

Verified Steps in Labs

Ensuring that users have successfully completed certain actions before the proceed can be a useful technique to ensure that are paying attention and they won’t hit problems later on in the scenario.

If you include verification scripts for the step(s) in your lab, when the user clicks Continue, a script is run against the environment. This provides some of the functionality of a challenge to your labs.

For the user to be allowed to proceed, the script should output the text “done.” For example, the following verify script checks to make sure the user has run git init before they can proceed:

#!/bin/bash

[ -d /home/scrapbook/tutorial/.git ] && echo "done"

To include the verification to a step, you add it to the step object inside the "steps" array in index.json. For example:

"details": {
    "steps": [
        {
            "title": "Verified Step Example",
            "text": "step1.md",
            "verify": "step1-verify.sh"
        }
    ]
}

To provide users with more information or context, an “answer” section can be provided inside the step object in index.json:

"details": {
    "steps": [
        {
            "title": "Show Answers",
            "text": "step2.md",
            "verify": "step2-verify.sh",
            "answer": "step2-answer.md"
        }
    ]
}

This creates the “Show Solution” option inside the lab. Here is an example from the learning platform:

An example of a verified task with the Show Solution button

An example of a verified task with the solution shown