Skip to main content

Connect Packages

JobFlow scripts are a powerful way to extend JobFlow functionality and make the workflow suit perfectly the requirement of the end user. As long as all the required components are copied in the correct location the end user understand command line arguments and every other detail related to the script, it works just fine. If that is not the case, however things easily break and one spends a long time with theend user trying to get the script working.

To make JobFlow Connect scripting even more powerful and much easier to use, we make use of Connect Packages.

A JobFlow Connect Package is a zip archive that contains the following resources:

  • The main script.
  • The required, 3rd party applications needed to run the script.
  • A JSON document called settings.json that contains additional metadata about the module. This document can also include variables that the end user can override via the module settings in JobFlow.

Sample connect package content:

  • connect-name.zip
    • settings.json
    • script.bat
    • app-folder
      • app.exe
      • app.dll
      • app.readme

The JobFlow Connect Package can be shared with end users who can import the package in JobFlow via Admin->Resources. JobFlow will then import the resources and add the module to the Connect module "Connect Package" dropdown menu. Resources are copied to the JobFlowImportedScripts folder on the system where JobFlow is running.

settings.json

Connect Package metadata is defined in a JSON file called settings.json.

The JSON contains, at minimum, the following metadata properties:

  1. The name of the Connect Package as it would be shown to the end user in the Connect Package dropdown menu in JobFlow.
  2. A developer ID. There is no strict rule on how one defines a developer ID. The developer ID is used to separate Connect Packages from different developers when resources are copied to the JobFlowImportedScripts folder. If your developer ID is jobflownerd, the resources and script are copied to JobFlowImportedScripts\jobflownerd.
  3. The main script that needs be executed when the module is processing a file. Path to the script is relative to the JobFlowImportedScripts\developer-id folder.
  4. An email address and website of the main developer. These are not mandatory but useful for the end user in case one has questions about a Connect Package.

An example of a simple JSON settings file:

settings.json
{
"name": "Description of JobFlow Connect package. This is what the end user sees in the dropdown menu",
"dev_id": "efi.jobflow.[developerid]",
"description": "More detailed description. If needed, inform the end user about licenses used in this module",
"script": "script.bat",
"email": "[developer email]",
"url": "[developer url]"
}

Connect Package metadata can also contain user provided data that are passed on to the main scripts as arguments. In the following example we add parameters that show a dropdown menu with the values "Option 1", "Option 2" and "Option 3" and a text field with the predefined value "This is a test". Script arguments for this Connect Package are provided as script.bat "Option 1" "This is a test" and must be handled accordingly in script.bat.

settings.json
{
"name": "Description of JobFlow Connect package. This is what the end user sees in the dropdown menu",
"dev_id": "efi.jobflow.[developerid]",
"description": "More detailed description. If needed, inform the end user about licenses used in this module",
"script": "script.bat",
"email": "[developer email]",
"url": "[developer url]",
"params": {
"Dropdown Menu": ["Option 1","Option 2","Option 3"],
"Text Input": "This is a text"
}
}

Script examples shared so far, are "basic" command line Windows batch files. To support more powerful and capable scripting languages settings.json can include an absolute or relative location of the script interpreter like Python, NodeJS or Powershell.

The following example calls the main script as follows: powershell.exe -ExecutionPolicy Bypass -file pkgToCopy.ps1

settings.json
{
"name": "Powershell Script",
"dev_id": "efi.jobflow.cookbook",
"description": "This is sample connect package using Powershell",
"script": "pkgToCopy.ps1",
"email": "[email protected]",
"url": "http://efi.com/fieryjobflow",
"params": {
"RUNTIME": "Powershell.exe",
"OPTION": "-ExecutionPolicy Bypass -file"
}
}