如果提交消息以给定的字符串开头,则忽略Jenkins作业 [英] Ignore Jenkins job if commit message starts with a given string

查看:92
本文介绍了如果提交消息以给定的字符串开头,则忽略Jenkins作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果提交消息以给定的字符串开头,我想忽略运行Jenkins作业.我尝试添加其他行为"和轮询忽略某些消息的提交":

I want to ignore running a Jenkins job if the commit message starts with a given string. I've tried adding "Additional Behaviours" and "Polling ignores commits with certain messages":

即如果提交消息以"doc!"开头,我想忽略该作业(在我的世界中这意味着不要运行该作业).我已经尝试了几个在线正则表达式匹配器,并且我认为^doc!.*的正则表达式是正确的.但是,即使我的提交消息确实以"doc!"开头.这项工作由詹金斯(Jenkins)执行.我在做什么错了?

I.e. I want to ignore the job (which in my world means don't run the job) if the commit message starts with "doc!". I've tried several online regex matchers and I think that the regex of ^doc!.* is correct. But even though my commit messages does start with "doc!" the job is executed by Jenkins. What am I doing wrong?

推荐答案

如果我将正则表达式更改为:@ devanshu-dwivedi的答案可能行得通,那么我的方法似乎也行得通.

While @devanshu-dwivedi's answer might work my approach seem to work as well if I change my regex to:

(?s)^doc!.*

我不完全知道为什么会这样.该文档说,使用(?s)会检查提交消息中的多个注释行.但是如果不使用(?s),即使是单行提交消息的单次提交,它对我也不起作用.

I don't exactly know why this is the case. The documentation says that using (?s) checks multiple comment lines in the commit messages. But without using (?s) it don't work for me even for single commits with a one line commit message.

这篇关于如果提交消息以给定的字符串开头,则忽略Jenkins作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆