Skip

Skip instructions can speed up the execution of a configuration manifest, by running a shell command to determine whether the step is required.

Skip works by executing a shell command and evaluating whether it returned a zero status (in other words is truthy).

The value of the skip attribute must be a string and so is limited to a single command. If you require multiple commands you might want to consider writing a script taht returns a zero status when you wish to skip the step, or a non zero status when you wish to execute the step.

For example you might wish to skip a command in the event that a file or folder exists. You would do this by adding a step like this:

{
  "name": "say hello",
  "exe": {
    "install": {
      "skip": "[ -f greeted.txt ]",
      "cmd": [
        "echo \"hello\""
      ]
    }
  },
  "tags": "example step"
}

In the above example, the echo “hello” command would only execute if the greeted.txt file does not exist.

Skip can also accept true or false as a method of forcing a skip or a command to run in the event the skip command is not correct in the manifest:

{
  "name": "always say hello",
  "exe": {
    "install": {
      "skip": "false",
      "cmd": [
        "echo \"hello\""
      ]
    }
  },
  "tags": "example step"
}

Using skips is highly recommended where possible because it can help keep the execution time of subsequent manifest applications faster by avoiding unnecessary work.