Gitlab (Beta)
Integrate Monte Carlo with your Gitlab to gain visibility into code impact on your data
Overview
The Gitlab integration allows customers to
-
Reduce time to resolution by easily checking potentially relevant pull requests ("merge requests" in Gitlab) in the context of an incident via PRs overlaid on incident charts.
-
Prevent data issues by seeing an impact report with the potentially impacted tables/reports for a pull request via a message from MC-Gitlab bot (requires dbt integration).
-
Get code change context on tables via reviewing recent pull request history on the asset page.
Setup Instructions
1. Start Gitlab-MC Integration
Go to https://getmontecarlo.com/settings/integrations. Under βNotifications and collaborationβ click βCreateβ and select βGitlabβ.
Specify custom host, if needed. Navigate via the link after βCreate a new Gitlab applicationβ to Gitlab UI.
2. Create Gitlab Application
Go to Gitlab, in the Applications tab, click on βAdd new applicationβ button. Fill out the form and save application:
- Name:
- Redirect URI: https://getmontecarlo.com/auth/callback/gitlab
- Scopes: select βapiβ
You will need the Application ID and Secret fields from your Gitlab app to create the MC integration.
Note on Gitlab App Creation Levels
Gitlab application can be created at different levels with different scopes and permission sets. Please choose based on your needs.
- User level
- url:Β
https://gitlab.com/-/user_settings/applications
this is the link MC UI directs to- provides access to all the groups/projects that the user can access
- once the user is disabled/removed, the integration will stop working
- Admin level
- url:Β
https://{host}/admin/applications/new
- only available on self-hosted instances
- the user must have the admin role
- provides access to all the groups/projects on the instance
- Group level
- url:Β
https://gitlab.com/groups/{**group**}/-/settings/applications/new
- the user must choose theΒ
group
Β in advance- provides access only to the group's project
3. Complete Integration in MC
Go back to MC UI, fill in Application ID and Secret, then hit βCreateβ.
You should then be navigated to Gitlab UI for authorization.
Once authorized, come back to the MC setup UI to select the Gitlab projects you want to observe. Pull requests from the selected projects will be displayed in MC UI to help investigate their impact on your tables.
At this point, you will have Gitlab PRs show up in MC UI so you can filter the PRs to identify which ones impacted a given table. But to make the integration more powerful, continue with steps below.
4. [Recommended] Supercharge with dbt integration
MC can map pull requests to the tables they update via the dbt integration. If you want PR-to-impacted table mapping in the UI or impact reports for PRs during CICD, make sure to set up dbt integration following docs.
If you have dbt cloud, then once you set up the dbt integration above you are all set, since all mapping will be done automatically. If you have dbt core, then go to βConfigure dbt projectsβ under the Gitlab integration setting to complete the final step.
Under βConfigure dbt projectsβ, you will see a list of dbt connections you set up in MC. Most customers will have just one. For each dbt connection, you will be able to select the dbt project you want to map, then add the project's remote URL and subdirectory. This helps MC point each dbt project at the relevant Gitlab repository, so we can map each PR to the corresponding dbt model and tables.
- Gitlab project remote URL: this should be in the format of
https://gitlab.com/<org>/<repo>
orgit://gitlab.com/<org>/<repo>.git
- Project subdirectory: This is the root directory of the dbt models within the repo. It is only needed if the dbt project is further down the directory. For example, if a model path is
analytics/models/foo/bar.sql
then subdirectory would beanalytics
. If a model path ismodels/foo/bar.sql
then subdirectory would be empty.
Press βUpdateβ once done, and you should be all set. Now you will be able to enjoy all the features listed above.
Updated about 15 hours ago