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.
- Install EGit. For more information on the installation process, see Egit download manual.
- Setup Azure DevOps Organization and Project. See Setting-up-your-own-Azure-DevOps-organization-and-project.
- Configure Azure DevOps Agent. See Download-and-configure-local-agent.
- Install the BMC AMI DevX Common Configuration and Code Pipeline Operations extensions. See BMC AMI DevX Azure Extensions.
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.
- In Workbench for Eclipse, open the Code Pipeline perspective.
- From the Window menu, select Open Perspective>Other.
The Open Perspective dialog box appears. Select Code Pipeline and click OK. The Code Pipeline Repository Explorer view appears.
- In the Code Pipeline Repository Explorer select the following:
- From the Stream list, select PLAY.
- From the Application list, select PLAY.
- From the Sub-Application list, select PLAY.
- From the Level list, select DEV1.
- From the Level option list, select First found in level and above.
Click Apply. A filtered list of the components within the PLAY application appears.
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:
- Go to the Git server.
- To create a personal repository, select Your repositories from profile, then select New.
- Make sure Add a README file is selected to completely initialize the repository.
Task 4: Cloning the GitPlay repository and importing as an Eclipse project
- In Workbench for Eclipse, open the Git perspective.
- Clone the GitPlay repository.
- Import the repository as standard Eclipse project once the repository is cloned successfully.
Task 5: Configuring Code Pipeline and importing the Code Pipeline source
- 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. - 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.
- In the Runtime Configuration field, enter the runtime configuration if not using the default Code Pipeline instance.
- Click Next.
The next page of the wizard appears. - From the Stream list, select PLAY.
- From the Application list, select PLAY.
- From the Sub-Application list, select PLAY.
- From the Level list, select the level used when doing a build.
- From the Download source from path list, choose the level from which to download source for the project.
- 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.
- 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. 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
- From the Eclipse Project Explorer expand the GitPlay project and create a new folder workflows. This folder will contain the Azure DevOps workflow file.
- Create an Azure DevOps workflow file, for example, ispw-sync-build.yml ( ).
- Add the file to the workflows folder in the GitPlay project.
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.
Task 7: Committing and Pushing the GitPlay project to the Master branch in the GitPlay repository
- In Workbench for Eclipse, open the Git perspective.
- If the Git Staging view is not visible, from the Window menu, select Show View>Other.
The Show View dialog box appears. - Select Git>Git Staging and click Open.
- If there is no repository selected in the Git Staging view, click
and select GitPlay to switch to the GitPlay repository.
- In the Unstaged Changes box, select all the components and click
to add them to the Staged Changes box.
- In the Commit Message box, enter a commit message, such as Commit to master.
- Click Commit and Push.
- 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. - 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.
- In the Push Results dialog, click Close.
Task 8: Creating an Azure DevOps pipeline
- Sign into your Azure DevOps organization and go to your project.
- On the left select Pipelines, and then select New Pipeline or Create Pipeline if this is the first in the project.
- Connect to the Git server where your code resides.
- Select the repository you want to use.
- Select Existing Azure Pipelines YAML file. Ensure that the path is set to the workflow file in the workflows folder.
- 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:
- In Workbench for Eclipse’s Project Explorer view, expand GitPlay>COB.
- Right-click on TPROG15.cob and select Open. The source opens in the editor.
- On line 8, append the TEST to ...PROGRAM.
- From the File menu, select Save.
- From the File menu, select Close.
Task 10: Performing the build action to verify the source generates successfully along with any impacted components
- 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. - In the YAML mapping file location field, enter or browse to the YAML mapping file.
- 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. 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.
- Click Apply and Close.
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.
- 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.
- 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:
- To Commit and Push TPROG15, in the Unstaged Changes box, select TPROG15 and click
to add it to the Staged Changes box.
- In the Commit Message box, enter a commit message, such as TPROG15 commit.
The Push Results dialog box appears. - 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.
The following is an example of what the sync step will show for a successful Git to Code Pipeline synchronization:
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:
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.
Task 13: Verifying the updates occurred to the Mainframe
- 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. Double-click TPROG15.
The source is opened in the editor.- Verify that line 8 shows TEST appended.