Git Repo Integration

Integrating with Git Repos such as GitHub or GitLab

Git

DeployHub supports GitHub or GitLab in the following ways.

  1. The collection of Git information for security purposes.
  2. A binary Repository for retrieving artifacts to deploy such as binaries or scripts.
  3. GitHub Issue Tracking. A bridge connects a GitHub issue with a DeployHub Change Request.

The Collection of GitHub Metrics and Metadata

DeployHub stores the Git Metrics and Metadata for informational, mapping and computational purposes. This is done for any Git Repository, such as GitHub, GitLab etc.

DeployHub integrates with Git using the CI/CD Command Line Interface (CLI). For every Component Version, the CLI gathers and stores the following:

Field in Git Details Section Description
Git Commit Git commit that triggered the CI job (DERIVED IF NOT SPECIFIED)
Git Repo Git repo that triggered the CI job (DERIVED IF NOT SPECIFIED)
Git Tag Git tag in the git repo (DERIVED IF NOT SPECIFIED)
Git Url Full url to the git repo (DERIVED IF NOT SPECIFIED)
Purl Purl for the Component Version (DERIVED IF NOT SPECIFIED)
Key in Key Value Configuration Description
Git Branch Git branch in the git repo (DERIVED IF NOT SPECIFIED)
Git Branch Create Commit Git commit that the branch was created from (DERIVED IF NOT SPECIFIED)
Git Branch Create Timestamp Timestamp of when the branch was created (DERIVED IF NOT SPECIFIED)
Git Branch Parent The parent branch for the current branch (DERIVED IF NOT SPECIFIED)
Git Commit Authors List of committers for the repo (DERIVED IF NOT SPECIFIED)
Git Committers Cnt Count of Git Commit Authors (DERIVED IF NOT SPECIFIED)
Git Commit Timestamp Timestamp of the current commit (DERIVED IF NOT SPECIFIED)
Git Contrib Percentage Git Committers Cnt / Git Total Committers Cnt * 100 (DERIVED IF NOT SPECIFIED)
Git Lines Added Lines added since the previous commit (DERIVED IF NOT SPECIFIED)
Git Lines Deleted Lines deleted since the previous commit (DERIVED IF NOT SPECIFIED)
Git Lines Total Total line count for the branch (DERIVED IF NOT SPECIFIED)
Git Org Organization for the repo (DERIVED IF NOT SPECIFIED)
Git Repo Project Project name part of the repository url (DERIVED IF NOT SPECIFIED)
Git Total Committers Cnt Total committers working on this repo

These values are displayed for every Component Version and viewable from the Component Detail dashboard.

Git as a Binary Repository

You can configure DeployHub to call out to a Git Repo to pull deployable artifacts (binaries, scripts, etc.) as part of your deployment. The process will check out your deployable artifacts based on commit, branch or tag specified. You will need to configure DeployHub with a file system DeployHub Repository that will pull the files need for the deployment. You will also need to create a “Git Checkout” Procedure and Action.

Step 1 - Create a DeployHub File System Repository

DeployHub can use Git as a binary repository for retrieving deployable objects as part of the deployment process. To do this you will first need to define GitHub as a connected Repository Object from within DeployHub. This connection will be used by as part of the deployment process using a Procedure and a Action. For information on setting up File System as a binary repository see Connect Your Repositories.

Once you have completed this step, you are ready to create a new Procedure that performs the check out from the GitHub repository.

Step 2 - Create your Git Checkout Procedure for your Action

Procedures are called by Actions to execute deployment logic. A pre-defined DeployHub _Procedure__is available from the DeployHub Git Repo. This where you will find the most current version of this Procedure. For more information on creating_Procedures see Functions and Procedures.

From the DeployHub Git Repo, pull the file named GitCheckout.re

Once downloaded, you will need to Import it into DeployHub from the Func/Procs List View. Navigate to the List View by selecting the Func/Procs menu option on the left hand side of the DeployHub main panel. From the Func/Procs List view select the Import option. The Import will bring you to your operating system “file open” dialog box for selecting the GitCheckout.re file. Next, select your Domain and upload the Procedure into the DeployHub. You are now ready to create your Action.

Step 3 - Create your Action for the Git Checkout Procedure

Once you have imported your GitCheckout.re Procedure, you can define your Action. Navigate to the Actions list view from the Actions menu option on the left hand side of the DeployHub main panel. Use the +Add option to create a new Action for you Procedure. Name the new Action GitCheckAction (no spaces). See Customize Your Actions for more information on creating Actions.

Now we are going to customize this Action. On the right hand side, you will see a list of Functions and Procedures you can choose from. Navigate to your Domain to find the GitCheckOut Procedure. Drag it onto the area under Start. A pop-up dialog box will open for you to complete the following parameters:

GitCheckout Parameters

Field Value Description
Title Not Required Name of the step in your deployment workflow. Use “Git Checkout.”
Summary Not Required Enter a summary of this step.
Git Repo $GIT_URL This Variable represents the Git Repo containing the deployable artifacts. The value will be defined at the Component Level.
Git Commit $GIT_COMMIT This Variable represents the Git the commit, tag or branch to checkout. The value will be defined at the Component Level.
To Dir $GIT_DIR This Variable represents the directory to checkout into. The value will be defined at the Component Level. Use “.” for the default directory when assigning this value at the Component level.

At this point the Action is ready to be used by anyone with access (based on Domain and Group options). Note: Because this Action is reusable, no Component variables are defined. This is performed at the Component level.

Step 4 - Assign the GitCheckoutAction to your Component to be deployed

For each Component you will need to define the variable values for $GIT_URL, $GIT_COMMIT and $GIT_DIR that the GitCheckoutAction will use at the_Component_ level. The values will be passed to the GitCheckoutAction at deploy time. See the Components chapter for more information.

Step 5 - Set Your Component Attributes_

The following variables must be added to the Attributes Section for all Components using the GitCheckoutAction Pre Action. The Attributes section can be found on the Component Dashboard. Use the +Add option in this section to add a row for the variable. You must use Save to commit the row to the table:

Variable Name Value Description
GIT_URL This Variable represents the Git Repo containing the deployable artifacts. The value will be defined at the Component Level.
GIT_COMMIT This Variable represents the Git the commit, tag or branch to checkout. The value will be defined at the Component Level.
GIT_DIR This Variable represents the directory to checkout into. The value will be defined at the Component Level. Use “.” for the default directory when assigning this value at the Component level.

GitHub Issues and DeployHub Change Request

DeployHub can reference the Git issues to track Change Request for Components and Applications. This enables the Git issues to be viewed from a Component or Application using the DeployHub Change Request section from the Component or Application. If you have a Release defined, these GitHub issues will be rolled up from the Component and Application to the Release.

For more information see Tracking Jira, Bugzilla and Git Issue.