Page History
...
- Shell Jobs can be used for a number of scripting languages such as Bash, Perl, PowerShell etc.
- Users frequently re-use code snippets across a number of jobs, for example re-usable functions that are called in a number of jobs scripts.
- This applies to Shell Jobs using Bash etc. and it applies to the use of any scripting languages.
- Code snippets can be managed by the use of Script Includes that are available as inventory items in the Configuration view of JOC Cockpit.
Display feature availability StartingFromRelease 2.2.0 Jira server SOS JIRA columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution serverId 6dc67751-9d67-34cd-985b-194a8cdc9602 key JOC-1170
...
Use Case: Global Functions
This use case include to define includes defining functions, e.g. for bash scripts, that can be used across job scripts in a number of workflows:
...
- The somewhat cryptic line in fact allows to add the addition of multi-line PowerShell code to job scripts for Windows, see JS7 - How to run PowerShell scripts from jobs.
Applying Script Includes
Use Case: Global Functions
Script Includes can be applied to any Shell Jobs. Consider the example of a workflow that includes a Shell Job like thissuch as:
The job script in the above workflow looks like this:
...
- Users can type
##!include
at the begin of a line in the job script followed by the name of the Script Include. - When hitting
Ctrl+Space
directly after typing##!include
then a popup window offers will offer the list of available Script Includes for selection. - The first line of the script editor popup window offers theto choose a Script Include that is chosen and added to the cursor position:
...
Script Includes can be added to a job script by use of the following syntax:
Code Block | ||||
---|---|---|---|---|
| ||||
(##|::|//)!include script-include-name [--replace="search literal","replacement literal" [--replace=...]] |
...
- The first two characters in a line of the job script are:
##
or::
or//
- followed by:
!include
- followed by the name of the Script Include
- optionally followed by repeated occurrences of:
--replace="...", "..."
- the
--replace
option accepts- as its first argument a literal string to be searched for in the Script Include,
- as its second argument the literal replacement for the search literal.
- This option can occur be included any number of times.
- the
- Any number of Script Includes can be embedded to in a job script.
Examples
Find a number of examples The following examples show how to apply Script Includes:
...
- If the contents of a Script Include is modified after deployment of a workflow then this change does not affect the deployed workflow.
- If a Script Include does not exist any longer at the point in time of deployment of a workflow then an error is raised.
- If the name of a Script Include is modified then this is reflected with jobs in any workflows that make use of the Script Include. For any affected workflows a draft is created that A draft which includes the modified reference to the Script Include is created for any affected workflows.
Overview
Content Tools