groovy 从“refs/heads/cli_test”中提取cli_test

nkkqxpd9  于 2022-11-28  发布在  其他
关注(0)|答案(1)|浏览(110)

我在jenkins中使用了通用的webhook,我的webhook只需要基于提交。webhook发送给json的是“refs/heads/cli_test”。我想使用groovy脚本在jenkins中只提取分支名称,即cli_test

6yt4nkrj

6yt4nkrj1#

我们可以使用minus函数删除字符串中不需要的内容。

BRANCH = "refs/heads/cli_test"
String branch = BRANCH.minus("refs/heads/")

相关问题