Skip to main content

Setting up the git integration

In this guide, you'll learn how to set up Omni's git integration by connecting a git repository to an Omni model.

Requirements

To follow the steps in this guide, you'll need:

  • Omni Connection Admin permissions for the model you want to connect to git
  • An existing git repository in GitHub, Git Lab, or Azure DevOps
  • Permissions in your git provider that allow you to:
    • Add webhooks to repositories
    • Add deploy/SSH keys to repositories
    Refer to the documentation for your git provider for information about their user permissions.

Step 1: Retrieve the repository's SSH URL

GitHub & GitLab
  1. In your browser, navigate to the GitHub or GitLab repository you want to connect to Omni.
  2. Click the Code button.
  3. In the modal that displays, locate the SSH option.

Keep this page open - you'll need it in the next step.

Azure DevOps
  1. In your browser, navigate to the Azure DevOps git repository you want to connect to Omni.
  2. Click the Clone button near the top right corner of the page.
  3. Click the SSH option to display the repository's SSH URL.

Keep this page open - you'll need it in the next step.

Step 2: Connect the repository to Omni

  1. In Omni, click Develop.
  2. Click the model you want to connect to git.
  3. In the model IDE, click Model > Git settings.
  4. You'll be prompted to enter connection details for the repository:
    • SSH URL - Copy and paste the repository's SSH URL from Step 1
    • Base Branch - Enter the name of default branch for the repository. Omni will default to main unless a different name is specified.
  5. Click Configure Git.

The page will update to display additional git settings, along with information for deploy keys and webhooks. Keep this page handy and proceed to Step 3.

Step 3: Add a repository deploy key

GitHub
  1. In the GitHub repository, click the Settings tab.
  2. Click Deploy keys, located in the Security section of the left navigation.
  3. Click Add deploy key.
  4. Fill in the fields as follows:
    • Title - Enter a descriptive title to help you identify what the key is used for. For example, Omni Snowflake model
    • Key - Copy the Public key from the Omni Git settings page and paste it into this field.
    • Allow write access - Check this box, which will allow Omni to push changes made in Omni to the repository
  5. Click Add key.
GitLab
  1. Create a project deploy key for the GitLab repository by following GitLab's documentation.
  2. Fill in the deploy key fields as follows:
    • Title - Enter a descriptive title to help you identify what the key is used for. For example, Omni Snowflake model
    • Key - Copy the Public key from the Omni Git settings page and paste it into this field.
    • Grant write permissions to this key - Check this box, which will allow Omni to push changes made in Omni to the repository
  3. Click Add key.
Azure DevOps
  1. Browse to the Azure DevOps web portal (ex: https://dev.azure.com/<your-org-name>/).
  2. Click the User settings icon next to your avatar in the top right corner of the page:
  3. Click SSH public keys.
  4. On the page that displays, click + New Key.
  5. In the Add New SSH Key panel that displays, fill in the following:
    • Name - Enter a descriptive name, such as Omni Snowflake model
    • Public Key Data - Copy and paste the Public key from the Omni Git settings page
  6. Click Add.

Step 4: Add repository webhooks

GitHub
  1. The repository settings page should still be open in GitHub. If not, re-open it.
  2. Click Webhooks, located in the Code and automation section of the left navigation.
  3. Click Add webhook.
  4. Fill in the fields as follows:
    • Payload URL - From the Omni Git settings page, copy the Payload URL and paste it into this field.
    • Content type - Select the application/json option.
    • Secret - From the Omni Git settings page, copy the Webhook secret and paste it into this field.
  5. In the Which events would you like to trigger this webhook? section:
    1. Click Let me select individual events.
    2. Select the Pull request event.
    3. If the Push event is selected, deselect it.
  6. When finished, click Add webhook.
GitLab
  1. The repository settings page should still be open in GitLab. If not, re-open it.
  2. Click Webhooks.
  3. Click Add new webhook.
  4. Fill in the fields as follows:
    • URL - From the Omni Git settings page, copy the Payload URL and paste it into this field.
    • Secret token - From the Omni Git settings page, copy the Webhook secret and paste it into this field.
  5. In the Custom headers section:
    1. Click Add custom header.
    2. In the Header name field, enter Content type.
    3. In the Header value field, enter application/json.
  6. In the Trigger section, select Merge request events.
  7. When finished, click Add webhook.
Azure DevOps

Next, you'll create three webhook subscriptions for the Azure DevOps repository, one for each of the following event types:

  • Pull request created
  • Pull request updated
  • Repository status updated

Step 1: Create the webhook subscription

  1. Navigate to the Azure DevOps project that contains the repository you want to connect to Omni.
  2. Click Project settings.
  3. Click Service hooks, located in the General section of the left navigation.
  4. On the Service Hooks page, click the + icon or Create subscription.
  5. On the Service screen, click Web Hooks and then Next.

Step 2: Configure the Trigger

  1. On the Trigger screen, select one of the following for the Trigger on this type of event field.
    1. Pull request created
    2. Pull request updated
    3. Repository status updated
  2. Select the Repository you want to connect to Omni.
  3. If the Target branch field displays, select the main branch.
  4. When finished, click Next.

Step 3: Configure the Action

On the Action screen, fill in the fields as follows:

  • URL - Copy and paste the Webhook URL from the Omni Git settings page
  • Basic auth username - omni
  • Basic auth password - Copy and paste the Webhook secret from the Omni Git settings page
  • HTTP headers - The value of this field depends on the type of event being configured:
    • Pull request created - x-azuredevops-omni-event:created
    • Pull request updated - x-azuredevops-omni-event:update-push
    • Repository status updated - x-azuredevops-omni-event:update-status

When finished, click Finish to create the webhook.

Part 4: Repeat steps 1-3

Repeat these steps for each of the three webhook subscription types.

Step 5: Test the connection

To verify the set up, navigate back to the Git settings page in Omni. Click the Test git connection button near the top of the page to test the connection.

What's next?

After the setup is complete, you can configure the integration's behavior by changing its settings. Refer to the git integration settings reference for more information.