Skip to main content
System StatusContact Support
VersionOne Community

Setup GitLab Webhook

GitLab has the capability to post JSON formatted data on commit pushes. These are called webhooks. This section describes how to setup these webhooks.

Overview

GitLab has the capability to post JSON formatted data on commit pushes. These are called webhooks. This section describes how to setup these webhooks.

First in the Continuum application you must get an authentication token for the webhook to use. The first step of this tutorial showed how to get to the API token. You will need this now.

Login to the GitLab user interface and find the webhook setting for the repository you wish to connect to Continuum. (This will be in the project settings, and look for Webhook on the left menu)

GitLab Documention: http://doc.gitlab.com/ee/web_hooks/web_hooks.html

The GitLab documentation is a little bit sparse on where to access the webhook setting for a repository. Go to the Project page for the repository then select settings. On the left hand Menu you will find Web Hooks.

In the URL text box, you will want to add a URL as follows:

http://serveraddress:8080/api/submit_change?toproject=projectname&token=apitoken
  • "serveraddress" will be the address of the Continuum server

  • "projectname" will be the project created in the first step of this tutorial

  • "apitoken" will be the user’s api token found above

Example:

http://10.12.0.13:8080/api/submit_change?toproject=myapp&token=9f29fb4a-cbf4-11e3-8490-12313b02557d

The Trigger should be for "Push events" only right now.

Click Add Web Hook.

Test the Webhook Push

Now submit a change to your GitLab repository. This simply can be a change to a file, commit and push. Now in the Continuum app in the menu across the top select Perspectives > Changes. You should see the commit came in as a Change.

Click on the change row, then the Commit Details tab. This is the JSON representation of the payload sent from GitLab to Continuum.

What Happened?

When GitLab pushed the change to the Continuum REST API, the Json payload was converted into a normalized Change record in Continuum. This change can now be tracked throughout its lifecycle.

Click on the project name, then on the Version tab on the left. Expand the Changes section. If everything went fine, you should see the change that came in listed here. Clicking on that row will show additional details of the change including who made the commit, the log and a list of the files involved.

If everything went ok, then skip to the next section. Otherwise let's troubleshoot.

Troubleshooting

When using webhooks the place to look will be in the Continuum web ui log. To access this log from the user interface, in the upper right menu, Administration > Manage Settings. Scroll down until you see "ctm-ui". On that same row you will see an icon to view the logfile. Click on the icon. Any error messages will appear in this log. If you need to view more lines, use the inputs at the top to retrieve more lines from the log.

Most problems with webhook submission will be related to wrong project names, a blocked port through a firewall or a wrong token string.

Continue

Refer to Associating Work Items with Changes to continue on with the tutorial once the Stash changes are viewable in Continuum.

  • Was this article helpful?