Using BMC AMI SQL Assurance as part of a pipeline
You can use SQL Assurance features in the following types of pipelines:
- Scripted Pipelines
- Declarative Pipelines using other jobs (projects)
For sample pipeline, see Sample-pipeline-script-for-Jenkins.
SQL Assurance environment variables
SQL Assurance 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:
|
Using SQL Assurance 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 SQL Assurance features in pipelines, see Planning.
- Before using the SQL Assurance environment variable in your pipeline script, you must import the com.bmc.db2.bmcclient.BMCClientSA.bmcSA package into the script.
For more information, see Sample-pipeline-script-for-Jenkins.
How to retrieve and reset SQL Assurance environment variable value
You can use the following methods to retrieve and reset the value of the SQL Assurance environment variable respectively:
- get(String arg)
- reset(String arg)
- getRC(String arg)
In the get and reset methods, you can pass the SQL Assurance environment variable as a string argument.
See the following examples:
How to provide permission to use the SQL Assurance environment variable
To use the SQL Assurance environment variable in your pipeline script, you must explicitly approve the following methods and variables:
- The com.bmc.db2.bmcclient.BMCClientSA get java.lang.String method
- The com.bmc.db2.bmcclient.BMCClientSA reset java.lang.String method
- The com.bmc.db2.bmcclient.BMCClientSA bmc static field
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. See the following example:
For pipeline scripts previously created using the Jenkins Pipeline Snippet Generator
If you want 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.
Related topics