Integrating Git to Code Pipeline for Azure DevOps


This topic describes in detail, all the tasks that you need to perform to synchronize Git and Code Pipeline when you are using the Azure DevOps orchestrator.

Task 1: Setting up the environment

This step provides you with instructions to install the required plugins and other configuration.

Task 2: Verifying if the Code Pipeline mainframe PLAY application is available

The Code Pipeline PLAY application is installed as a part of the Training Application delivered in the Code Pipeline SAMPLIB in the Installation Verification Process (IVP).

Perform the following steps to install the PLAY application instance based on your host connection. If you are unable to locate the PLAY application, refer Installation Verification Procedures in the Code Pipeline Installation and Configuration guide.

  1. In Workbench for Eclipse, open the Code Pipeline perspective.
  2. From the Window menu, select Open Perspective>Other.
    The Open Perspective dialog box appears.
  3. Select Code Pipeline and click OK. The Code Pipeline Repository Explorer view appears.

    Important

    The Code Pipeline Repository Explorer view is visible by default. If it is not visible do the following:

    1. From the Window menu, select Show View>Other. The Show View dialog box appears.
    2. Open Code Pipeline, select the Code Pipeline Repository Explorer view, and click OK.
  4. In the Code Pipeline Repository Explorer select the following:
    1. From the Stream list, select PLAY.
    2. From the Application list, select PLAY.
    3. From the Sub-Application list, select PLAY.
    4. From the Level list, select DEV1.
    5. From the Level option list, select First found in level and above.
  5. Click Apply. A filtered list of the components within the PLAY application appears.

    Tip

    If you are not logged onto a host connection where the Code Pipeline PLAY application is installed, you will be prompted when you select any list in the Code Pipeline Repository Explorer view.

Task 3: Setting up a Git repository with the Code Pipeline source and YAML configuration file

To create a new Git repository named GitPlay, perform the following steps:

  1. Go to the Git server.
  2. To create a personal repository, select Your repositories from profile, then select New.
    image-2024-2-29_13-50-32-1.png
  3. Make sure Add a README file is selected to completely initialize the repository.
    image-2024-2-29_13-50-2-1.png


Tip

The repository can also be created under an organization. Refer to Git online help.

Task 4: Cloning the GitPlay repository and importing as an Eclipse project

  1. In Workbench for Eclipse, open the Git perspective.
  2. Clone the GitPlay repository.
    image-2024-2-29_13-54-3-1.png
  3. Import the repository as standard Eclipse project once the repository is cloned successfully.
    image-2024-2-29_13-53-33-1.png

Task 5: Configuring Code Pipeline and importing the Code Pipeline source

  1. In Workbench for Eclipse’s Project Explorer view, right-click the GitPlay project node and select Configure>Configure to Use Code Pipeline.
    The Configure Code Pipeline and GIT Mapping wizard appears.
  2. From the Host list, select the host where the PLAY application is located, or click Configure to configure a host. We recommend using the fully qualified domain name when configuring the host.
  3. In the Runtime Configuration field, enter the runtime configuration if not using the default Code Pipeline instance.
  4. Click Next.
    The next page of the wizard appears.
  5. From the Stream list, select PLAY.
  6. From the Application list, select PLAY.
  7. From the Sub-Application list, select PLAY.
  8. From the Level list, select the level used when doing a build.
  9. From the Download source from path list, choose the level from which to download source for the project.
  10. In the YAML mapping file location field, enter or browse the project folder in which to create the YAML mapping file. By default, the location is the root of project.
  11. Click Finish.
    The source is downloaded. The ispwconfig.yml file is created and added to the root of the GitPlay project in the Project Explorer view. The Console view shows the activity and the Project Explorer view shows the downloaded files.
    image-2024-2-29_13-56-39-1.png
  12. To examine the contents of the ispwconfig.yml file, right-click the file and select Open.

    13.!!com.compuware.ispw.cli.model.IspwRoot
    14.   ispwApplication:
    15.   application: PLAY
    16.   host: somehost.example.com
    17.   pathMappings:
    18.   - path: \CLST
    19.   types:
    20.   - fileExtension: clst
    21.   ispwType: CLST
    22.      - path: \COB
    23.   types:
    24.   - fileExtension: cob
    25.   ispwType: COB
    26.      - path: \COPY
    27.   types:
    28.   - fileExtension: copy
    29.   ispwType: COPY
    30.      - path: \JOB
    31.   types:
    32.   - fileExtension: job
    33.   ispwType: JOB
    34.      port: 12345
    35.      runtimeConfig: TPZP
          stream: PLAY

For information on the available Code Pipeline property settings and path mappings in the ispwconfig.yml file, see Git-to-Code-Pipeline-integration-the-Code-Pipeline-YAML-configuration-file.

Task 6: Creating an Azure DevOps workflow file

  1. From the Eclipse Project Explorer expand the GitPlay project and create a new folder workflows. This folder will contain the Azure DevOps workflow file.
  2. Create an Azure DevOps workflow file, for example, ispw-sync-build.yml (ispw-sync-build.yml).
  3. Add the file to the workflows folder in the GitPlay project. 
    image-2024-2-29_14-3-13-1.png

    The workflow is divided into the following stages:
    • Checkout – Checks out the source code.
    • Synchronize changeset to Code Pipeline – Uses operation ISPWSYNC to perform Git to Code Pipeline synchronization.
    • Build Code Pipeline Task – Uses action BuildTask to perform a build.

YAML-Checkout-Sync.png

YAML-Build.png

Important

For additional information including parameters for the BMC AMI DevX Common Configuration and Code Pipeline Operations Azure extensions, see BMC AMI DevX Azure Extensions.

Task 7: Committing and Pushing the GitPlay project to the Master branch in the GitPlay repository

  1. In Workbench for Eclipse, open the Git perspective.
  2. If the Git Staging view is not visible, from the Window menu, select Show View>Other.
    The Show View dialog box appears.
  3. Select Git>Git Staging and click Open.
  4. If there is no repository selected in the Git Staging view, click image-2024-2-29_14-7-10-1.pngand select GitPlay to switch to the GitPlay repository.
  5. In the Unstaged Changes box, select all the components and click image-2024-2-29_14-10-11-1.pngto add them to the Staged Changes box.
    image-2024-2-29_14-10-41-1.png
  6. In the Commit Message box, enter a commit message, such as Commit to master.
  7. Click Commit and Push.
  8. If the Push Branch master dialog box appears, in the URL field, specify the URL of the GitPlay repository.
    The repository URL can be found in the Git server Repository Settings of the GitPlay repository under the Name field.
  9. Complete the rest of the fields if not populated automatically. Click Next to select the remote repository. The repository name should contain the branch name. Click Next again to confirm the expected push result, then click Finish.
    image-2024-2-29_14-13-55-1.png
  10. In the Push Results dialog, click Close.
    image-2024-2-29_14-13-9-1.png

Task 8: Creating an Azure DevOps pipeline


Note

This task assumes that you have already created an Azure DevOps organization and project. If you have not created, perform the setup detailed in Task 1

  1. Sign into your Azure DevOps organization and go to your project.
  2. On the left select Pipelines, and then select New Pipeline or Create Pipeline if this is the first in the project.
  3. Connect to the Git server where your code resides.
  4. Select the repository you want to use.
  5. Select Existing Azure Pipelines YAML file. Ensure that the path is set to the workflow file in the workflows folder.
    image-2024-2-29_14-19-15-1.png
  6. After reviewing the workflow file select Save from the dropdown list next to Run.

Task 9: Making a change and building

To make a change to Cobol component TPROG15.cob, perform the following steps: 

  1. In Workbench for Eclipse’s Project Explorer view, expand GitPlay>COB.
  2. Right-click on TPROG15.cob and select Open. The source opens in the editor.
  3. On line 8, append the TEST to ...PROGRAM.
    image-2024-2-29_14-21-18-1.png
  4. From the File menu, select Save.
  5. From the File menu, select Close.

Task 10: Performing the build action to verify the source generates successfully along with any impacted components

  1. In Workbench for Eclipse’s Project Explorer view, Right click GitPlay project, select Properties>add Code Pipeline Nature>click Apply>Close.
    The Code Pipeline page of the Properties dialog box appears.
    image-2024-2-29_14-23-26-1.png
  2. In the YAML mapping file location field, enter or browse to the YAML mapping file.
  3. In the Level field, enter DEV1 as the life cycle level for the project that will be used to load the file into Code Pipeline at that level.
    The level value is required to perform any Code Pipeline action.
  4. Alternatively, in the Assignment description field, enter the assignment name to be used for the generate/build process. Click Insert Variable, if you need to choose variables to build the assignment name. 

    Note

    If no valid value exists for the chosen variable, the Description field in the Containers view will treat the variable as empty, Descriptions longer than 50 characters will be truncated. The default assignment description is ${user} ${branch_name}.

  5. Click Apply and Close.
  6. In the Project Explorer view’s COB folder, right-click TPROG15.cob and select Code Pipeline>Build. The Console view shows the progress of the build.

    Note

    If a Code Pipeline pop-up appears, click YES to continue.

  7. In the Console view, note the assignment where TPROG15 was loaded. In the example above, TPROG15 was loaded into assignment PLAY004840 at the DEV1 level.
  8. Delete the task from container PLAY004840 and close the container.

Task 11: Submitting the change to the Git server

To commit and push the changes to the Git server and trigger the Azure Devops Workflow, perform the following:

  1. To Commit and Push TPROG15, in the Unstaged Changes box, select TPROG15 and click image-2024-2-29_14-32-52-1.pngto add it to the Staged Changes box.

    image-2024-2-29_14-33-18-1.png 
  2. In the Commit Message box, enter a commit message, such as TPROG15 commit.
    The Push Results dialog box appears.
  3. Click Close.

Task 12: Determining if synchronization process completed successfully

Once TPROG15 is pushed to the Git server, the Azure DevOps workflow is immediately triggered. Visit your project within Azure and navigate to Pipelines to see the result of the run.

image-2024-3-12_13-41-55-1.png

The following is an example of what the sync step will show for a successful Git to Code Pipeline synchronization:

Finished synchronizing changes from Git to ISPW assignment PLAY005107 at level DEV1

COB/TPROG15.cob                                     -----  Success                               

1 total changes detected during synchronization: Success 1, Failure 0, Skipped 0

The following is an example of what the build step will show for a successful build:

Build parameters are being retrieved from the build_automatically input.
Starting the build process for task 7E5655E16646

ISPW: Set S000248884 - The generate request completed successfully for TPROG15 in PLAY005107. Job ID and name: J0156513 ISPWTPZG
ISPW: Set S000248884 - The build process completed successfully

The build request completed successfully.

Tip

You can view the Git commit information in Workbench within the Code Pipeline Assignment view and the Code Pipeline Release view.

Task 13: Verifying the updates occurred to the Mainframe

  1. In Workbench for Eclipse’s Code Pipeline Containers view, find the assignment where TPROG15 was loaded and double-click the assignment.
    The Code PipelineTasks view appears.
  2. Double-click TPROG15.
    The source is opened in the editor.

    Important

    If a copybook download message appears, click No to not download copybooks.

  3. Verify that line 8 shows TEST appended.
    image-2024-2-29_14-36-50-1.png
     



 

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