Using BMC AMI DevOps as part of a pipeline

You can use BMC AMI DevOps features in the following types of pipelines:

  • Scripted Pipelines
  • Declarative Pipelines using other jobs (projects)

For sample pipeline, see Sample pipeline scripts for Jenkins.

Important

When configuring a pipeline that uses multiple projects, ensure that the value you define for the JOB_ID parameter is the same in the pipeline and all of the projects.


For more information, view the Quick Course BMC AMI DevOps for Db2 - Building a Pipeline - Part 2.

BMC AMI DevOps environment variables

BMC AMI DevOps provides the following environment variables for pipelines. You can use these variables in your pipeline script to control the flow of pipeline steps.

VariableDescription
BMC_SCHEMA_IDENTICAL

This variable provides the status of the comparison that the BMC AMI DevOps Schema Mgmt for Db2 - Schema Change Migration build step performs. This variable has one of the following values:

  • TRUE indicates that the compared entities are identical, so no CDL is generated.
  • FALSE indicates that there are differences in the compared entities.
BMC_SCHEMA_RC

This variable provides a four digit return code for the BMC AMI DevOps Schema Mgmt for Db2 - Schema Change Migration build step. For Example, 0004, 0008 etc.

BMC_SCHEMA_STANDARDS_RC

This variable provides a four digit return code for the BMC AMI DevOps Schema Mgmt for Db2 - Schema Standards build step. For Example, 0004, 0008 etc.

BMC_EXEC_RC

This variable provides a four digit return code for the BMC AMI DevOps Common - JCL Execution build step. For Example, 0004, 0008 etc.

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 DevOps Schema Mgmt for Db2 - Schema Change Migration build step.
  • FALSE indicates that you have not selected the Generate JCL Only check box.
BMC_SKIP_COMPARE

This variable has one of the following values:

  • TRUE indicates that you have selected the Skip Comparison check box when configuring the BMC AMI DevOps Schema Mgmt for Db2 - Schema Change Migration build step.
  • FALSE indicates that you have not selected the Skip Comparison check box.

Using BMC AMI DevOps environment variables in your pipeline script

This topic describes how:

Before you begin

  • For prerequisite plug-ins that you must install to use BMC AMI DevOps features in pipelines, see Planning.
  • Before using BMC AMI DevOpsenvironment 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.BMCClientSM.bmcSM;
    For more information, see Sample pipeline scripts for Jenkins.

To retrieve and reset BMC AMI DevOps environment variable values

You can use the following methods to retrieve and reset the values of the BMC AMI DevOps environment variables respectively:

  • get(String arg)
  • getRC(String arg)
  • reset(String arg)

In the get, getRC, and reset methods, you can pass BMC AMI DevOps environment variables as string arguments.

See the following examples:

Examples for using the get() method to retrieve values of BMC AMI DevOps environment variables

  • boolean var1 = bmcSM.get("BMC_SCHEMA_IDENTICAL")
  • boolean var2 = bmcSM.get("BMC_SKIP_COMPARE")
  • boolean var3 = bmcSM.get("BMC_GENERATE_JCL_ONLY")


Examples for using the getRC() method to retrieve values of BMC AMI DevOps environment variables

  • var1 = bmcSM.getRC("BMC_SCHEMA_RC") 
  • var2 = bmcSM.getRC("BMC_SCHEMA_STANDARDS_RC")
  • var3 = bmcCN.getRC("BMC_EXEC_RC")


Examples for using the reset() method to reset values of BMC AMI DevOps environment variables

  • boolean var1 = bmcSM.reset("BMC_SCHEMA_IDENTICAL")
  • boolean var2 = bmcSM.reset("BMC_SKIP_COMPARE")
  • boolean var3 = bmcSM.reset("BMC_GENERATE_JCL_ONLY")
  • var4 = bmcSM.reset("BMC_SCHEMA_RC")
  • var5 = bmcSM.reset("BMC_SCHEMA_STANDARDS_RC")
  • var6 = bmcCN.reset("BMC_EXEC_RC")

To provide permission to use BMC AMI DevOps environment variables and methods

To use BMC AMI DevOps environment variables in your pipeline script, you must explicitly approve the following methods and variables:

  • 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.BMCClientSM get java.lang.String
  • method com.bmc.db2.bmcclient.BMCClientSM getRC java.lang.String
  • method com.bmc.db2.bmcclient.BMCClientSM reset java.lang.String
  • staticField com.bmc.db2.bmcclient.BMCClientCN bmcCN
  • staticField com.bmc.db2.bmcclient.BMCClientSM bmcSM

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 might be displayed:

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

Was this page helpful? Yes No Submitting... Thank you

Comments