Using BMC AMI SQL Assurance as part of a pipeline
environment variables
provides the following environment variable for pipelines. You can use this variable in your pipeline script to control the flow of pipeline steps.
Variable | Description |
---|---|
BMC_GENERATE_JCL_ONLY | This variable has one of the following values:
|
BMC_STATIC_RC | This variable provides a four-digit return code for the BMC AMI SQL Assurance for Db2 - Analyze Static SQL build step (for example, 0004) |
BMC_DYNAMIC_RC | This variable provides a four-digit return code for the BMC AMI SQL Assurance for Db2 - Analyze Dynamic SQL build step (for example, 0004) |
BMC_EXEC_RC | This variable provides a four-digit return code for the BMC AMI DevOps Common - JCL Execution build step (for example, 0004) |
Using environment variable in your pipeline script
This topic describes:
- How to retrieve and reset BMC AMI SQL Assurance environment variable value
- How to provide permission to use BMC AMI SQL Assurance environment variable
- For pipeline scripts previously created using the Jenkins Pipeline Snippet Generator
Before you begin
- For prerequisite plug-ins that you must install to use features in pipelines, see Planning.
- Before using the environment variables in your pipeline script, you must import the following static packages into the script:
- import static com.bmc.db2.bmcclient.BMCClientCN.bmcCN
- import static com.bmc.db2.bmcclient.BMCClientSA.bmcSA
- For more information, see Sample-pipeline-script-for-Jenkins.
How to retrieve and reset environment variable value
You can use the following methods to retrieve and reset the value of the environment variable respectively:
- get(String arg)
- reset(String arg)
- getRC(String arg)
In the get, getRC, and reset methods, you can pass the environment variable as a string argument. See the following examples:
How to provide permission to use the environment variable
To use the environment variable in your pipeline script, you must explicitly approve the following methods and variables:
- method com.bmc.db2.bmcclient.BMCClientCN get java.lang.String
- method com.bmc.db2.bmcclient.BMCClientCN getRC java.lang.String
- method com.bmc.db2.bmcclient.BMCClientCN reset java.lang.String
- method com.bmc.db2.bmcclient.BMCClientSA get java.lang.String
- method com.bmc.db2.bmcclient.BMCClientSA getRC java.lang.String
- method com.bmc.db2.bmcclient.BMCClientSA reset java.lang.String
- staticField com.bmc.db2.bmcclient.BMCClientCN bmcCN
- staticField com.bmc.db2.bmcclient.BMCClientSA bmcSA
When you build a pipeline, it first fails and displays a message with a link to the In-process Script Approval section in Jenkins. Click the link and approve the method or variable.
For pipeline scripts previously created using the Jenkins Pipeline Snippet Generator
To modify an existing pipeline script for the plug-in modules, we recommend that you perform the following steps:
- Reuse the Pipeline Snippet Generator dialog to make your modifications.
Regenerate the Pipeline script.