Skip to content

coolOrangeLabs/sample-workflows

Repository files navigation

Sample Workflows

Windows PowerShell Vault

powerJobs Processor powerJobs Client powerGate powerPLM

Disclaimer

THE SAMPLE CODE ON THIS REPOSITORY IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THE USAGE OF THIS SAMPLE IS AT YOUR OWN RISK AND THERE IS NO SUPPORT RELATED TO IT.

Description

This repository contains various jobs and scripts that demonstrate the power and flexibility of the AUTOMATE products powerJobs Processor and powerJobs Client as well as the CONNECT products powerGate and powerPLM. You can use the workflows to add additional value to your installations.

Installation

Each workflow can be downloaded and copied to the Vault Client or Vault JobProcessor machines. To speed up that process a workflow installer is available that guides you through the installation process. A ZIP of the workflow installer can be downloaded here. When you run the workflow installer you can select a sample workflow and see the description of this workflow. It is always a view on the current state on the GitHub page.
The workflow installer does not distinguish between server and client components and cannot not be used for deployments. It should only be used to install the workflows on a test- or demo-environment where powerJobs Processor and powerJobs Client are installed on a single machine.

If you need help with the customization or the deployment of a sample workflow and want to use it for productive puropses please contact [email protected].

Debugging

powerJobs Processor and powerJobs Client scripts can run independently from Vault in a PowerShell code editor such as 'Windows PowerShell ISE' or 'Visual Studio Code'. This is handy when a script needs to be changed to modify the business logic.

To provide a context when executed independently, the scripts need to establish a connection to Vault and retrieve a file or any other entity. This would usually be done automatically by powerJobs Processor or powerJobs Client.

powerJobs Processor Scripts

if (-not $IAmRunningInJobProcessor) {
    Import-Module powerJobs
    
    Open-VaultConnection -Server "localhost" -Vault "Vault" -User "Administrator" -Password ""
    
    $file = Get-VaultFile -Properties @{Name="Scissors.idw"}
}

This additional code needs to be placed on top of a powerJobs job script. It imports the required PowerShell modules, performs a sign-in to Vault, and uses the file 'Scissors.idw' every time the script gets executed by anything other than powerJobs Processor.

powerJobs Client (a.k.a. powerEvents) Scripts

if ($Host.Name -ne "powerEvents Webservice Extension") { 
    Import-Module powerEvents
    
    function Register-VaultEvent($EventName, $Action) {}
    function Add-VaultRestriction($EntityName, $Message) { Write-Error "$($EntityName): $($Message)" }

    Open-VaultConnection -Server "localhost" -Vault "Vault" -User "Administrator" -Password ""

    $file = Get-VaultFiles -Properties @{ Name = "Blower.idw" }
    $file | Add-Member NoteProperty "_NewLifeCycleDefinition" "Flexible Release Process"
    $file | Add-Member NoteProperty "_NewState" "Released"
    $files = @($file)

    YourFunctionThatWouldNormallyByExecutedByTheEvent $files $true
}

This additional code needs to be placed before the 'Register-VaultEvent' cmdlet and after the function that is executed by the event (in the example above this would be YourFunctionThatWouldNormallyByExecutedByTheEvent). The code imports the required PowerShell modules, introduces temporary functions, performs a sign-in to Vault, and uses the file 'Blower.idw' every time the script gets executed by anything other than powerJobs Client. In addition it temorarily adds the properties "_NewLifeCycleDefinition" and "_NewState" to the Blower.idw file for the business logic to mimic a lifecycle state transition for debugging purposes.

Author

coolOrange S.r.l.