Many of our customers are choosing to store a copy of their IBMi source code from LMi, within a centrally accessible online repository such as Github or BitBucket, for code analysis purposes, or centralisation with distributed systems.
If you wish to do this, here is what you need to do…..
1. Start by checking your product compatibility. The LMi Git integration commands were introduced in Rocket Lifecycle Manager for IBMi Edition (LMi) Version 8.3. If you are on a version prior to this, contact us to discuss upgrading options.
2. Go to https://docs.rocketsoftware.com and download the Rocket Lifecycle Manager for IBMi Edition Daily Operations Reference Version 8.x (where x is the version of LMi). Navigate to the Appendix section within the document and open the 'Configuring the LMi Git Integration' topic. Check the Prerequisites section to ensure you have the correct licensed programs and credentials required. The GIT licensed program must be installed on the IBMi server.
3. Follow the instructions in the guide to complete the tasks listed below.
- Use the LMIGITBASE command to define the local Git working directory.
- Use the LMIGITSYNC command to populate the local git repository with LMi source files from within a single Group/Application/Release or choose to add ALL source files within LMi to the Git repository in a single operation.
- Use the LMIGITEXIT program to configure the LMi exit programs, so that the local Git repository is updated automatically during an LMi Promotion action.
- Configure the LMIGITNEP monitor job.
Once the configuration is complete, test that your local Git repository is updated by checking out an object and perform a promotion action as normal. Navigate to the path where the Git working directory was created using the WRKLNK command and locate the source file that was changed.
4. This next section references how to push the changes from the local Git working directory upto Github or BitBucket. This is not described within the Rocket documentation guide, as it uses standard Git commands. The configuration actions that should be considered are;
- Link the local Git working directory to your GitHub or BitBucket repository using the 'git remote add origin URL' command (where URL is the address of the GitHub or BitBucket repository).
- Create SSH keys if this is required by your organisation. The SSH keys can be generated on the IBMi server using the ssh-keygen command, and then added to the GitHub or BitBucket repository list of keys for authorised users. We would recommend searching the ibm.com website for further information on this command if you are not already familiar with it.
Once the configuration is complete, to send the changes to the attached GitHub or BitBucket repository, the push is performed using the standard Git commands 'git add, git commit, git push', which can be done in several ways;
- Using an SSH terminal session such as PuTTY and navigating to the Git working directory using the 'cd' command.
- Using STRQSH on the IBMi server and navigating to the Git working directory.
- Writing a CL program that navigates to the appropriate path and executes the above Git commands.
So, as you can see, it is a simple job to get all source files within LMi into a centralised repository such as GitHub or BitBucket and have them updated when future changes occur. If you have any other questions on the LMi Git Integration, just ask!
------------------------------
Andy Finley
Rocket Software
------------------------------

