This section describes how the system applies environments.
Before the system executes a step, it applies all the relevant environments for the step, to create the step environment. It evaluates server, project, and step environments, in that order. This has the following ramifications:
The step gets the environment variables for the server it actually runs on.
Project variables can override server variables, and step variables can override project variables. The last value set wins. You can use variable actions to change this behavior.
For example, if the variable X is defined with the standard Assign As action, but with different values, for a server, project, and step, the step environment wins, because it is the last one applied. However, if the project uses the Assign If Not Assigned action, then its value is ignored, and if the step uses the Append Existing action, then the final result becomes the combination of the server and step values.
If the step's commands change variable values, those values persist only during the current step. The system resets the values from the database when it creates the environment for the next step, so if you want to persist changes, you need to use a dot command (.set or .bset) to change the value in the database.
Since a user can modify project variables when launching a job, the system maintains a job environment, a copy of the project environment that reflects any user changes made when starting the job. However, if the step's environment is set to the same named environment as the project (not just default), the system refers back to the master record for the environment, and gets the original variable values.
For example, if you launch a project with a project environment named Java that includes a variable JavaVersion = 1.4, and you edit the value to 1.5, any steps that use the default environment get the value 1.5, while any steps that reference the Java environment specifically get the original value of 1.4.
Note that when the system starts a job, it copies the project environment variables to a database record set aside for the job, and refers to this job environment thereafter when getting project default values. If the user modifies the starting values of any project variables when the user starts the job, those values are what is recorded in the job record.