6 Replies Latest reply on Jun 5, 2018 8:02 AM by Santhosh Kurimilla

    Git for AO Development

    Jonas Valkiunas

      Getting git to work for AO development was a relatively easy process.  The more difficult problem to solve was the methodologies and branching models to use for managing multiple developers and multiple environments.  At the end of this document you should be able to exclusively use Git for AO development.  We will post another document on how to leverage branches for advanced git users.  This will include common git commands you will need.

       

      This setup is not a proof-of-concept.  Bloomberg has multiple developers using this git for nearly a year.  We've had dozens of releases without issue.  All of our previous problems and issues of exclusively using the repo have been resolved.  In fact, once you switch to Git, you won't want to go back!

       

      There is a paradigm shift for AO Development and artifacts involved.  Currently DevStudio saves changes on a per module basis by saving a roar file (RealOps Archive) to the repo.  The roar file is an archive of underlying .process files, where each workflow/process is it's own file.  We use git's version control at a per-process file level.  We specifically exclude .roar files from git.  A roar file is only used and generated when something needs to be activated on the grid.

       

      Assumptions:

      • We use GitHub Enterprise and clone to the directory ~/Documents/GitHub
        • (GitHub doesn't matter, this will work with any git setup)
      • DevStudio workspace is on "D:\DevStudio"
      • Our git repo name is "baodev"
      • We use "Git Bash" as the default GitHub shell, subsequent commands will reflect thigs

       

      Initial Git Repo Setup
      (this only needs to be done once)

       

      1. Start DevStudio
      2. Import modules from the repo
      3. Create a Git repository on GitHub (
      4. Clone the repo to your DevStudio workstation
      5. Create a .ignore file
        1. Things we ignore:
          1. .roar - binary of a module.  We store individual processes and do not want to persist the aggregate binary object.  This will be produced when publishing to prod.
          2. .version - possibly used by the repo.  We use git for version info.
          3. .dirty - marks a module as changed.  We rely on Git.  This causes extra commits when present.
        2. Contents:
          # no roar files
          *.roar
          # no dirty files
          *.dirty
          # no version files
          *.version
        3. None of this breaks or changes compatability with DevStudio exporting to the Repo from the Library
      6. Create a .gitattributes file
        1. Help git treat file extensions correctly.  Fixes warnings about CR/LF.
        2. Contents:
          # Denote all files that are truly binary and should not be modified.
          *.process binary
      7. Commit and push!

       

      Now we're ready to integrate DevStudio data

       

      Development Studio Setup

      (this needs to be done by every developer)w (this needs to be done by every developer)

      You should have a fully working DevStudio setup before starting.  Connections must already be created for the following to work, because a connection creates a special directory under the "Workspace Directory" that we modify.

       

      1. Clone the baodev repo from git using the GitHub Enterprise tool or the following manual commands: (if not already done)
        1. cd ~/Documents/GitHub
        2. git clone https://githuburl/org/baodev.git
          update the url accordingly
      2. Link DevStudio to git by creating the following DOS script and executing it (compliments of Sean Brennan)
        1. Contents:
          @echo off
          setlocal enabledelayedexpansion
          for /d %%d in ("D:\DevStudio\Bloomberg BAO*") do (
          set dir=%%d\Prod
          echo Found "!dir!"
          rmdir "!dir!"
          mklink /J "!dir!" "C:\Users\%USERNAME%\Documents\GitHub\baodev\Dev"
          )
        2. The key part of this script is that it creates a link from your DevStudio Workspace Directory to you git cloned repository.  This can also be manually done via a command similar to:
          mklink /J "D:\DevStudio\BAO Environment-somestring\Dev" "C:\Users\youruserid\Documents\GitHub\baodev\Dev"
          - update "somestring" and "youruserid" accordingly
      3. Cleanup files that were present, but should not be tracked in git:
        1. find . -iname .dirty -exec git rm {} \;
        2. find . -iname .version -exec git rm {} \;
        3. commit and push to repo

         

        That's it!  DevStudio will still think files are in the Workspace, but you'll have access to all git commands from your checkout directory in ~/Documents/GitHub/baodev. 

         

        You now have the full power and capabilities of git to track development efforts.  The only time we use the Library is when we want to activate a module on the Grid.  Follow the same method you currently use to do this.  The roar file created and pushed to the repo will include all of your individual commits.

        This was the easy part.  It took several months refining our development model and documenting exact commands that developers should be using.  Switching to git has enabled us to additionally integrate Continuous Integration testing with Jenkins after every git push/code change.  We'll share our development process using branches, exact git commands used and Jenkins integration at a later date...probably after we receive some free BMC Engage tickets (hint, hint).

        Enjoy and let us know how this worked out for you!