Limited supportBMC provides limited support for this version of the product. As a result, BMC no longer accepts comments in this space. If you encounter problems with the product version or the space, contact BMC Support.BMC recommends upgrading to the latest version of the product. To see documentation for that version, see BMC AMI SQL Assurance for Db2 13.1.

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:

  • TRUE indicates that you have selected the Generate JCL Only check box when configuring the BMC AMI SQL Assurance for Db2 - Analyze Static SQL and/or BMC AMI SQL Assurance for Db2 - Analyze Dynamic SQL build step(s).
  • FALSE indicates that you have not selected the Generate JCL Only check box.

Using SQL Assurance environment variable in your pipeline script

This topic describes:

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:

Example for using the get() method to retrieve a value of the BMC AMI SQL Assurance environment variable
  • boolean var1 = bmcSA.get("BMC_GENERATE_JCL_ONLY")
  • boolean var2 = bmcSA.getRC("BMC_STATIC_RC")
  • boolean var3 = bmcSA.getRC("BMC_DYNAMIC_RC")


Example for using the reset() method to reset a value of the BMC AMI SQL Assurance environment variable
  • boolean var1 = bmcSA.reset("BMC_GENERATE_JCL_ONLY")
  • boolean var2 = bmcSA.reset("BMC_STATIC_RC")
  • boolean var3 = bmcSA.reset("BMC_DYNAMIC_RC")

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:

Example

The following message is displayed:

Scripts not permitted to use method com.bmc.db2.bmcclient.BMCClientSA get java.lang.String. The Administrators can decide whether to approve or reject this signature.

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:

  1.  Reuse the Pipeline Snippet Generator dialog to make your modifications.
  2.  Regenerate the Pipeline script.

    Important

    Avoid modifying the pipeline script directly.


 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*