Sample workflow scripts for GitHub Actions
The sample pipelines are located in AMI DevOps Sample Folder in the GitHub Actions directory, which is the directory to which the BMC-AMI-DevOps-Version-13.1.00-for-Db2-UC.zip file is downloaded and extracted. For example:
C:\Users\userName\Downloads\BMC-AMI-DevOps-Version-13.1.00-for-Db2-UC\BMC AMI DevOps Version 13.1.00 for Db2 - UC\GitHub Actions\AMI DevOps Sample Folder
Sample workflow script for File Transmission
The following figure represents a sample workflow script for File Transmission:
###
### Workflow_File_Transmission_Sample.yml (for GitHub Actions)
###
# The sample workflow performs Authentication + File Transmission steps using application defined command step.
# The sample workflow script is defined to use various items like below:
# a) References to variables added through GitHub Actions secrets and variables.
# b) Use of Linux based sed command to replace input as variable name by variable definition from GitHub Actions secrets and variables.
# c) Use of configuration file (Config_File_Transmission.yml), that is maintained in default root folder.
# Example of properties of authentication step is taken from Config_File_Transmission.yml file:
# step authentication Config_File_Transmission.yml
# Note: If workflow executes with default configuration file name config.yml, that is maintained in root folder, then file name is not required in step command.
# Example of properties of authentication step is taken from default file name config.yml maintained in root folder:
# step authentication
###
name: Workflow_File_Transmission_Sample #name of the workflow
on:
workflow_dispatch #manual trigger of the workflow
jobs:
File_Transmission: #name of the job
runs-on: <name of the runner> #specify runner name
container:
image:attach:xwiki:Mainframe.Data-for-Db2.BMC-AMI-DevOps-for-Db2.AMA13100.Command-and-syntax-reference.Universal-Connector-samples-in-BMC-AMI-DevOps.Sample-workflow-scripts-for-GitHub-Actions.WebHome@filename <Image location>/devopsuc:13.01.00.0003-GA
options: -u <uid> #specify uid of the user running the runner
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Check out repository
uses: actions/checkout@v4
# For certBased Authentication, uncomment the following task to unzip the specified client certificate
# from repository into path specified with -d parameter (ex. /opt/secret)
# - name: unzip client certificate
# run: |
# unzip -P "${{secrets.zip_cert_pass}}" <clientCertificateName>.p12 -d /opt/secret
# Perform various initialization functions using Linux based command sed
- name: Initialization
run: |
echo "Replace variables defined in Config_File_Transmission.yml file"
# Linux command sed is used to replace the config file variables with GitHub Actions secrets and variables
sed -i "s/USER_ID_AUTH/${{vars.user_id}}/" Config_File_Transmission.yml
sed -i "s/USER_PASS_AUTH/${{secrets.user_pass}}/" Config_File_Transmission.yml
# For certBased Authentication, uncomment the following 2 sed commands
# sed -i "s|CERT_PATH_AUTH|/opt/secret/<clientCertificateName>.p12|" Config_File_Transmission.yml
# sed -i "s/CERT_PASS_AUTH/${{secrets.cert_pass}}/" Config_File_Transmission.yml
# Use syntax \<var name\> to find and replace the exact matching word
sed -i "s/\<JOB_ID\>/${{vars.job_id}}/" Config_File_Transmission.yml
sed -i "s/DDL_FILE_FT_UPLOAD/${{vars.ddl_file}}/" Config_File_Transmission.yml
# Use GitHub Actions environment variables to fetch workflow name, run number, run by and run mode of the executing workflow
sed -i "s/PIPELINENAME_VALUE/${{github.workflow}}/" Config_File_Transmission.yml
sed -i "s/RUNNUMBER_VALUE/${{github.run_id}}/" Config_File_Transmission.yml
sed -i "s/RUNBY_VALUE/${{github.actor}}/" Config_File_Transmission.yml
sed -i "s/RUNMODE_VALUE/${{github.event_name}}/" Config_File_Transmission.yml
echo "----- Config_File_Transmission.yml file is updated -----"
# Execute application step - authentication
- name: Authentication
run:
step authentication Config_File_Transmission.yml
# Execute application step - fileUpload (local_to_mainframe)
- name: File Transmission
run:
step local_to_mainframe Config_File_Transmission.yml{{/secrets.zip_cert_pass}}
### Workflow_File_Transmission_Sample.yml (for GitHub Actions)
###
# The sample workflow performs Authentication + File Transmission steps using application defined command step.
# The sample workflow script is defined to use various items like below:
# a) References to variables added through GitHub Actions secrets and variables.
# b) Use of Linux based sed command to replace input as variable name by variable definition from GitHub Actions secrets and variables.
# c) Use of configuration file (Config_File_Transmission.yml), that is maintained in default root folder.
# Example of properties of authentication step is taken from Config_File_Transmission.yml file:
# step authentication Config_File_Transmission.yml
# Note: If workflow executes with default configuration file name config.yml, that is maintained in root folder, then file name is not required in step command.
# Example of properties of authentication step is taken from default file name config.yml maintained in root folder:
# step authentication
###
name: Workflow_File_Transmission_Sample #name of the workflow
on:
workflow_dispatch #manual trigger of the workflow
jobs:
File_Transmission: #name of the job
runs-on: <name of the runner> #specify runner name
container:
image:attach:xwiki:Mainframe.Data-for-Db2.BMC-AMI-DevOps-for-Db2.AMA13100.Command-and-syntax-reference.Universal-Connector-samples-in-BMC-AMI-DevOps.Sample-workflow-scripts-for-GitHub-Actions.WebHome@filename <Image location>/devopsuc:13.01.00.0003-GA
options: -u <uid> #specify uid of the user running the runner
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Check out repository
uses: actions/checkout@v4
# For certBased Authentication, uncomment the following task to unzip the specified client certificate
# from repository into path specified with -d parameter (ex. /opt/secret)
# - name: unzip client certificate
# run: |
# unzip -P "${{secrets.zip_cert_pass}}" <clientCertificateName>.p12 -d /opt/secret
# Perform various initialization functions using Linux based command sed
- name: Initialization
run: |
echo "Replace variables defined in Config_File_Transmission.yml file"
# Linux command sed is used to replace the config file variables with GitHub Actions secrets and variables
sed -i "s/USER_ID_AUTH/${{vars.user_id}}/" Config_File_Transmission.yml
sed -i "s/USER_PASS_AUTH/${{secrets.user_pass}}/" Config_File_Transmission.yml
# For certBased Authentication, uncomment the following 2 sed commands
# sed -i "s|CERT_PATH_AUTH|/opt/secret/<clientCertificateName>.p12|" Config_File_Transmission.yml
# sed -i "s/CERT_PASS_AUTH/${{secrets.cert_pass}}/" Config_File_Transmission.yml
# Use syntax \<var name\> to find and replace the exact matching word
sed -i "s/\<JOB_ID\>/${{vars.job_id}}/" Config_File_Transmission.yml
sed -i "s/DDL_FILE_FT_UPLOAD/${{vars.ddl_file}}/" Config_File_Transmission.yml
# Use GitHub Actions environment variables to fetch workflow name, run number, run by and run mode of the executing workflow
sed -i "s/PIPELINENAME_VALUE/${{github.workflow}}/" Config_File_Transmission.yml
sed -i "s/RUNNUMBER_VALUE/${{github.run_id}}/" Config_File_Transmission.yml
sed -i "s/RUNBY_VALUE/${{github.actor}}/" Config_File_Transmission.yml
sed -i "s/RUNMODE_VALUE/${{github.event_name}}/" Config_File_Transmission.yml
echo "----- Config_File_Transmission.yml file is updated -----"
# Execute application step - authentication
- name: Authentication
run:
step authentication Config_File_Transmission.yml
# Execute application step - fileUpload (local_to_mainframe)
- name: File Transmission
run:
step local_to_mainframe Config_File_Transmission.yml{{/secrets.zip_cert_pass}}
Sample workflow script for Schema Migration
The following figure represents a sample workflow script for Schema Migration:
###
### Workflow_Schema Migration_Sample.yml (for GitHub Actions)
###
# The sample workflow performs Authentication + File Transmission + Local Cat to DDL + Output Transmission + JCL Exec steps.
# The sample workflow script is defined to use various items like below:
# a) References to variables added through GitHub Actions secrets and variables.
# b) Use of Linux based sed command to replace input as variable name by variable definition from GitHub Actions secrets and variables.
# c) Use of configuration file (Config_Schema_Migration_CompareDDL.yml), that resides in directory (non-root folder).
# Example of properties of authentication step is taken from config file "Config_Schema_Migration_CompareDDL.yml", that is
# maintained inside folders "GitHub/SAMPLE/MAA/configFiles":
# step authentication GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
# d) GitHub Actions based "if:" condition command is used.
###
name: Workflow_Schema_Migration_Sample #name of the workflow
on:
workflow_dispatch #manual trigger of the workflow
jobs:
Schema_Change: #name of the job
runs-on: <name of the runner> #specify runner name
container:
image:attach:xwiki:Mainframe.Data-for-Db2.BMC-AMI-DevOps-for-Db2.AMA13100.Command-and-syntax-reference.Universal-Connector-samples-in-BMC-AMI-DevOps.Sample-workflow-scripts-for-GitHub-Actions.WebHome@filename <Image location>/devopsuc:13.01.00.0003-GA
options: -u <uid> #specify uid of the user running the runner
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Check out repository
uses: actions/checkout@v4
# For certBased Authentication, uncomment the following task to unzip the specified client certificate
# from repository into path specified with -d parameter (ex. /opt/secret)
# - name: unzip client certificate
# run: |
# unzip -P "${{secrets.zip_cert_pass}}" <clientCertificateName>.p12 -d /opt/secret
# Perform various initialization functions using Linux based command sed
- name: Initialization
run: |
echo "Replace variables defined in GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml file"
# Linux command sed is used to replace the config file variables with GitHub Actions secrets and variables
sed -i "s/USER_ID_AUTH/${{vars.user_id}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
sed -i "s/USER_PASS_AUTH/${{secrets.user_pass}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
# For certBased Authentication, uncomment the following 2 sed commands
# sed -i "s|CERT_PATH_AUTH|/opt/secret/<clientCertificateName>.p12|" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
# sed -i "s/CERT_PASS_AUTH/${{secrets.cert_pass}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
# Use syntax \<var name\> to find and replace the exact matching word
sed -i "s/\<JOB_ID\>/${{vars.job_id}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
sed -i "s/DDL_FILE_FT_UPLOAD/${{vars.ddl_file}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
# Use GitHub Actions environment variables to fetch workflow name, run number, run by and run mode of the executing workflow
sed -i "s/PIPELINENAME_VALUE/${{github.workflow}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
sed -i "s/RUNNUMBER_VALUE/${{github.run_id}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
sed -i "s/RUNBY_VALUE/${{github.actor}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
sed -i "s/RUNMODE_VALUE/${{github.event_name}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
echo "----- GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml file is updated -----"
# Execute application step - authentication
- name: Authentication
run:
step authentication GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
# Execute application step - fileUpload (local_to_mainframe)
- name: Transfer DDL to mainframe
run:
step local_to_mainframe GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
# Execute application step - localCatToDDL (localCat_to_DDL)
- name: Schema Migration-Local Cat to DDL
run:
step localCat_to_DDL GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
# Fetch the return code from output file output_local_cat_ddl.properties
# and set in output variable as environment variable to use in subsequent steps
- name: Return Code-Local Cat to DDL
if: ${{ success() || failure() }}
run: |
. $GITHUB_WORKSPACE/output_local_cat_ddl.properties #read and fetch the return code from output file
echo "RetCod=$compareRC" >> "$GITHUB_ENV" #set the return code as environment variable
# Execute application step - outputTransmission (download_output)
- name: Download Files - CDL/WL/EXECJCL/IR
if: ${{ success() && env.RetCod <= '0004' }}
run:
step download_output GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
###
# Execute application step - jclExecutionUsingPDSMember (jclExecutionPDS)
# Using GitHub Actions based if condition - Run step only if condition is satisfied.
###
- name: Run JCL to Implement Schema Change
if: ${{ success() && env.RetCod <= '0004' }}
run:
step jclExecutionPDS GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml{{/secrets.zip_cert_pass}}
### Workflow_Schema Migration_Sample.yml (for GitHub Actions)
###
# The sample workflow performs Authentication + File Transmission + Local Cat to DDL + Output Transmission + JCL Exec steps.
# The sample workflow script is defined to use various items like below:
# a) References to variables added through GitHub Actions secrets and variables.
# b) Use of Linux based sed command to replace input as variable name by variable definition from GitHub Actions secrets and variables.
# c) Use of configuration file (Config_Schema_Migration_CompareDDL.yml), that resides in directory (non-root folder).
# Example of properties of authentication step is taken from config file "Config_Schema_Migration_CompareDDL.yml", that is
# maintained inside folders "GitHub/SAMPLE/MAA/configFiles":
# step authentication GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
# d) GitHub Actions based "if:" condition command is used.
###
name: Workflow_Schema_Migration_Sample #name of the workflow
on:
workflow_dispatch #manual trigger of the workflow
jobs:
Schema_Change: #name of the job
runs-on: <name of the runner> #specify runner name
container:
image:attach:xwiki:Mainframe.Data-for-Db2.BMC-AMI-DevOps-for-Db2.AMA13100.Command-and-syntax-reference.Universal-Connector-samples-in-BMC-AMI-DevOps.Sample-workflow-scripts-for-GitHub-Actions.WebHome@filename <Image location>/devopsuc:13.01.00.0003-GA
options: -u <uid> #specify uid of the user running the runner
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Check out repository
uses: actions/checkout@v4
# For certBased Authentication, uncomment the following task to unzip the specified client certificate
# from repository into path specified with -d parameter (ex. /opt/secret)
# - name: unzip client certificate
# run: |
# unzip -P "${{secrets.zip_cert_pass}}" <clientCertificateName>.p12 -d /opt/secret
# Perform various initialization functions using Linux based command sed
- name: Initialization
run: |
echo "Replace variables defined in GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml file"
# Linux command sed is used to replace the config file variables with GitHub Actions secrets and variables
sed -i "s/USER_ID_AUTH/${{vars.user_id}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
sed -i "s/USER_PASS_AUTH/${{secrets.user_pass}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
# For certBased Authentication, uncomment the following 2 sed commands
# sed -i "s|CERT_PATH_AUTH|/opt/secret/<clientCertificateName>.p12|" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
# sed -i "s/CERT_PASS_AUTH/${{secrets.cert_pass}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
# Use syntax \<var name\> to find and replace the exact matching word
sed -i "s/\<JOB_ID\>/${{vars.job_id}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
sed -i "s/DDL_FILE_FT_UPLOAD/${{vars.ddl_file}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
# Use GitHub Actions environment variables to fetch workflow name, run number, run by and run mode of the executing workflow
sed -i "s/PIPELINENAME_VALUE/${{github.workflow}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
sed -i "s/RUNNUMBER_VALUE/${{github.run_id}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
sed -i "s/RUNBY_VALUE/${{github.actor}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
sed -i "s/RUNMODE_VALUE/${{github.event_name}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
echo "----- GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml file is updated -----"
# Execute application step - authentication
- name: Authentication
run:
step authentication GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
# Execute application step - fileUpload (local_to_mainframe)
- name: Transfer DDL to mainframe
run:
step local_to_mainframe GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
# Execute application step - localCatToDDL (localCat_to_DDL)
- name: Schema Migration-Local Cat to DDL
run:
step localCat_to_DDL GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
# Fetch the return code from output file output_local_cat_ddl.properties
# and set in output variable as environment variable to use in subsequent steps
- name: Return Code-Local Cat to DDL
if: ${{ success() || failure() }}
run: |
. $GITHUB_WORKSPACE/output_local_cat_ddl.properties #read and fetch the return code from output file
echo "RetCod=$compareRC" >> "$GITHUB_ENV" #set the return code as environment variable
# Execute application step - outputTransmission (download_output)
- name: Download Files - CDL/WL/EXECJCL/IR
if: ${{ success() && env.RetCod <= '0004' }}
run:
step download_output GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml
###
# Execute application step - jclExecutionUsingPDSMember (jclExecutionPDS)
# Using GitHub Actions based if condition - Run step only if condition is satisfied.
###
- name: Run JCL to Implement Schema Change
if: ${{ success() && env.RetCod <= '0004' }}
run:
step jclExecutionPDS GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_CompareDDL.yml{{/secrets.zip_cert_pass}}
Sample workflow script of Schema Migration and Schema Standards
The following figure represents a sample workflow script of Schema Migration and Schema Standards:
###
### Workflow_Schema_Migration_Schema_Standards_Sample.yml (for GitHub Actions)
###
# The sample workflow performs Authentication + Local Cat to DDL + Schema Standards (schema type-CDL) steps using application defined command step.
# The sample workflow script is defined to use various items like below:
# a) References to variables added through GitHub Actions secrets and variables.
# b) Use of Linux based sed command to replace input as variable name by variable definition from GitHub Actions secrets and variables.
# c) Use of configuration file (Config_Schema_Migration_Schema_Standards.yml), that resides in directory (non-root folder).
# Example of properties of authentication step is taken from config file "Config_Schema_Migration_Schema_Standards.yml", that is
# maintained inside folders "GitHub/SAMPLE/MAA/configFiles":
# step authentication GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml
# d) GitHub Actions based "if:" condition command is used.
###
name: Workflow_Schema_Migration_Schema_Standards_Sample #name of the workflow
on:
workflow_dispatch #manual trigger of the workflow
jobs:
Schema_Migration_Schema_Standards_CDL: #name of the job
runs-on: <name of the runner> #specify runner name
container:
image:attach:xwiki:Mainframe.Data-for-Db2.BMC-AMI-DevOps-for-Db2.AMA13100.Command-and-syntax-reference.Universal-Connector-samples-in-BMC-AMI-DevOps.Sample-workflow-scripts-for-GitHub-Actions.WebHome@filename <Image location>/devopsuc:13.01.00.0003-GA
options: -u <uid> #specify uid of the user running the runner
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Check out repository
uses: actions/checkout@v4
# For certBased Authentication, uncomment the following task to unzip the specified client certificate
# from repository into path specified with -d parameter (ex. /opt/secret)
# - name: unzip client certificate
# run: |
# unzip -P "${{secrets.zip_cert_pass}}" <clientCertificateName>.p12 -d /opt/secret
# Perform various initialization functions using Linux based command sed
- name: Initialization
run: |
echo "Replace variables defined in GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml file"
# Linux command sed is used to replace the config file variables with GitHub Actions secrets and variables
sed -i "s/USER_ID_AUTH/${{vars.user_id}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml
sed -i "s/USER_PASS_AUTH/${{secrets.user_pass}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml
# For certBased Authentication, uncomment the following 2 sed commands
# sed -i "s|CERT_PATH_AUTH|/opt/secret/<clientCertificateName>.p12|" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml
# sed -i "s/CERT_PASS_AUTH/${{secrets.cert_pass}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml
# Use syntax \<var name\> to find and replace the exact matching word
sed -i "s/\<JOB_ID\>/${{vars.job_id}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml
# Use GitHub Actions environment variables to fetch workflow name, run number, run by and run mode of the executing workflow
sed -i "s/PIPELINENAME_VALUE/${{github.workflow}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml
sed -i "s/RUNNUMBER_VALUE/${{github.run_id}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml
sed -i "s/RUNBY_VALUE/${{github.actor}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml
sed -i "s/RUNMODE_VALUE/${{github.event_name}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml
echo "----- GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml file is updated -----"
# Execute application step - authentication
- name: Authentication
run:
step authentication GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml
# Execute application step - localCatToDDL (localCat_to_DDL)
- name: Schema Migration - Local Cat to DDL
run:
step localCat_to_DDL GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml
# Fetch the return code from output file output_local_cat_ddl.properties
# and set in output variable as environment variable to use in subsequent steps
- name: Return Code - Local Cat to DDL
if: ${{ success() || failure() }}
run: |
. $GITHUB_WORKSPACE/output_local_cat_ddl.properties #read and fetch the return code from output file
echo "RetCod=$compareRC" >> "$GITHUB_ENV" #set the return code as environment variable
###
# Execute application step - schemaStandards (schema_standards_cdl)
# Using GitHub Actions based if condition - Run step only if $compareRC condition is satisfied.
###
- name: Schema Standards – Analyze CDL
if: ${{ success() && env.RetCod <= '0004' }}
run:
step schema_standards_cdl GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml{{/secrets.zip_cert_pass}}
### Workflow_Schema_Migration_Schema_Standards_Sample.yml (for GitHub Actions)
###
# The sample workflow performs Authentication + Local Cat to DDL + Schema Standards (schema type-CDL) steps using application defined command step.
# The sample workflow script is defined to use various items like below:
# a) References to variables added through GitHub Actions secrets and variables.
# b) Use of Linux based sed command to replace input as variable name by variable definition from GitHub Actions secrets and variables.
# c) Use of configuration file (Config_Schema_Migration_Schema_Standards.yml), that resides in directory (non-root folder).
# Example of properties of authentication step is taken from config file "Config_Schema_Migration_Schema_Standards.yml", that is
# maintained inside folders "GitHub/SAMPLE/MAA/configFiles":
# step authentication GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml
# d) GitHub Actions based "if:" condition command is used.
###
name: Workflow_Schema_Migration_Schema_Standards_Sample #name of the workflow
on:
workflow_dispatch #manual trigger of the workflow
jobs:
Schema_Migration_Schema_Standards_CDL: #name of the job
runs-on: <name of the runner> #specify runner name
container:
image:attach:xwiki:Mainframe.Data-for-Db2.BMC-AMI-DevOps-for-Db2.AMA13100.Command-and-syntax-reference.Universal-Connector-samples-in-BMC-AMI-DevOps.Sample-workflow-scripts-for-GitHub-Actions.WebHome@filename <Image location>/devopsuc:13.01.00.0003-GA
options: -u <uid> #specify uid of the user running the runner
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Check out repository
uses: actions/checkout@v4
# For certBased Authentication, uncomment the following task to unzip the specified client certificate
# from repository into path specified with -d parameter (ex. /opt/secret)
# - name: unzip client certificate
# run: |
# unzip -P "${{secrets.zip_cert_pass}}" <clientCertificateName>.p12 -d /opt/secret
# Perform various initialization functions using Linux based command sed
- name: Initialization
run: |
echo "Replace variables defined in GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml file"
# Linux command sed is used to replace the config file variables with GitHub Actions secrets and variables
sed -i "s/USER_ID_AUTH/${{vars.user_id}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml
sed -i "s/USER_PASS_AUTH/${{secrets.user_pass}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml
# For certBased Authentication, uncomment the following 2 sed commands
# sed -i "s|CERT_PATH_AUTH|/opt/secret/<clientCertificateName>.p12|" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml
# sed -i "s/CERT_PASS_AUTH/${{secrets.cert_pass}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml
# Use syntax \<var name\> to find and replace the exact matching word
sed -i "s/\<JOB_ID\>/${{vars.job_id}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml
# Use GitHub Actions environment variables to fetch workflow name, run number, run by and run mode of the executing workflow
sed -i "s/PIPELINENAME_VALUE/${{github.workflow}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml
sed -i "s/RUNNUMBER_VALUE/${{github.run_id}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml
sed -i "s/RUNBY_VALUE/${{github.actor}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml
sed -i "s/RUNMODE_VALUE/${{github.event_name}}/" GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml
echo "----- GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml file is updated -----"
# Execute application step - authentication
- name: Authentication
run:
step authentication GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml
# Execute application step - localCatToDDL (localCat_to_DDL)
- name: Schema Migration - Local Cat to DDL
run:
step localCat_to_DDL GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml
# Fetch the return code from output file output_local_cat_ddl.properties
# and set in output variable as environment variable to use in subsequent steps
- name: Return Code - Local Cat to DDL
if: ${{ success() || failure() }}
run: |
. $GITHUB_WORKSPACE/output_local_cat_ddl.properties #read and fetch the return code from output file
echo "RetCod=$compareRC" >> "$GITHUB_ENV" #set the return code as environment variable
###
# Execute application step - schemaStandards (schema_standards_cdl)
# Using GitHub Actions based if condition - Run step only if $compareRC condition is satisfied.
###
- name: Schema Standards – Analyze CDL
if: ${{ success() && env.RetCod <= '0004' }}
run:
step schema_standards_cdl GitHub/SAMPLE/MAA/configFiles/Config_Schema_Migration_Schema_Standards.yml{{/secrets.zip_cert_pass}}
Sample workflow script of Schema Standards for DDL type
The following figure represents a sample workflow script of Schema Standards for DDL type:
###
### Workflow_Schema_Standards_Schema_Type_DDL_Sample.yml (for GitHub Actions)
###
# The sample workflow performs Authentication + Schema Standards (schema type-DDL) steps using application defined command step.
# The sample workflow script is defined to use various items like below:
# a) References to variables added through GitHub Actions secrets and variables.
# b) Use of Linux based sed command to replace input as variable name by variable definition from GitHub Actions secrets and variables.
# c) Use of configuration file (Config_Schema_Standards_Schema_Type_DDL.yml), that is maintained in default root folder.
# Example of properties of authentication step is taken from Config_Schema_Standards_Schema_Type_DDL.yml file:
# step authentication Config_Schema_Standards_Schema_Type_DDL.yml
# Note: If workflow executes with default configuration file name config.yml, that is maintained in root folder, then file name is not required in step command.
# Example of properties of authentication step is taken from default file name config.yml maintained in root folder:
# step authentication
###
name: Workflow_Schema_Standards_DDL_Sample #name of the workflow
on:
workflow_dispatch #manual trigger of the workflow
jobs:
Schema_Standards_DDL: #name of the job
runs-on: <name of the runner> #specify runner name
container:
image:attach:xwiki:Mainframe.Data-for-Db2.BMC-AMI-DevOps-for-Db2.AMA13100.Command-and-syntax-reference.Universal-Connector-samples-in-BMC-AMI-DevOps.Sample-workflow-scripts-for-GitHub-Actions.WebHome@filename <Image location>/devopsuc:13.01.00.0003-GA
options: -u <uid> #specify uid of the user running the runner
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Check out repository
uses: actions/checkout@v4
# For certBased Authentication, uncomment the following task to unzip the specified client certificate
# from repository into path specified with -d parameter (ex. /opt/secret)
# - name: unzip client certificate
# run: |
# unzip -P "${{secrets.zip_cert_pass}}" <clientCertificateName>.p12 -d /opt/secret
# Perform various initialization functions using Linux based command sed
- name: Initialization
run: |
echo "Replace variables defined in Config_Schema_Standards_Schema_Type_DDL.yml file"
# Linux command sed is used to replace the config file variables with GitHub Actions secrets and variables
sed -i "s/USER_ID_AUTH/${{vars.user_id}}/" Config_Schema_Standards_Schema_Type_DDL.yml
sed -i "s/USER_PASS_AUTH/${{secrets.user_pass}}/" Config_Schema_Standards_Schema_Type_DDL.yml
# For certBased Authentication, uncomment the following 2 sed commands
# sed -i "s|CERT_PATH_AUTH|/opt/secret/<clientCertificateName>.p12|" Config_Schema_Standards_Schema_Type_DDL.yml
# sed -i "s/CERT_PASS_AUTH/${{secrets.cert_pass}}/" Config_Schema_Standards_Schema_Type_DDL.yml
# Use GitHub Actions environment variables to fetch workflow name, run number, run by and run mode of the executing workflow
sed -i "s/PIPELINENAME_VALUE/${{github.workflow}}/" Config_Schema_Standards_Schema_Type_DDL.yml
sed -i "s/RUNNUMBER_VALUE/${{github.run_id}}/" Config_Schema_Standards_Schema_Type_DDL.yml
sed -i "s/RUNBY_VALUE/${{github.actor}}/" Config_Schema_Standards_Schema_Type_DDL.yml
sed -i "s/RUNMODE_VALUE/${{github.event_name}}/" Config_Schema_Standards_Schema_Type_DDL.yml
echo "----- Config_Schema_Standards_Schema_Type_DDL.yml file is updated -----"
# Execute application step - authentication
- name: Authentication
run:
step authentication Config_Schema_Standards_Schema_Type_DDL.yml
# Execute application step - schemaStandards (schema_standards_ddl)
- name: Schema Standards – Analyze DDL
run:
step schema_standards_ddl Config_Schema_Standards_Schema_Type_DDL.yml{{/secrets.zip_cert_pass}}
### Workflow_Schema_Standards_Schema_Type_DDL_Sample.yml (for GitHub Actions)
###
# The sample workflow performs Authentication + Schema Standards (schema type-DDL) steps using application defined command step.
# The sample workflow script is defined to use various items like below:
# a) References to variables added through GitHub Actions secrets and variables.
# b) Use of Linux based sed command to replace input as variable name by variable definition from GitHub Actions secrets and variables.
# c) Use of configuration file (Config_Schema_Standards_Schema_Type_DDL.yml), that is maintained in default root folder.
# Example of properties of authentication step is taken from Config_Schema_Standards_Schema_Type_DDL.yml file:
# step authentication Config_Schema_Standards_Schema_Type_DDL.yml
# Note: If workflow executes with default configuration file name config.yml, that is maintained in root folder, then file name is not required in step command.
# Example of properties of authentication step is taken from default file name config.yml maintained in root folder:
# step authentication
###
name: Workflow_Schema_Standards_DDL_Sample #name of the workflow
on:
workflow_dispatch #manual trigger of the workflow
jobs:
Schema_Standards_DDL: #name of the job
runs-on: <name of the runner> #specify runner name
container:
image:attach:xwiki:Mainframe.Data-for-Db2.BMC-AMI-DevOps-for-Db2.AMA13100.Command-and-syntax-reference.Universal-Connector-samples-in-BMC-AMI-DevOps.Sample-workflow-scripts-for-GitHub-Actions.WebHome@filename <Image location>/devopsuc:13.01.00.0003-GA
options: -u <uid> #specify uid of the user running the runner
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Check out repository
uses: actions/checkout@v4
# For certBased Authentication, uncomment the following task to unzip the specified client certificate
# from repository into path specified with -d parameter (ex. /opt/secret)
# - name: unzip client certificate
# run: |
# unzip -P "${{secrets.zip_cert_pass}}" <clientCertificateName>.p12 -d /opt/secret
# Perform various initialization functions using Linux based command sed
- name: Initialization
run: |
echo "Replace variables defined in Config_Schema_Standards_Schema_Type_DDL.yml file"
# Linux command sed is used to replace the config file variables with GitHub Actions secrets and variables
sed -i "s/USER_ID_AUTH/${{vars.user_id}}/" Config_Schema_Standards_Schema_Type_DDL.yml
sed -i "s/USER_PASS_AUTH/${{secrets.user_pass}}/" Config_Schema_Standards_Schema_Type_DDL.yml
# For certBased Authentication, uncomment the following 2 sed commands
# sed -i "s|CERT_PATH_AUTH|/opt/secret/<clientCertificateName>.p12|" Config_Schema_Standards_Schema_Type_DDL.yml
# sed -i "s/CERT_PASS_AUTH/${{secrets.cert_pass}}/" Config_Schema_Standards_Schema_Type_DDL.yml
# Use GitHub Actions environment variables to fetch workflow name, run number, run by and run mode of the executing workflow
sed -i "s/PIPELINENAME_VALUE/${{github.workflow}}/" Config_Schema_Standards_Schema_Type_DDL.yml
sed -i "s/RUNNUMBER_VALUE/${{github.run_id}}/" Config_Schema_Standards_Schema_Type_DDL.yml
sed -i "s/RUNBY_VALUE/${{github.actor}}/" Config_Schema_Standards_Schema_Type_DDL.yml
sed -i "s/RUNMODE_VALUE/${{github.event_name}}/" Config_Schema_Standards_Schema_Type_DDL.yml
echo "----- Config_Schema_Standards_Schema_Type_DDL.yml file is updated -----"
# Execute application step - authentication
- name: Authentication
run:
step authentication Config_Schema_Standards_Schema_Type_DDL.yml
# Execute application step - schemaStandards (schema_standards_ddl)
- name: Schema Standards – Analyze DDL
run:
step schema_standards_ddl Config_Schema_Standards_Schema_Type_DDL.yml{{/secrets.zip_cert_pass}}
Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*