diff --git a/images/gitlab/gitlab-config.png b/images/gitlab/gitlab-config.png new file mode 100644 index 0000000..bdd9d33 Binary files /dev/null and b/images/gitlab/gitlab-config.png differ diff --git a/images/gitlab/gitlab-project-access-token.png b/images/gitlab/gitlab-project-access-token.png index 6056c91..74f5607 100644 Binary files a/images/gitlab/gitlab-project-access-token.png and b/images/gitlab/gitlab-project-access-token.png differ diff --git a/images/gitlab/gitlab-project-id.png b/images/gitlab/gitlab-project-id.png index 21c9521..b657039 100644 Binary files a/images/gitlab/gitlab-project-id.png and b/images/gitlab/gitlab-project-id.png differ diff --git a/images/gitlab/gitlab-project-webtoken-test.png b/images/gitlab/gitlab-project-webtoken-test.png new file mode 100644 index 0000000..07b20a8 Binary files /dev/null and b/images/gitlab/gitlab-project-webtoken-test.png differ diff --git a/images/gitlab/gitlab-project-webtoken.png b/images/gitlab/gitlab-project-webtoken.png new file mode 100644 index 0000000..4846e57 Binary files /dev/null and b/images/gitlab/gitlab-project-webtoken.png differ diff --git a/images/gitlab/gitlab-show-webtoken.png b/images/gitlab/gitlab-show-webtoken.png new file mode 100644 index 0000000..d5adac6 Binary files /dev/null and b/images/gitlab/gitlab-show-webtoken.png differ diff --git a/images/gitlab/gitlab-webhook.png b/images/gitlab/gitlab-webhook.png new file mode 100644 index 0000000..730c45a Binary files /dev/null and b/images/gitlab/gitlab-webhook.png differ diff --git a/settings/gitlab.mdx b/settings/gitlab.mdx index 0f4935d..576ba17 100644 --- a/settings/gitlab.mdx +++ b/settings/gitlab.mdx @@ -1,28 +1,37 @@ --- title: "GitLab" description: "Sync your docs with a GitLab repo" -icon: 'gitlab' +icon: "gitlab" --- - GitLab integration is available on the [Enterprise plan](https://mintlify.com/pricing). + GitLab integration is available on the [Enterprise + plan](https://mintlify.com/pricing). +We use a combination of Access tokens and Webhooks to authenticate and sync +changes between GitLab and Mintlify. + +- We use Access tokens to pull information from GitLab. +- We use Webhooks so GitLab can notify Mintlify when changes are made. + - This allows Mintlify to create preview deployments when a MR is created. + +## Set up the connection + - Navigate to your project's `Settings` > `General` and find the Project ID. + Within your GitLab project, navigate to `Settings` > `General` and find the `Project ID`. - - - a. Navigate to your project's `Settings` > `Access Tokens`. + + a. Navigate to `Settings` > `Access Tokens`. b. Select `Add new token`. - 1. Name the token "Mintlify" - this specific name is important as it will be visible when we make changes on our end. - 2. Choose `read_api` for the scopes. - 3. If you have a private repo, you must set the role as `Reporter`. + 1. Name the token "Mintlify". + 2. If you have a private repo, you must set the role as `Maintainer`. + 3. Choose `api` and `read_api` for the scopes. c. Finally click `Create project access token` and copy the token. @@ -31,7 +40,59 @@ icon: 'gitlab' - - Contact us [here](https://mintlify.com/enterprise). + + Within the [Mintlify dashboard](https://dashboard.mintlify.com/mintlify/mintlify/settings/deployment/git-settings), add the project ID and access token from the previous steps alongside the other configurations. Click "Save Changes" when you're done. + + + + +## Create the webhook + +Webhooks allow us to receive events when changes are made so that we can +automatically trigger deployments. + + + + + + + + + In the "URL" field, enter the endpoint `https://leaves.mintlify.com/gitlab-webhook` and name the webhook "Mintlify". + + + + Paste the Webhook token generated after setting up the connection. + + + + + + Select the events you want to trigger the webhook: + - Push events (All branches) + - Merge requests events + + When you're done it should look like this: + + + + + + After creating the Webhook, click the "Test" dropdown and select "Push events" to send a sample payload to ensure it's configured correctly. It'll say "Hook executed successfully: HTTP 200" if configured correctly. + + This will help you verify that everything is working correctly and that your documentation will sync properly with your GitLab repository. + + + + + + + + + Reach out to the Mintlify team if you need help. Contact us + [here](https://mintlify.com/enterprise). + + +[git-settings]: https://dashboard.mintlify.com/settings/deployment/git-settings