Multiple Omni models can share the same git repository. If you’re connecting a model to a repository that’s already connected to another model, you only need to complete the Omni-side setup—the repository’s deploy key and webhooks are already configured.
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, GitLab, Bitbucket, or Azure DevOps
-
Permissions in your git provider that allow you to:
- Add webhooks to repositories
- Add deploy/SSH keys to repositories
Setup
Retrieve the repository's SSH URL
GitHub
GitHub
- In your browser, navigate to the GitHub git repository you want to connect to Omni.
- Click the Code button.
- In the modal that displays, locate the SSH option.
GitLab
GitLab
- In your browser, navigate to the GitLab git repository you want to connect to Omni.
- Click the Code button.
- In the modal that displays, locate the SSH option.
Bitbucket
Bitbucket
- In your browser, navigate to the Bitbucket git repository you want to connect to Omni.
- Click the Clone button near the top right corner of the page.
- In the modal that displays, click the HTTPS dropdown, then select SSH.
Azure DevOps
Azure DevOps
- In your browser, navigate to the Azure DevOps git repository you want to connect to Omni.
- Click the Clone button near the top right corner of the page.
- Click the SSH option to display the repository’s SSH URL.
Connect the repository to Omni
- In Omni, click Develop.
- Click the model you want to connect to git.
- In the model IDE, click Model > Git settings.
- 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
mainunless a different name is specified.
- Click Configure Git.
Add a repository deploy key
Using Bitbucket? The steps for adding a repository deploy differ between self-hosted and Cloud Bitbucket instances. Make sure you click the correct Bitbucket type form the options below.
GitHub
GitHub
- In the GitHub repository, click the Settings tab.
- Click Deploy keys, located in the Security section of the left navigation.
- Click Add deploy key.
- 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
- Click Add key.
GitLab
GitLab
- Create a project deploy key for the GitLab repository by following GitLab’s documentation.
- 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
- Click Add key.
Bitbucket Cloud
Bitbucket Cloud
Bitbucket Cloud access keys are read-only. To allow Omni to push changes, you’ll need to add the SSH key to a user account with write access to the repository. We recommend using a service account for this purpose.
- Create a service account with write access to the repository.
- In the service account, navigate to Personal Bitbucket settings > SSH keys.
- Click Add key.
- Fill in the fields as follows:
- Label - Give your new SSH key a descriptive label
- Key - Copy and paste the public key from the Omni git settings page into this field
- Click Add key to save the key.
Bitbucket Server/Data Center (self-hosted)
Bitbucket Server/Data Center (self-hosted)
- In the Bitbucket repository, click Repository settings.
- Click Access keys, located in the left navigation.
- Click Add key.
- Fill in the fields as follows:
- Key - Copy the Public key from the Omni Git settings page and paste it into this field.
- Permission - Select Write to allow Omni to push changes made in Omni to the repository
- Click Add key.
Azure DevOps
Azure DevOps
- Browse to the Azure DevOps web portal (ex:
https://dev.azure.com/<your-org-name>/). - Click the User settings icon next to your avatar in the top right corner of the page.
- Click SSH public keys.
- On the page that displays, click + New Key.
- 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
- Click Add.
Add repository webhooks
GitHub
GitHub
- The repository settings page should still be open in GitHub. If not, re-open it.
- Click Webhooks, located in the Code and automation section of the left navigation.
- Click Add webhook.
- 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.
- In the Which events would you like to trigger this webhook? section:
- Click Let me select individual events.
- Select the Pull request event.
- If the Push event is selected, deselect it.
- When finished, click Add webhook.
GitLab
GitLab
- The repository settings page should still be open in GitLab. If not, re-open it.
- Click Webhooks.
- Click Add new webhook.
- 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.
- In the Custom headers section:
- Click Add custom header.
- In the Header name field, enter
Content_type. - In the Header value field, enter
application/json.
- In the Trigger section, select Merge request events.
- When finished, click Add webhook.
Bitbucket
Bitbucket
- If the repository settings page isn’t still open, open it by clicking Repository settings in the left navigation.
- Click Webhooks, located in the Workflow section of the left navigation.
- Click Add webhook.
- Fill in the fields as follows:
- Title - Enter a descriptive title, such as Omni Pull Request Webhook
- URL - From the Omni Git settings page, copy the Payload URL and paste it into this field.
- Secret - From the Omni Git settings page, copy the Webhook secret and paste it into this field.
- In the Triggers section, select Choose from a full list of triggers.
- Select only the Pull Request events:
- Pull Request Created
- Pull Request Updated
- Pull Request Merged
- When finished, click Save.
Azure DevOps
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
Create the webhook subscription
- Navigate to the Azure DevOps project that contains the repository you want to connect to Omni.
- Click Project settings.
- Click Service hooks, located in the General section of the left navigation.
- On the Service Hooks page, click the + icon or Create subscription.
- On the Service screen, click Web Hooks and then Next.
Configure the Trigger
- On the Trigger screen, select one of the following for the Trigger on this type of event field.
- Pull request created
- Pull request updated
- Repository status updated
- Select the Repository you want to connect to Omni.
- If the Target branch field displays, select the main branch.
- When finished, click Next.
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
- Pull request created -