Job step execution

2 minute readAutomation

Terms and definitions

Various factors influence job step execution. Both a job step and its postprocessor (if any) run in the same environment, except shell. The shell used to run a command comes from what is specified in the step. If a shell is not specified on the step, the shell specified on the resource is used— this is also the same shell used for running the postprocessor.

Machine

The machine where a job step is executed is determined by the resource specified in the corresponding procedure step. If a pool is specified in the procedure step, CloudBees CD/RO picks a specific resource from that pool. A job step can determine its actual resource by querying the property /myResource/resourceName or assigned resourceName property on the job step. The host where a step is expected is /myResource/hostName. If the resource is a proxy agent, this property contains the name of the proxy target. The agent host name is in /myResource/proxyHostName.

OS-level access control

For its resource, a job step executes under the same account as the CloudBees CD/RO agent. You may want to contact CloudBees technical support for help configuring CloudBees CD/RO agents. Basically, the agent needs to know what account it will run as, and Windows agents require additional setup if impersonation is used. If using impersonation, the job step runs under the credential effectively attached to the step.

Global environment variables

Global environment variables allow you to invoke ectool commands without specifying global flags, such as --server <serverName>, at the command line. Like global flags, these environment variables provide the context for evaluating ectool commands. For example, if the command ectool getProperty /myJob/outcome is run in a job step, then a value of the outcome property for that job step is returned. Global environment variables also provide ectool with a session that includes all user privileges associated with the job. For more information, refer to: Use the CloudBees CD/RO ectool API.

Agent variables

A job step inherits environment variables from the CloudBees CD/RO agent. The agent’s environment variables can be configured as part of the agent configuration. In particular, the PATH environment variable typically includes the CloudBees CD/RO installation directory for easy access to applications such as ectool and postp (the CloudBees CD/RO postprocessor). For more information, refer to: Configure agent environment variables.

Working directory

The default job step working directory is the top-level directory in the job workspace. You can configure the working directory as a property of a procedure step. When you run a proxy agent, the step actually runs on the proxy target in the working directory specified in the step. If the working directory is not specified, the step runs in the UNIX path to the workspace.

Standard I/O

Standard job step output and errors are both redirected to the step log file.