如何覆盖 "part of app-pipeline" buildname?

How can I override the "part of app-pipeline" buildname?

我们正在将一组作业(关于相同的代码库)迁移到管道。拆分成多个作业的主要原因是实现了并行性和细粒度 return 值。 pipeline/Jenkinsfile-approach 似乎很合适。一些插件仍然缺失,但总的来说我们进展顺利。

我们缺少的一件事是我们以前的好命名。以前,每个构建都会有一个像 $jobname $buildnumber ($branch) 这样的名称,这给了我们 app-spec #42 (new-feature)。这导致在 jenkins "executor status"-sidebar 中有很好的可见性。

通过管道,我们只能得到 part of app-pipeline #23,这迫使我们在任何给定时刻查看构建并确定什么是 运行。

有没有办法覆盖边栏中显示的名称?

更新

我主要想要 "what part of the parallelized pipeline is running in that executor" 的答案。

尝试使用:

currentBuild.displayName = "My friendly name"

在每个并行条目中放置一个 stage('name'){} 块。阶段的名称将出现在执行者状态中。因此,无论您想在状态中看到什么,都可以为您的阶段命名。

请注意,"part of ..." 标签仍​​会显示在构建队列中,但执行程序状态会正确显示。

parallel (
    'newOne': { stage('new-feature'){ //all the things } },
    'second': { stage('second branch'){ //all the things } },
    'third': { stage('third branch'){ //all the things } },
)  

执行者会显示

jobname #nnn (new-feature) 
jobname #nnn (second branch)
jobname #nnn (third branch)

编辑:我运行一个模拟3轴多配置作业的测试管道:OS,JDK水果。配置组合的每个 b运行ch 并行运行,并有一个命名的 b运行ch。执行者状态表示每个组合 运行:

使用:

currentBuild.displayName="${JOB_NAME} ${BUILD_NUMBER} (${BRANCH})"

如果它是声明式管道,您需要用脚本包装它{}:

script
{
    currentBuild.displayName="${JOB_NAME} ${BUILD_NUMBER} (${BRANCH})"
}