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

查看:31
本文介绍了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.

遗留工作所做的一件事是使用 Description setter 插件,这样构建很容易找到.

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天全站免登陆