Google Cloud-Builder how to build all branches except for master

风格不统一 提交于 2020-01-03 02:46:07

问题


I want to be able to build all branches that are not master, however when I try ^((?!master).)*$ the UI correctly shows all non-master branches but saving returns a HTTP 400 error.

{
  "error": {
    "code": 400,
    "message": "trigger_template branch_name is not a valid regular expression",
    "status": "INVALID_ARGUMENT"
  }
}

回答1:


this is stupid ... but works by ignoring everything that starts with "master"

^(?:[^m]|m[^a]|ma[^s]|mas[^t]|mast[^e]|maste[^r]|master.)



回答2:


The regex used must be compatible with Go's regex library, which this one is not. (It is compatible with JavaScript, which is why the UI works with it.) https://regex101.com/ is useful for playing with different language parsers. (A teammate just showed it to me.) Go's regex documentation is on GitHub.



来源:https://stackoverflow.com/questions/44008616/google-cloud-builder-how-to-build-all-branches-except-for-master

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!