.bset env "<VariableName>=<DesiredValue>" ["<VariableName>=<DesiredValue>"]
.bset selector <SelectorName>
.bset server <ServerName>
.bset buildserver <ServerName>
The .bset command changes project settings temporarily during a job. The
command has several options:
- Use the env option to change the value of one or more project environment
variables during a job. For more information on using the command this way,
see Changing Environment Variable Values During a Job. You can use .bset to set a variable that does not
yet exist. The values set by the .bset command are written to the job record;
they do not update the database record for the environment set. Later jobs
are not affected by the changes, since they get new copies of the environment
set from the database when they launch.
- Use the selector option to change the project selector during a
job. When you change the selector, any steps that follow the step that contains
the .bset selector command use the new project selector, if they do not have
a selector setting of their own (their selector field is set to default).
- Use the server option to change the containing steps project server
during a job. This option has no effect unless the project's Sticky property
is set. Steps after the .bset server command will use the new default server
(if they do not have a selector setting of their own). This allows you to
have a project stick to one server for part of the project, then stick to
a different server for the remainder.
- Use the buildserver option to change the default job server during
a job for project steps that follow the .bset buildserver command. The buildserver
option applies to inline and project-level steps that are set to use the default
selector.
The .bset selector -p option changes the selector
for steps in the currently executing project, and any subsequent inlines that
the steps call. It is commonly used in inlined projects when the intent is
to change the selector for this project and its steps and descendants (other
inlines), but not the project that called the currently executing project.
- .bset selector will change the default selector
for the entire job.
- .bset selector -p will change the selector for
just that part of the job that contains the steps project, for the sibling
steps and child inlined projects of the sibling steps.
For example:
JOB
Step A
Inline AA
Step B
Inline BB
Step C
Step D
Inline DD
Step E
If Step B is .bset selector, it will change the
default selector for JOB. If Step B is .bset
selector -p, it will just change the default selector for Inline
A and its children (Inline BB and Step C). Step D/E will still use the original
default selector.
The .bset changes do not take effect until the current step completes.
For example, if your step includes multiple commands as in the following example,
the second line operates in an environment unmodified by the .bset command:
.bset env "CompilerVersion=1.1"
compile driverset
When the second line executes, the CompilerVersion value has not been set.
To remedy this, move the compile command to the following step.
You can use backtick syntax to set the server name to the output of a command.
For example, the command
.bset server `SelectAServer.sh`
runs
the SelectAServer.sh script and provides its output as the server name for
the .bset server command.
Note: Using multiple .bset commands in threaded steps is not recommended,
in order to avoid race conditions when attempting to set the same variable,
server, or selector. Instead, use .bset selector -p.