CloudDM 4.8.0 adds GreptimeDB as a DataSource
Skip to main content

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​

  1. Sign in to CloudDM with an account that can manage integrations.
  2. Sign in to GitLab with the release account. Open the avatar menu and choose Edit profile.
  3. Go to Access > Personal access tokens, then select Generate token > Legacy token. Select the read_api scope and generate the token. Save the token when it appears. GitLab displays it once.
  4. In CloudDM, go to Integration > Git Ops and click New.
  5. Select GitLab.
  6. Enter a Name. In Service, enter the GitLab web base URL and omit the /api/v4 suffix. Keep the deployment subpath when applicable. For example:
    • https://gitlab.example.com
    • https://gitlab.example.com:8443/gitlab
  7. Enter the token in AccessToken. Review the risk of transmitting the token in plaintext before using an HTTP address.
  8. Click Test to verify the connection. After it succeeds, click Add.

Configure a webhook​

  1. 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.
  2. Sign in to GitLab with the release account and open the target project.
  3. In the project sidebar, go to Settings > Webhooks and select Add new webhook.
  4. Paste the CloudDM webhook URL into GitLab.
  5. 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.
  6. 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.
  7. Use GitLab's default webhook payload. Keep Enable SSL verification selected for HTTPS.
  8. Save the webhook in GitLab, then save the trigger configuration in CloudDM.
  9. 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 codeMeaningWhat to check
200CloudDM 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.
400The 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.
401Webhook 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.
404CloudDM 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.
500CloudDM encountered an internal error while processing the webhook.Check the CloudDM Console logs. Resolve the error before resending the event in GitLab.
503CloudDM 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.