Build Executor Environment Variables
When you run a build job, you can use environment variables in your shell scripts and commands to access software on the VM build executor.
To use a variable, use the $VARIABLE_NAME
syntax, such as
$BUILD_ID
.
Common Environment Variables
Here are some common environment variables:
Environment Variable | Description |
---|---|
BUILD_ID | The current build’s ID. |
BUILD_NUMBER | The current build number. |
BUILD_DIR | The build output directory. |
JOB_NAME | The name of the current job. |
STARTED_BY | The user or system that initiated the build. Returned
values can be USER, SYSTEM: PIPELINE, SYSTEM: SCM, or SYSTEM:
PERIODIC-TRIGGER.
For example, if you start a pipeline, SYSTEM:
PIPELINE will be followed by the pipeline name that started the
build. If you add this line to a shell script in a Unix Shell
build step in the job whose log you are
examining:
The
log file will show this
information: To
get the following, a timestamp that shows when the build started
and a build number, you need to add two additional environment
variables in your shell
script:
|
STARTED_BY_ORIGIN | Who or what started or triggered the pipeline run. The value represents what the origin of the entire pipeline run was and what was the origin of the build happening. It can be a USER, SYSTEM: SCM, or SYSTEM: PERIODIC-TRIGGER. Whatever started the first build that started the pipeline is returned. |
STARTED_BY_UPSTREAM | A list of the running build's direct upstream jobs
that started it with build numbers. An asterisk (*) is shown to the
right of the build that triggered the current build. In the current
job's build log, the Started by line at the top shows the incoming
upstream job(s), with asterisk (*) after the trigger that started
the build of the current job.
Let's look at an
example, using this pipeline, MyPipeline.
The log for Job5, which executed after the last build of the three parallel jobs (Job2, Job3, and Job4) finished running, shows that Job3 of the three parallel jobs was built last and triggered the build for Job5, the last job in the pipeline.
The first line in bold indicates that the pipeline run was started by the pipeline (MyPipeline), a trio of jobs were built in parallel, and the build of Job3 finished after the other two, so it has the asterisk next to it, indicating that it was the trigger for starting the build of Job5. The other bold line, the Started By Upstream line, shows the same information. This information comes from a shell script that was added to a Unix Shell build step in Job5. You can see in the log where the script was run. Note: Only the direct upstream builds are listed, as they are the direct conditions to start the job whose log is being examined. For example, for the pipeline with Job1 followed by Job2 followed by Job3, the log for Job3 will list only Job2, which triggers the build of Job3. If all the pipeline jobs build consecutively, not in parallel, when you examine the Started by line in the log for the current build, you'll see just one build listed, with an asterisk next to it, indicating that it was the build that triggered the current build. |
HTTP_PROXY | The HTTP proxy for outgoing connections. |
HTTP_PROXY_HOST | The HTTP proxy host for outgoing connections. |
HTTP_PROXY_PORT | The HTTP proxy port for outgoing connections. |
HTTPS_PROXY | The HTTPS proxy for outgoing connections. |
HTTPS_PROXY_PORT | The HTTPS proxy host for outgoing connections. |
HTTPS_PROXY_PORT | The HTTPS proxy port for outgoing connections. |
NO_PROXY | A comma separated list of domain names or IP addresses for which the proxy should not be used. You can also specify port numbers. |
NO_PROXY_ALT | A pipe ( | ) separated list of domain names or IP addresses for which the proxy should not be used. You can also specify port numbers. |
PATH | The PATH variable, set in the VM build executor,
specifies the path of executables in the VM build executor.
Executables from the software packages are available
on the VM build executor's PATH
variable, which is set to See Software for Build Executor Templates in Administering Visual Builder Studio for more information. |
WORKSPACE | The absolute path of the VM build executor's workspace. |
Software Environment Variables
Environment Variable | Description |
---|---|
GRADLE_HOME | The path of the Gradle directory. |
JAVA_HOME | The path of the directory where the Java Development Kit (JDK) or the Java
Runtime Environment (JRE) is installed.
If your job is
configured to use a specific Java version, the build executor
sets the variable to the path of the specified Java version.
When the variable is set, PATH is also
updated to have
$JAVA_HOME |
NODE_PATH | The path of the Node.js modules directory. |
Tip:
-
You can run the
env
command as a Shell build step to view all environment variables of the build executor. -
Some Linux programs, such as curl, only support lower-case environment variables. Change the build steps in your job configuration to use lower-case environment variables:
export http_proxy="$HTTP_PROXY" export https_proxy="$HTTPS_PROXY" export no_proxy="$NO_PROXY" curl -v http://www.google.com
Software Environment Variables for SOA
To access SOA, use these environment variables that are defined for you when you include a SOA package in your template:
- Use JAVACLOUD_HOME variables to access the Java SDK
- Use MIDDLEWARE_HOME variables to access Oracle Fusion
Middleware.
The
MIDDLEWARE_HOME
directory includes the WebLogic Server installation directory and the Oracle Common library dependencies. - Use WLS_HOME variables to access the WebLogic server binary directory
Make sure that you have the right software available in your job's build executor template:
Software | Variables |
---|---|
SOA 12.2.1.4 | JAVACLOUD_HOME_SOA=/opt/Oracle/MiddlewareSOA_12.2.1.4.0/jdeveloper/cloud/oracle-javacloud-sdk/lib JAVACLOUD_HOME_SOA_12_2_1= MIDDLEWARE_HOME_SOA= MIDDLEWARE_HOME_SOA_12_2_1= ORACLE_HOME= ORACLE_HOME_SOA= ORACLE_HOME_SOA_12_2_1= WLS_HOME_SOA= WLS_HOME_SOA_12_2_1= |
Software Environment Variables for Oracle JDeveloper
To access Oracle JDeveloper, use these environment variables that are defined for you when you include a JDeveloper package in your template:
- Use JAVACLOUD_HOME variables to access the Java SDK
- Use MIDDLEWARE_HOME variables to access Oracle Fusion
Middleware.
The
MIDDLEWARE_HOME
directory includes the WebLogic Server installation directory and the Oracle Common library dependencies. - Use WLS_HOME variables to access the WebLogic server binary directory.
Make sure that you have the right software available in your job's build executor template:
Software | Variables |
---|---|
JDeveloper 12.2.1.4 | JAVACLOUD_HOME=/opt/Oracle/Middleware_12.2.1.4.0/jdeveloper/cloud/oracle-javacloud-sdk/lib MIDDLEWARE_HOME= ORACLE_HOME= WLS_HOME= |