Playing With Gerrit Jira Plugin
Aug 5th, 2014
Build and Setup
1. Clone the Gerrit source:
1
|
$ git clone https://gerrit.googlesource.com/gerrit
|
2. Checkout to version 2.8 (2.8 is the latest stable version), include to update submodules:
1
2
3
|
$ cd gerrit
$ git checkout -b stable-2.8 stable-2.8
$ git submodule update --init --rebase # commands, please referece to git submodule
|
3. Clone buck, buck is the build system for the latest Gerrit, then build it with ant (‘sudo apt-get install ant’):
1
2
3
|
$ git clone https://gerrit.googlesource.com/buck
$ cd buck
$ ant
|
4. Install buck to be accessed globally:
1
2
3
4
5
|
$ mkdir ~/bin
$ export PATH=~/bin:$PATH
$ ln -s `pwd`/bin/buck ~/bin/
$ ln -s `pwd`/bin/buckd ~/bin/
$ which buck
|
5. Build Gerrit:
1
2
|
$ cd gerrit
$ buck build gerrit
|
NOTE: The gerrit.war will be generated here: buck-out/gen/gerrit.war
6. Build extension, plugin, GWT API jar files, and install them:
1
2
|
$ buck build api
$ buck build api_install
|
7. Build all core plugins (optional):
1
|
$ buck build plugins:core
|
NOTE: All core plugins will be generated here: buck-out/gen/plugins/<name>/<name>.jar
8. Clone the hooks-its, and hooks-jira projects:
1
2
3
4
5
|
$ git clone https://gerrit.googlesource.com/plugins/hooks-its plugins/hooks-its
$ cd plugins/hooks-its
$ git checkout -b v2.8 origin/stable-2.8
$ cd ../..
$ git clone https://gerrit.googlesource.com/plugins/hooks-jira plugins/hooks-jira
|
9. Modify the pom.xml files under plugins/hooks-its AND plugins/hooks-its/hooks-its:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
cd plugins/hooks-its
$ git diff
diff --git a/hooks-its/pom.xml b/hooks-its/pom.xml
index a206459..75e11dc 100644
--- a/hooks-its/pom.xml
+++ b/hooks-its/pom.xml
@@ -22,7 +22,7 @@ limitations under the License.
<parent>
<groupId>com.googlesource.gerrit.plugins.its</groupId>
<artifactId>hooks-its-parent</artifactId>
- <version>2.9-SNAPSHOT</version>
+ <version>2.8</version>
</parent>
<artifactId>hooks-its</artifactId>
<name>Gerrit Code Review - Commit validation and Workflow</name>
diff --git a/pom.xml b/pom.xml
index 600bff9..995d008 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@ limitations under the License.
<groupId>com.googlesource.gerrit.plugins.its</groupId>
<artifactId>hooks-its-parent</artifactId>
<packaging>pom</packaging>
- <version>2.9-SNAPSHOT</version>
+ <version>2.8</version>
<name>Gerrit Code Review - Issue tracker support</name>
|
10. Build the hooks-its:
1
2
|
$ cd plugins/hooks-its
$ mvn -DskipTests -Dmaven.test.skip=true package install
|
NOTE: The hooks-its-2.8.jar will be generated here: hooks-its/target/hooks-its-2.8.jar NOTE: If don’t skip tests, run with the command: mvn clean package install
, then will fail on test case! NOTE: Gerrit select BUCK as its new build system, for new plugin, please reference to the following NOTES #5
11. Modify the pom.xml files under plugins/hooks-jira:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
$ cd plugins/hooks-jira
$ git diff
diff --git a/pom.xml b/pom.xml
index 7b04c60..8f60c78 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,7 +20,7 @@ limitations under the License.
<parent>
<groupId>com.googlesource.gerrit.plugins.its</groupId>
<artifactId>hooks-its-parent</artifactId>
- <version>2.9-SNAPSHOT</version>
+ <version>2.8</version>
</parent>
<artifactId>hooks-jira</artifactId>
<packaging>jar</packaging>
|
12. Build the hooks-jira:
1
2
|
$ cd plugins/hooks-jira
$ mvn clean package
|
NOTE: The hooks-jira-2.8.jar will be generated here: target/hooks-jira-2.8.jar
13. Copy the following jar files to the plugin
folder under the Gerrit installation path on remote server:
1
2
|
hooks-its-2.8.jar
hooks-jira-2.8.jar
|
For example:
1
|
$ scp hooks-its/target/hooks-its-2.8.jar ../hooks-jira/target/hooks-jira-2.8.jar gerrit2@review.example.co:/home/gerrit2/review_site/plugins
|
14. Add a new file etc/its/action.config under the Gerrit installation path on remote server:
1
2
3
4
5
6
7
8
9
10
11
12
|
[rule "merged"]
event-type = change-merged
action = add-standard-comment
[rule "comment"]
event-type = comment-added
action = add-standard-comment
[rule "patch-set"]
event-type = patchset-created
action = add-standard-comment
[rule "ref-updated"]
event-type = ref-updated
action = add-standard-comment
|
15. Run the Gerrit initial installation command on remote server:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
$ java -jar gerrit-2.8.war init -d review_site
*** Gerrit Code Review 2.8
***
*** Git Repositories
***
Location of Git repositories [git]:
*** SQL Database
***
Database server type [mysql]:
Server hostname [localhost]:
Server port [(mysql default)]:
Database name [reviewdb]:
Database username [gerrit2]:
Change gerrit2's password [y/N]?
*** User Authentication
***
Authentication method [DEVELOPMENT_BECOME_ANY_ACCOUNT/?]:
*** Email Delivery
***
SMTP server hostname [localhost]:
SMTP server port [(default)]:
SMTP encryption [NONE/?]:
SMTP username [gerrit2]:
Change gerrit2's password [y/N]?
*** Container Process
***
Run as [gerrit2]:
Java runtime [C:\Program Files (x86)\Java\jre7]:
Upgrade c:\Users\gerrit2\gerrit\bin\gerrit.war [Y/n]?
Copying gerrit-2.8.war to c:\Users\gerrit2\gerrit\bin\gerrit.war
*** SSH Daemon
***
Listen on address [*]:
Listen on port [29418]:
*** HTTP Daemon
***
Behind reverse proxy [y/N]?
Use SSL (https://) [y/N]?
Listen on address [*]:
Listen on port [8080]:
Canonical URL [http://review.example.com:8080/]:
*** Plugins
***
Install plugin reviewnotes version v2.8 [y/N]?
Install plugin download-commands version v2.8 [y/N]?
Install plugin replication version v2.8 [y/N]?
Install plugin commit-message-length-validator version v2.8 [y/N]?
*** Jira connectivity
***
Jira URL (empty to skip) [https://jira.example.com/]:
Jira username [jira-robot]:
Change jira-robot's password [y/N]?
Test connectivity to https://jira.example.com [y/N]? y
Checking Jira connectivity ... [OK]
*** Jira issue-tracking association
***
Jira issue-Id regex [([A-Z]+-[0-9]+)]:
Issue-id enforced in commit message [MANDATORY/?]:?
Supported options are:
mandatory
suggested
optional
Issue-id enforced in commit message [MANDATORY/?]: suggested
Initialized C:\Users\gerrit2\gerrit
|
16. Restart gerrit-jetty service:
1
|
$ sudo service gerrit-jetty.sh restart
|
17. Done!
NOTES:
1. Download Gerrit here: http://gerrit-releases.storage.googleapis.com/index.html
2. The file review_site/etc/gerrit.config should look like:
1
2
3
4
5
6
7
8
|
[jira]
url = http://review.example.com:8080
username = jira-robot
commentOnRefUpdatedGitWeb = false # to comment gitweb comments on jira
[commentLink "jira"]
match = ([A-Z]+-[0-9]+)
html = <a href=\"http://jira.example.com:8080/browse/$1\">$1</a>
association = SUGGESTED
|
3. If we just want to parse the jira id on the subject of the git comments, then here is the diff:
1
2
3
4
5
6
7
8
9
10
11
12
13
|
diff --git a/hooks-its/src/main/java/com/googlesource/gerrit/plugins/hooks/util/
index a04b175..3d56426 100644
--- a/hooks-its/src/main/java/com/googlesource/gerrit/plugins/hooks/util/CommitM
+++ b/hooks-its/src/main/java/com/googlesource/gerrit/plugins/hooks/util/CommitM
@@ -31,7 +31,7 @@ public class CommitMessageFetcher {
RevWalk revWalk = new RevWalk(repo);
RevCommit commit = revWalk.parseCommit(ObjectId.fromString(commitId));
- return commit.getFullMessage();
+ return commit.getShortMessage();
} finally {
repo.close();
}
|
4. Get the log message from jetty/logs on Gerrit server. 5. Gerrit choose BUCK as its new build system, so for the new plugin, the build steps should be (take cookbook-plugin as an example):
1
|
buck build plugins/cookbook-plugin
|
The output is created in: buck-out/gen/plugins/cookbook-plugin/cookbook-plugin.jar
References:
1. https://groups.google.com/forum/#!msg/repo-discuss/GSyHMeaCyyw/cJGunFcNc4oJ 2. https://gerrit-review.googlesource.com/Documentation/dev-buck.html
相关推荐
Gerrit 中的 JIRA 集成 这是一个非废弃的 hooks-jira 叉子,专为我们在奥克兰大学做看板而设计。 它主要增加了在票证不在正确位置时转换票证的能力,并允许对它们采取行动,目前是“设置分配”和“取消分配”。 您...
吉里特 命令行参数 -h帮助消息 -v启用日志记录和更多交互。 大多数查询操作都需要记录。... 服务器类型为Jira和Gerrit。 名称在每种类型中必须唯一。 每个服务器都需要url。 如果与整体配置不相同,则可以提供pass。
标题 "gerrit-intellij-plugin-1.2.6-203" 指的是一款集成在IntelliJ IDEA中的Gerrit代码审查插件的特定版本。这个插件允许开发者在IDE内部直接与Gerrit代码审查系统进行交互,提高开发效率和代码审查流程的便捷性。...
gerrit-intellij-plugin 介绍 工具的非官方插件。 它支持任何基于IntelliJ平台的产品: IntelliJ IDEA IntelliJ IDEA CE Ruby矿 网络风暴 暴风雨 药香 PyCharm CE 应用程式码 Android Studio 数据夹 里昂 高地 ...
### 代码审查与Gerrit #### 一、代码审查概览 代码审查(Code Review)是一种系统性的检查计算机源代码的过程,旨在发现并修正开发初期可能被忽视的错误,从而提高软件的整体质量和开发人员的技术水平。根据维基...
gerrit-2.16.5 Gerrit,一种免费、开放源代码的代码审查软件,使用网页界面。利用网页浏览器,同一个团队的软件程序员,可以相互审阅彼此修改后的程序代码,决定是否能够提交,退回或者继续修改。
`gerrit-intellij-plugin`是专为IntelliJ IDEA设计的插件,允许开发者在IDE内部直接与Gerrit进行交互,简化了代码审查的过程。 此插件版本为`1.0.6-146`,意味着它已经过多次迭代和优化,以适应Gerrit和IntelliJ ...
当前最新版本的gerrit-2.10安装包
的员工)在Jenkins用户大会旧金山站于2011年10月2日所做的一次关于“Continuous Deployment with Gerrit and Jenkins”的演讲。在这次演讲中,他可能涵盖了以下知识点: 1. 持续部署的简要概述:介绍了持续部署的...
Gerrit 使用文档手册,适合新手学习 Gerrit Gerrit 是一个基于 Web 的代码レビュー工具,用于管理代码的提交和审核。下面是 Gerrit 使用文档手册的知识点总结: 一、获取权限 在使用 Gerrit 之前,需要获取权限,...
在本文中,我们将深入探讨如何在Windows环境下搭建一个基于Git的代码审核平台——Gerrit。Gerrit是一个开源的代码审查系统,它允许开发者提交代码,并通过一个交互式的Web界面进行审查,确保代码的质量和一致性。...
7. **问题追踪与报告**:Gerrit可以通过链接到外部问题追踪系统(如JIRA)来关联代码更改和问题报告。学习如何有效地使用这个特性,可以使团队更好地跟踪和解决问题。 8. **性能优化与维护**:随着项目规模的增长,...
gerrit-change-trigger:Gerrit 变更触发器插件 添加一名作者 存储库: : 发布: : 概要 这是一个 Gerrit 插件。 这可以在 gerrit 事件流的更改中触发最新补丁patchset-created事件。 Trigger按钮被添加到修订...
Gitiles是Gerrit代码审查系统中的一个插件,它被设计用来方便地浏览和查看存储在Gerrit服务器上的Git仓库的源代码。Gitiles提供了网页界面,使得用户可以直观地浏览项目文件、查看历史记录、比较不同版本之间的差异...
Gerrit是一种基于Web的代码审查工具,主要功能是允许团队成员之间审阅对方代码的修改,以决定是否应该提交这些更改。Gerrit使用Git作为其底层的版本控制系统,允许开发者使用Git的标准命令行工具来提交代码。由于...
Gerrit搭建及权限配置 Gerrit是一款基于Web的代码Review工具,它提供了一个平台来review和validate代码变更。下面是Gerrit搭建及权限配置的详细介绍: 安装JDK 在安装Gerrit之前,需要先安装JDK。可以使用压缩包...
但我可以根据标题“Gerrit 配置”和描述“Gerrit 中文配置使用”,以及标签“code review”,来梳理出Gerrit配置和使用相关的核心知识点。 Gerrit是一个基于Web的代码审查工具,它与Git版本控制系统紧密集成,用于...
gerrit-3.6.1安装包
Extend the addMenuLink method in the PolyGerrit plugin API to allow plugins to specify a capability that users must have in order to view a top menu item provided by the plugin. Utility script remove...