g公司使用Gerrit改善评审流程. 比较麻烦.gerrit提交后会触发vertifyCI, 实施代码扫描.

这一堆过程, 打印出一堆信息, 都在log中, 所以处理log就需要自己写shell了.

ssh -p  xxxxx@xxxxxx gerrit query --format=JSON --patch-sets --all-approvals --commit-message --comments change:3920147

#提取log中的http:// url, 取第一条
ssh -p 29418 xxxxx@xxxxxx gerrit query --format=JSON --comments change:3920147|head -n 1 | jq '.comments'|jq '.[] | .message'|grep -oh "https.*/" | head -n 1 #log

java -jar ~/bin/jenkins-cli.jar -s https://xxxxxxx/xxxxx/ -auth xxxxx:xxxxxx console jobName 472

其中用到几个工具, jq, 是一个解析json的工具, 功能非常强大:

jq

https://stedolan.github.io/jq/manual/#Basicfilters

https://www.cnblogs.com/bhlsheji/p/5345192.html

https://www.cnblogs.com/lurenjiashuo/p/bash-json-jq.html

gerrit query

https://gerrit-documentation.storage.googleapis.com/Documentation/2.13.7/cmd-query.html

https://gerrit-documentation.storage.googleapis.com/Documentation/2.13.7/json.html

另外关于正则表达式的贪婪非贪婪模式:

https://www.cnblogs.com/xudong-bupt/p/3586889.html

https://gerrit-documentation.storage.googleapis.com/Documentation/2.13.7/user-search.html

grep

grep 仅显示匹配部分,(默认是显示匹配到的行)

grep -oh "abc" xxx.log

abc可以为正则表达式

git & gerrit & shell的更多相关文章

  1. Git Gerrit使用

    Git Gerrit 操作都用 git bash操作: 如果想用 cmd 或者 PowerShell,系统环境变量 Path 添加 Git 安装路径,如: C:\Program Files (x86) ...

  2. git/gerrit的简介

    gerrit和git   1.git Git是什么? Git是目前世界上最先进的分布式版本控制系统. SVN是集中式版本控制系统. Git与svn比较 相同:能记录文件的所有更改记录.这样是为了大量更 ...

  3. Git + Gerrit 操作备忘

    Git review 作用 可以用来提交代码审核到Gerrit 安装 使用pip 安装 git-review 插件,执行 sudo -H pip install git-review 使用示例 可以参 ...

  4. Git Gerrit Repo User Manual

                      Git Repo Gerrit User Manual Revision History   Revision # Description Date Author ...

  5. git + gerrit push 代码问题

    关于refs/for 和 refs/heads: 1.     这个不是git的规则,而是gerrit的规则, 2.     Branches, remote-tracking branches, a ...

  6. Centos 下 Jenkins2.6 + Git + Maven Shell一件部署与备份

    使用Jenkins2.6 集成Maven与Git插件做持续集成,同时编写Shell脚本备份与发布(需要稍微知道点Linux/毕竟基于Centos PS:本人Linux也是菜鸡) - 下载Jenkins ...

  7. Git Gerrit Code Review

    Gerrit Code Review | Gerrit Code Reviewhttps://www.gerritcodereview.com/

  8. Android代码编译环境配置 “Gerrit和Git环境配置”

    Gerrit和Git环境配置可以参考<git&gerrit操作指导> 步骤1. 先在Gerrit中创建新的账户: 步骤2. 在新的客户端上生成密钥(可以使用的是生成的公钥): 步骤 ...

  9. [原创]升级Gerrit的commit-msg,检查git commit时必须填写开发任务编号TaskID

    公司使用git+gerrit+jenkins进行持续集成实践,其中gerrit用来进行Code Review.另外我们自己研发了一套敏捷项目管理系统TPM(TeamPlus Management),用 ...

随机推荐

  1. kubeadm快速部署kubernetes(十九)

    安装要求 部署Kubernetes集群机器需要满足以下几个条件: 一台或多台机器,操作系统 CentOS7.x-86_x64 硬件配置:2GB或更多RAM,2个CPU或更多CPU,硬盘30GB或更多 ...

  2. codeforces 657C - Bear and Contribution [想法题]

    题目链接: http://codeforces.com/problemset/problem/657/C ----------------------------------------------- ...

  3. linux基本目录

    / 根目录: dev : 存放抽象硬件 ib : 存放系统库文件 sbin : 存放特权级二进制文件 var : 存放经常变化的文件 home : 普通用户目录 etc : 存放配置文件目录 /etc ...

  4. fedora23安装php,mysql

    httpd: 他的服务器根: ServerRoot, 是在/etc/httpd. 因为httpd所有的配置文件, 运行文件等都在这里.所以这是他的根. httpd的配置文件: httpd.conf恰好 ...

  5. ubuntu 安装java1.8

    1.进入官网下载页面http://www.oracle.com/technetwork/java/javase/downloads/index.html 2.选择需要的版本,进入下载页面 下载 jdk ...

  6. Golang new() vs make()

    对于Golang的new() 和 make()的用法有些混乱,感觉这篇资料讲解较好,翻译一下,方便学习! 原文地址:http://www.godesignpatterns.com/2014/04/ne ...

  7. 【ABAP系列】SAP ABAP 优化LOOP循环的一点点建议

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[ABAP系列]SAP ABAP 优化LOOP循 ...

  8. 不起眼的vim.转自https://blog.csdn.net/iplayvs2008/article/details/51508599

    如果我的关于这个话题的最新帖子没有提醒到你的话,那我明确地说,我是一个 Vim 的粉丝.所以在你们中的某些人向我扔石头之前,我先向你们展示一系列“鲜为人知的 Vim 命令”.我的意思是,一些你可能以前 ...

  9. IIS下如何配置免费的https

    1.首先我们要取走我们的证书,保存在我们本地的电脑里,然后复制到服务器即可. 2.取走后接下来干嘛?当然是打开文件看看里面有些什么啊.我们找到IIS那个压缩包并解压. 3.解析得到pfx文件,也就是我 ...

  10. MySQL基础和习题强化(完结)

    Mysql 1.     Mysql基础知识 1.1.     Index and table searching of Mysql 1.1.1.     Basic concepts of Mysq ...