Jenkins管道插件:设置构建说明 [英] Jenkins pipeline plugin: set the build description

查看:426
本文介绍了Jenkins管道插件:设置构建说明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试用一个使用Jenkins管道插件并从项目存储库中加载Jenkinsfile的新任务替换当前使用旧版Jenkins作业被黑客入侵的当前构建管道.

I'm trying to replace our current build pipeline, currently hacked together using old-school Jenkins jobs, with a new job that uses the Jenkins pipeline plugin, and loads a Jenkinsfile from the project repository.

旧工作所做的一件事是使用

One thing that the legacy job did was set the build description to include the Mercurial hash, username and current version using the Description setter plugin, so that builds are easy to find.

是否可以使用Jenkins管道插件复制/模拟此行为?

Is there a way to replicate/emulate this behaviour with the Jenkins pipeline plugin?

推荐答案

只需弄清楚就可以了.管道作业公开了具有可写属性的currentBuild全局变量.设置说明可以通过以下方式完成:

Just figured it out. The pipeline job exposes a currentBuild global variable with writable properties. Setting the description can be done with:

currentBuild.description = "my new description"

管道脚本中的任何位置. DZone教程中的更多信息.

anywhere in the pipeline script. More information in this DZone tutorial.

这篇关于Jenkins管道插件:设置构建说明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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