Plugins

Plugins connect templates to jobs

Plugins are functions that translate a simple template into a powerful set of instructions. They are essentially additional bash functions that are sourced just before they are used. This means that ScOrch does not need to be restarted if the plugins have been edited or new plugins have been added.

The benefit of creating plugins as functions like this is that they can be grouped into complex solutions; the plugin SP_APP-RESTART can simply call SP_APP-STOP and SP_APP-START or the SP_BUILD-SYSTEM can call plugins to start a VM, add middleware products, install an application and run a test suite.

Plugins can be downloaded from the ScOrch community or you can write your own plugins which you can share with the community or retain as your own intellectual property.

When created, the plugin name and the file has to start with a prefix of “SP_”. This is to distinguish ScOrch plugins from other potential files that may interfere with the smooth running of the main program.

An example plugin:

1 SP_SAFEDEMO()
2 {
3   # Additional variables can be passed with the GetVar command
3   GetVar -pattern "Pause" -name "PAUSE" -default "60"
4   GetVar -pattern "Fail" -name "FAIL" -default "0"
5
6   # The task command can be used to run command line tasks
7   Task "hostname"
8   Task "sleep ${PAUSE}"
9
10  # Task commands can be wrap in standard shell conditional statements or loops
11  if [ ${FAIL} -ne 0 ] ; then
12    Task "false"
13  fi
14
15  # A manual task can be set with the Manual command
16  Manual "This is a manual step"
17
18  # This Try command will not stop the rest of the tasks if the task fails
19  Try "false will fail"
20
21  # A Sleep command can be used to both sleep and leave a log trail of how long
22  Sleep 20
23 }

The plugin above is simply a bash function. It is stored as a separate file anywhere in the directory structure below the plugins directory, including symbolic links. Using symbolic links is actually a best practice way to seperate different projects.

ScOrch functions calls shown above are:

• GetVar a way of passing specific run time parameters

• Task that will add a specific task to a job

• Try adds a task but will allow job to continue if task fails

• Sleep n run the sleep command for n number of seconds

• Manual force a break point for manual intervention