Page History
Table of Contents |
---|
Introduction
...
JS7 - Job Resources are a means to make variables available that can be shared by a number of jobs. Variables from Job Resources are exposed to:
- Shell jobs from OS environment variables
- JVM jobs from the JS7 - Job API
Job Resources are assigned a workflow to make variables available to all included jobs or they are assigned invidual jobs. When a Job Resource is updated then JS7 takes care that all Agents assigned to jobs that make use of the Job Resource will receive the updated copy of the Job Resource.
Typical use cases include:
- to make global settings such as paths etc. available from environment variables for shell jobs.
- to store encrypted secrets to Job Resources variables that can be decrypted by jobs. For details see JS7 - How to encrypt and decrypt Variables.
- to store configuration files to Job Resource variables. The JS7 will make the configuration file available from temporary files per job instance with releated Agents. Configuration files can be encrypted before being added to Job Resources, accordingly jobs can decrypt configuration files on-the-fly. On termination of the job instance temporary files are removed by JS7 Agents.
...
The JS7 offers to perform any operation on Job Resources by the JS7 - REST Web Service API, for details see the /inventory
resource from the
Technical Documentation of the REST Web Service API.
- The REST Web Service API can be accessed from Shell utilities such as
curl
and from any programming languages. - In addition, a PowerShell module is available for simplified Simplified access to the REST Web Service API . This is described in provided from the JS7 - PowerShell Module article, for details see JS7 - How to update a Job Resource using PowerShell.
The Job Resource Update Script introduced in this article can be used used to create and to update variables in to JS7 - Job Resources.
The script can be considered an alternative for use of the respective JS7 PowerShell cmdlets, see JS7 - How to make a global Business Date variable available to jobs.
Job Resource Update Script
The Job Resource Update Script is provided for download and can be used to automate updates of job resourcesJob Resources.
- The script is available for Linux and MacOS® using bash, dash, ksh and zsh POSIX-compatible shells.
- The script terminates with exit code 0 to signal success, with exit code 1 for command line argument errors and with exit code 4 for non-recoverable errors.
- The script is intended as a baseline example for customization by JS7 users and by SOS within the scope of professional services.
...
Code Block | ||||
---|---|---|---|---|
| ||||
./js7_set_job_resource.sh \ --url=http://joc-2-0-primary:7446 \ --controller-id=controller \ --user=root \ --password=root \ --job-resource=/ProductDemo/Variables/pdBusinessDate \ --key=businessDate \ --value=$(date +'%Y-%m-%d') # updates the Job Resource argumentvariable "businessDate" from the current date UTC # establishes the connection to JOC Cockpit is established by HTTP |
Update Job Resource using HTTPS Connection
...
Code Block | ||||
---|---|---|---|---|
| ||||
./js7_set_job_resource.sh \ --url=http://joc-2-0-primary:7446 \ --controller-id=controller \ --user=root \ --password=root \ --job-resource=/ProductDemo/Variables/pdConfigurationDataSecret \ --key=configurationDataSecret \ --env-var=CONFIGURATION_DATA_SECRET \ --file=./config.ini \ --encrypt-cert./agentfoobar.crt # updates the Job Resource variable "configurationDataSecret" from the file specified # the contents of the file will be encrypted using the target Agent's certificate # an additional variable "configurationDateSecret_key" and environment variable "CONFIGURATION_DATA_SECRET_key" will be created that both hold the encrypted symmetric key and initialization vector |
Further Resources
- JS7 - Encryption and DecryptionHow to update a Job Resource using PowerShell
- JS7 - How to encrypt and decrypt Variables
...