git & gerrit & shell
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的更多相关文章
- Git Gerrit使用
Git Gerrit 操作都用 git bash操作: 如果想用 cmd 或者 PowerShell,系统环境变量 Path 添加 Git 安装路径,如: C:\Program Files (x86) ...
- git/gerrit的简介
gerrit和git 1.git Git是什么? Git是目前世界上最先进的分布式版本控制系统. SVN是集中式版本控制系统. Git与svn比较 相同:能记录文件的所有更改记录.这样是为了大量更 ...
- Git + Gerrit 操作备忘
Git review 作用 可以用来提交代码审核到Gerrit 安装 使用pip 安装 git-review 插件,执行 sudo -H pip install git-review 使用示例 可以参 ...
- Git Gerrit Repo User Manual
Git Repo Gerrit User Manual Revision History Revision # Description Date Author ...
- git + gerrit push 代码问题
关于refs/for 和 refs/heads: 1. 这个不是git的规则,而是gerrit的规则, 2. Branches, remote-tracking branches, a ...
- Centos 下 Jenkins2.6 + Git + Maven Shell一件部署与备份
使用Jenkins2.6 集成Maven与Git插件做持续集成,同时编写Shell脚本备份与发布(需要稍微知道点Linux/毕竟基于Centos PS:本人Linux也是菜鸡) - 下载Jenkins ...
- Git Gerrit Code Review
Gerrit Code Review | Gerrit Code Reviewhttps://www.gerritcodereview.com/
- Android代码编译环境配置 “Gerrit和Git环境配置”
Gerrit和Git环境配置可以参考<git&gerrit操作指导> 步骤1. 先在Gerrit中创建新的账户: 步骤2. 在新的客户端上生成密钥(可以使用的是生成的公钥): 步骤 ...
- [原创]升级Gerrit的commit-msg,检查git commit时必须填写开发任务编号TaskID
公司使用git+gerrit+jenkins进行持续集成实践,其中gerrit用来进行Code Review.另外我们自己研发了一套敏捷项目管理系统TPM(TeamPlus Management),用 ...
随机推荐
- NSIS打包后无法解压7z资源包的问题
以前产品一直都是好好的.今天突然不行了.找了半天原因,原来发现7Z的压缩属性变成了"LZMA2"了. 要LZMA才行.
- Fragment 基础使用及重叠问题
一 基本使用 Fragment依附于Activity使用,方面我们在一个页面里面切换显示多屏内容. Activity管理Fragment有两种方式,通过FragmentTransacation这个类来 ...
- leetcode 142. 环形链表 II(c++)
给定一个链表,返回链表开始入环的第一个节点. 如果链表无环,则返回 null. 为了表示给定链表中的环,我们使用整数 pos 来表示链表尾连接到链表中的位置(索引从 0 开始). 如果 pos 是 - ...
- java实现多种加密模式的AES算法-总有一种你用的着
https://blog.csdn.net/u013871100/article/details/80100992 AES-128位-无向量-ECB/PKCS7Padding package com. ...
- base64编解码的另外几个版本
#include "crypto/encode/base64.h" static const std::string base64_chars = "ABCDEFGHIJ ...
- vue组件的watch属性
<!doctype html> <html> <head> <meta charset="UTF-8"> <title> ...
- 浅谈WebService开发(一)转
一.什么是WebService: 简单通俗来说,就是企业之间.网站之间通过Internet来访问并使用在线服务,一些数据,由于安全性问题,不能提供数据库给其他单位使用,这时候可以使 用WebSer ...
- Linux的简介安装与简单使用
一: 适合初学者的最佳Linux发行版:Linux Mint 老旧硬件的最佳Linux发行版:Ubuntu MATE 安全行业的最佳Linux发行版:Kali Linux 专属游戏的Linux发行版: ...
- Netty内存池ByteBuf 内存回收
内存池ByteBuf 内存回收: 在前面的章节中我们有提到, 堆外内存是不受JVM 垃圾回收机制控制的, 所以我们分配一块堆外内存进行ByteBuf 操作时, 使用完毕要对对象进行回收, 本节就以Po ...
- hdu-4289.control(最小割 + 拆点)
Control Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Sub ...