我们的工具Deveo是一个代码托管和协作平台,支持git、subversion和mercurial。我们有一个客户案例,他们使用VersionOne。在versionone中有一个commitstream功能,允许他们将git存储库中的提交链接到versionone中的任务。
目前版本单commitstream只支持github、gitlab和bitbucket。有没有任何方法可以将任意git存储库集成到versionone commitstream?我最初的想法是设置一个代理,将来自versionone commitstream中的链接的请求转发给deveo对应方。

最佳答案

如果给定的vcs或前端(如github、gitlab、bitbucket、vso)支持webhook,那么将对它的支持添加到commitstream的过程是相当标准的。commitstream是用node和geteventstore编写的,是开源的,我们接受pull请求:d
在deveo的例子中,我在http://support.deveo.com/knowledgebase/articles/494691-using-deveo-webhooks上看到了一些关于系统中webhook的文档。
这包括一个样本有效载荷。如果说任意的git存储库,您指的是与deveo相关联的git存储库,因此会导致这些deveo webhook被触发,那么我认为乍一看这是可行的。
对于每个vcs,我们都有一个简单的转换函数,它接受入站负载,并在将这些公共属性和原始消息保存到eventstore之前挑选出一些公共属性。
下面是gitlabtranslator.js,例如:
https://github.com/openAgile/CommitStream.Web/blob/develop/src/app/api/translators/es6/gitLabTranslator.js
一些测试用例:
https://github.com/openAgile/CommitStream.Web/blob/develop/src/app/test/api/translators/gitLabTranslator.tests.js
github、gitlab和bitbucket转换器彼此非常相似。
visualstudioonlineforgit转换器有点不同:https://github.com/openAgile/CommitStream.Web/blob/develop/src/app/api/translators/es6/vsoGitTranslator.js
但是,每个模块都有相同的基本“接口”。我不知道deveo webhook消息的格式是否因VCS的不同而有所不同,但如果我假设它不是,那么它看起来像:

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' }
  }
}

如果你想多谈这个,我很乐意。此外,您还可以在https://gitter.im/openAgile/CommitStream.Web进入commitstream的gitter.im频道。

09-11 04:05