Search code examples
gitgithooksversionone

Integration between any git repository and versionone commitstream


Our tool, Deveo, is a code hosting and collaboration platform that supports Git, Subversion and Mercurial. We have a customer case, where they utilise VersionOne. In VersionOne there's a commitstream functionality that allows them to link commits in Git repositories to tasks in VersionOne.

Currently VersionOne commitstream only support GitHub, Gitlab and Bitbucket. Is there any way to integrate arbitrary Git repositories to VersionOne Commitstream? My initial idea is to setup a proxy that would forward the requests from the links in VersionOne commitstream to Deveo counterparts.


Solution

  • If a given VCS or front-end (like GitHub, GitLab, Bitbucket, VSO) supports Webhooks, then the process to add support for it to CommitStream is fairly standard. CommitStream is written with Node and GetEventStore and is open source and we are accepting pull-requests :D

    In the case of Deveo, I see some documentation about Webhooks in your system at: http://support.deveo.com/knowledgebase/articles/494691-using-deveo-webhooks

    This includes a sample payload. If by arbitrary Git repositories, you mean Git repositories that are associated with Deveo, and thus will result in those Deveo Webhooks getting triggered, then I think this is feasible at first glance.

    For each VCS, we have a simple translator function that accepts the inbound payload and picks out some common properties before saving those common properties and the original message into EventStore.

    Here is the gitLabTranslator.js, for example:

    https://github.com/openAgile/CommitStream.Web/blob/develop/src/app/api/translators/es6/gitLabTranslator.js

    And, some test cases for that:

    https://github.com/openAgile/CommitStream.Web/blob/develop/src/app/test/api/translators/gitLabTranslator.tests.js

    The GitHub, GitLab, and Bitbucket translators are fairly similar to each other.

    The Visual Studio Online for Git translator is a little different: https://github.com/openAgile/CommitStream.Web/blob/develop/src/app/api/translators/es6/vsoGitTranslator.js

    However, each module has the same basic "interface". I don't know if the format of the Deveo Webhook messages differs from one VCS to another, but if I assume that it does not, then it would look like:

    const deveoTranslator = {
      family: 'Deveo', // Provides a unique VCS "family" name for this translator.
      canTranslate(request) {
       // Returns true/false by inspecting the inbound request's headers / body properties.
      },
      translatePush(pushEvent, instanceId, digestId, inboxId) {
       // Returns an array of translated commit messages that conform to the "standard" set of common properties.
      },
      getProperties(event) {
        // Returns an object in the form of { repo : 'text name of the repositoryt', repoHref: 'http://link.to/theRepo', branchHref: 'http://link.to/theRepo/branchName' }        
      }
    }
    

    If you'd like to chat more about this, I'd be happy to. Also, you can hop into our Gitter.im channel for CommitStream at https://gitter.im/openAgile/CommitStream.Web