BMC AMI DevX Code Pipeline-Git Integration


Summary

The purpose of this Test Drive is to highlight the integration between BMC AMI DevX Code Pipeline and Git, This integration for DevX Code Pipeline enables developers working in Topaz Workbench to clone mainframe source code stored in Git server (GitHub, BitBucket, etc.), make code changes, compile and test on the mainframe with the same tools and processes used on non-mainframe platforms.

Use Case

A developer, 

  • Creates a feature branch in BMC AMI DevX Workbench for Eclipse
  • Makes a change to COBOL program
  • Using tools in DevX Workbench for Eclipse, builds and tests the code
  • Once successfully tested, commits the branch and the code changes to Git server (via EGit plugn)
  • The commit triggers a webhook defined in Git server to run a rep-configured Jenkins multi-branch pipeline job
  • The Jenkins job synchronizes between Git and DevX Code Pipeline, builds and tests the code again and runs the CI/CD pipeline
  • In Git server, a Pull Request is created for the change against the MAIN branch
  • Pull Request is merged with the MAIN, which triggers the Jenkins job again
  • The Jenkins job synchronizes between Git and DevX Code Pipeline, builds and tests the code again and runs the CI/CD pipeline
  • After a successful merge, the feature branch is deleted
  • Finally, a promote of task in DevX Code Pipeline-Git perspective promotes the task to DevX Code Pipeline PROD level

The following diagram illustrates a possible DevOps toolchain which this script accomplishes.

DevOps Toolchain with DevX Code Pipeline-Git Integration

ISPW-Git-HighLevel.png

Instructions:

  • This guide contains many screenshots to provide a visual reference
  • Every action you must take is in "Do This..." info box
  • Please note each place that you must enter your own specific ID or number
  • You must complete each step before proceeding to the next to successfully follow the guide

Cleanup


ONLY run this section if you already completed the script once and want to try again. Otherwise, start with "Setup" section.


Do This
  • In Code Pipeline-Git perspective, navigate to "Git Repositories" view below
  • Right-click on the root of the repository
  • Click "Delete Repository..."

"Delete Repository" dialog pops up

  • Check the checkboxes (as shown)
  • Click "Delete"

2023-04-02_16-30-05.png


2023-04-02_16-31-47.png

This deletes the local git repositories as well as the local project from your local disk and you are ready to re-start the script from "Setup" or "Initialize" section.

Setup


Substitute your values in the screenshots

In this Test Drive the screen shots provided have used specific values that may differ from your assigned values. These were provided in your email notice.

While taking the Test Drive, you must substitute your assigned values!

Variable

Your Assigned Values

Application

T<nnn>

SubAppl

T<nnn>

Assignment Prefix

T<nnn>

* For the value of <nnn>, substitute the last three digits of your Test Drive username.

Do This
  • Open the "Host Explorer" perspective,
  • Click on the arrow next to Hosts,
  • Right-click on "TestDrive" and select Login,
  • Logon with the user credentials that were provided to you for Test Drive and click OK,


2023-04-02_11-53-01.pnglogin.png

Do This
  • Select "Code Pipeline-Git" from the "Window==>Open Perspective==>Other..." menu.

2023-04-02_11-55-42.png

2023-04-02_11-56-47.png

Do This

If at any time during the execution of this script the BMC AMI DevX Common Enterprise Services (CES) Login popup is shown, enter your test drive ID and password under User ID and Password, check the Save credentials box and then depress the ENTER key or click OK.

Screenshot 2023-04-08 143730.png

During this Test Drive you will encounter terms specific to DevX Code Pipeline. Here is a glossary for your convenience.

Term

Description

Application

Business Area

Stream

Development Life-Cycle used by one or more Applications

Life-Cycle

Transitional Code States (DEV, QA, PROD) in the Development Life-Cycle

Level

Instance of a Code State (DEV, QA, PROD)

Component

SCM managed object such as a COBOL source member

Component Version

An immutable version of a Component

Task

An instance of a unit of work. For example, a change to a Component

Part

A generated object such as a load module, or a Listing or a DBRM

Warehouse

Storage location for inactive historical or overlaid Component Versions (source and parts)

Assignment Container

A package of one or more, usually related, Tasks. A development container that is used to organize and manage development work

Release Container

A package of Tasks from one or more Assignment Containers. An operational container that is used to organize and manage operational releases

Set Container

A package of Tasks at an instance in time. A special DevX Code Pipeline container that is used internally to organize and manage work requests

Add Task

Make a statement of intent, often because of some impact analysis

Checkout Task

Copy source to development area

Edit Task

Make a change to the source in the development area

Generate Task

Execute Compile and Link processes

Promote Task

Move Task forward to the next Level in the Life-Cycle

Regress Task

Move Task backwards to the previous Level in the Life-Cycle

Delete Task

Remove a Task from the development area

Fallback Task

Restore previous version of Task

Deploy Task

Implement Task in one or more Run Time environments


Initialize


Clone Repository

In this step, you will be cloning a MAIN branch in Git server into your local repository in DevX Workbench.

Do This
  • Click on “Clone a Git repository" link in "Git Repositories" view
  • Enter the following information in the dialog (password is “ispwgit1”)
  • Check the “Store in Secure Store” checkbox


Note: You can copy and paste the values from here

 

URI: https://tdgit.bmc.com/TD-ISPWGIT/TestDrive.git

Host: tdgit.bmc.com

Repository path: /TD-ISPWGIT/TestDrive.git

User: tduser

Password: ispwgit1


Your screen should look like below when done.

2023-04-02_15-05-00.png


If you fail to check the "Store in Secure Store" checkbox, you will be prompted for Git server credentials in future operations. If so, simply provide the Git server credentials from above.

Do This

Click "Next"

Note (Optional): If you get the following dialog, click on “Always skip SSL verification for this server …” checkbox and click "OK".

2022-10-11_15-06-48.png


Do This
  • Click "Deselect All" to uncheck all branches
  • Check your main branch (MAIN-T<nnn>) where, <nnn> is your Test Drive userid   (Ex. MAIN-T080)
  • Leave everything else as default
  • Click “Next”

2023-04-02_15-07-03.png

Do This
  • Check “Import all existing Eclipse projects…” checkbox
  • Leave everything else as default
  • Click “Finish”

2023-04-02_15-09-13.png

If you get a prompt to create a password hint for "master" password for secure storage, click "No"

If you get "Problem Occurred" dialog for password hint, just click "OK". However, you will have to enter the Git Server credentials, if prompted, in future dialogs.

Create a Feature Branch

In this step, you will create a feature branch locally for your work within Topaz workbench


Do This
  • In “Project Explorer”, right-click on the project root node, select “Team==>Switch to==>New Branch…” to create a new branch from your MAIN-T<nnn> branch
  • Enter a name for the new branch FB-T<nnn> for your Test Drive userid <nnn> (Ex. FB-T100). Make sure the name is upper-case.
  • Leave everything else as default
  • Click “Finish”

2023-04-02_15-13-53.png


2023-04-02_15-15-55.png

You'll notice that the Project Explorer view got refreshed to the newly created feature branch.

Modify a program locally


In this step, you will be making a simple change to a COBOL program in your local feature branch.


In a real world scenario, you will be making more complex changes. But for this demonstration, a simple change of Date/Time field should suffice


Do This
  • In “Project Explorer” view, expand COB folder on the root project node and double-click on “TPROG05.cbl” to open in editor
  • Update just the date/time to reflect the current date/time
  • Save the file (CTRL-S or clicking on “x” on the editor)

2023-04-02_15-19-52.png



Generate (Compile) the program locally

In this step, you will make sure the changes made to the program do not break the code by issuing an DevX Code Pipeline Generate command locally.


Do This
  • Switch to "Git Staging" view in the perspective (you'll notice that your program has been marked ready to stage)
  • Right-click on TROG05.cbl in project explorer and select “Code Pipeline==>Generate”

2023-04-02_15-26-07.png

DevX Code Pipeline will automatically generate the program and switches to "Console" view where you can see that a new Assignment container got created and the task loaded to DEV level in DevX Code Pipeline.

2023-04-02_15-54-16.png


Commit to Git Server


In this step, you will commit the new feature branch as well as the modified program into Git server.


Do This
  • In “Git Staging” view, select the program TPROG05 in "Unstaged Changes" section and click on "+"  icon to move it to “Staged Changes” section (if there are other files, ignore them)
  • Add a commit message and then click “Commit and Push” button

2023-04-02_15-58-47.png

A push branch dialog pops up


Do This
  • Leave everything as default
  • Click "Preview"
  • Click "Push" on the "Push Confirmation" dialog

image3.png


image4.png


Push Results confirmation dialog pops up to confirm that commit was successful. Click Close.

2023-04-02_16-01-46.png


Upon commit, a webhook defined in Git server triggers a pre-defined multi-branch pipeline Jenkins job which loads the task into next level (QA1) and performs another “Generate" operation on the task at that level and executes other CI/CD stages in the pipeline.


It can take up to 2 mins for Jenkins job to finish. Please continue next step after 2 mins.


Create Pull Request and Merge


In this step, you will take on multiple roles (developer, code reviewer, approver, etc.) in order to go through the process of creating a pull request for your feature branch, approving the pull request, merging your feature branch changes with your Main branch.  Finally, after a successful merge, delete your feature branch.


Do This
  • In DevX Workbench, click on “Run==>External Tools==>Chrome” to bring up pre-configured Chrome browser

2023-04-02_16-05-44.png

This will launch Chrome browser with multiple pre-configured tabs


Do This
  • Click on the tab "Github"(last tab)
  • (Optional) If you get "Privacy error", click on "Advanced" and click on "Proceed to .." link

ISPW-Git-18.jpg


ISPW-Git-19.jpg

Do This
  • Enter username: TDUSER
  • Enter password: ispwgit1 (lower-case)
  • Click "Sign In"


ISPW-Git-20.jpg

Do This
  • Click on the Repository "TD-ISPWGIT/TestDrive"


ISPW-Git-21.jpg

Do This
  • Click on "Compare & pull request" (if available) or “Pull Requests” option at the top


ISPW-Git-22.jpg

This will bring up the "Open a Pull Request" screen 


Do This
  • Select “MAIN-T<nnn>” as the base and “FB-T<nnn>" as the compare from the drop-down, where <nnn> is your Test Drive userid
  • Click on “Create Pull Request” button


ISPW-Git-23.jpg

Do This
  • Give a name (or leave the default name) for Pull Request
  • Click on “Merge pull request”
  • Click on “Confirm Merge”


ISPW-Git-24.jpg


ISPW-Git-25.jpg

Do This
  • You should get “Pull request successfully merged and closed” message
  • At this point, you should delete the branch by clicking “Delete Branch”


ISPW-Git-26.jpg

Upon successful compare and merge, a webhook defined in Git server triggers a pre-defined multi-branch pipeline Jenkins job which loads the task into next level (STG) and performs another “Generate" operation on the task at that level and executes other CI/CD stages in the pipeline. The Jenkins job also removes the FB-T<nnn> branch as it has been deleted.


At this point, the feature changes have been merged to your MAIN branch in Git !


Please note, it may take up to 2 mins for Jenkins job to finish. So, it may take up to 2 mins to see the task in STG level.


Promote to PROD in DevX Code Pipeline


In this step, you can optionally promote the code from DevX Code Pipeline STG level to PROD level in case you want to use "fallback" feature of DevX Code Pipeline for emergency situations.


Do This
  • Switch back to DevX Workbench (you can use the "Switch Windows" button on top)
  • In "Code Pipeline-Git" perspective, click the "Containers" view
  • Click on "Refresh" button to refresh the views
  • Click on "View life cycle" button to display DevX Code Pipeline Life Cycle for the application
  • Select the link to the top most (latest) Assignment container (which contains tasks at STG level)

2023-04-02_16-14-08.png

This will bring the "Assignment" view with tasks in it

Verify that the task is now sitting at the STG level in Assignment Container view



Do This
  • Right-click on the task (at the STG level), select "Promote" to promote the task to PROD level

Notice the Git related columns in the view which store Git information in DevX Code Pipeline for easy traceability. To see the Git related columns, you may have to scroll to far right within the Assignment view.

2023-04-02_16-21-05.png

A "Promotion Successful" dialog pops up. Click "OK".



2023-04-02_16-23-05.png

Do This
  • Click on "Refresh" icon to refresh the Life Cycle view.

Notice that the task is now sitting at PROD level in DevX Code Pipeline.

2023-04-02_16-24-18.png

Congratulations! This completes the BMC AMI DevX Code Pipeline-Git integration Test Drive script.


Next Steps


If you wish to rerun this Test Drive Script, simply restart the Test Drive script from "Cleanup" section.

 

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