GitLab integration
When you version SQL changes in GitLab, use GitLab as a Git Ops change source in CloudDM. Create a dedicated release account and grant it access to the relevant GitLab project so CloudDM can retrieve the changes.
Connect GitLab to CloudDM
- Sign in to CloudDM with an account that can manage integrations.
- Sign in to GitLab with the release account. Open the avatar menu and choose Edit profile.
- Go to Access > Personal access tokens, then select Generate token > Legacy token. Select the
read_apiscope and generate the token. Save the token when it appears. GitLab displays it once. - In CloudDM, go to Integration > Git Ops and click New.
- Select GitLab.
- Enter a Name. In Service, enter the GitLab web base URL and omit the
/api/v4suffix. Keep the deployment subpath when applicable. For example:https://gitlab.example.comhttps://gitlab.example.com:8443/gitlab
- Enter the token in AccessToken. Review the risk of transmitting the token in plaintext before using an HTTP address.
- Click Test to verify the connection. After it succeeds, click Add.
Configure a webhook
- In the CloudDM change flow's details page, go to Configuration Items > Trigger Settings and click View Configuration. Open WebHook, enable it, and copy the webhook URL.
- Sign in to GitLab with the release account and open the target project.
- In the project sidebar, go to Settings > Webhooks and select Add new webhook.
- Paste the CloudDM webhook URL into GitLab.
- Set up webhook authentication.
- For GitLab 19.1 and later, use the recommended Signing token. Generate it in GitLab, copy it when it appears, and paste it into CloudDM's Signing Token field.
- For other versions, use CloudDM's Secret as the GitLab Secret token.
- Select the event that matches your change flow's trigger.
- Push uses Push events. A push to the target branch triggers the change.
- Pull Request uses Merge request events. CloudDM triggers the change after a merge request merges into the target branch.
- Use GitLab's default webhook payload. Keep Enable SSL verification selected for HTTPS.
- Save the webhook in GitLab, then save the trigger configuration in CloudDM.
- In the GitLab webhook list, use Test to send a test event and confirm CloudDM can receive it.
info
- Keep the subpath in the service URL if GitLab is deployed under a subpath.
- CloudDM needs access to the GitLab API.
- GitLab needs access to the webhook URL generated by CloudDM.
Webhook response codes
When testing a webhook or reviewing delivery records in GitLab, use the HTTP status code returned by CloudDM to diagnose the result.
| Status code | Meaning | What to check |
|---|---|---|
200 | CloudDM accepted the request. It also acknowledges events that fall outside the flow's trigger settings and duplicate deliveries without creating an extra change. | To see whether an event created a change, check the target branch, event type, and change records. |
400 | The webhook request was invalid. Causes include invalid URL parameters, an empty or malformed body, a body that exceeds the size limit, invalid UTF-8, a project or branch mismatch, or an invalid change flow configuration. | Copy the webhook URL again, use the default payload, and check the project, target branch, and trigger in the change flow. |
401 | Webhook authentication failed. The signing token, secret token, signature header, or signature timestamp was invalid. | Check that both sides use the same token. If you regenerate a signing token, copy its full value immediately. |
404 | CloudDM could not find the change flow or Git Ops source associated with the webhook. | Verify that the change flow and Git Ops configuration exist, then copy the webhook URL again. |
500 | CloudDM encountered an internal error while processing the webhook. | Check the CloudDM Console logs. Resolve the error before resending the event in GitLab. |
503 | CloudDM could not retrieve the commit SHA for a merged merge request from GitLab. | Check the GitLab API, network connection, and AccessToken. Resend the event once access is restored. |
For GitLab's settings, see Personal access tokens and Webhooks.