28

我们正在将一组作业(涉及相同的代码库)迁移到管道。拆分为多个作业的主要原因是实现了并行性和细粒度的返回值。管道/Jenkinsfile 方法似乎很合适。仍然缺少一些插件,但总而言之,我们走上了良好的轨道。

我们缺少的一件事是我们之前的良好命名。以前,每个构建都会有一个类似 的名称$jobname $buildnumber ($branch),这给了我们app-spec #42 (new-feature). 这导致在詹金斯“执行者状态”侧边栏中有很好的可见性。

使用管道,我们只得到part of app-pipeline #23,这迫使我们查看构建并确定在任何给定时刻正在运行的内容。

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

更新

我最想知道“并行化管道的哪一部分在该执行程序中运行”。

4

3 回答 3

7

Put a stage('name'){} block in each parallel entry. The name of the stage will appear in the executor status. So name your stages whatever you want to see in the status.

Note, the "part of ..." label will still show in the build queue, but executor status will show correctly.

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

The executor will show

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

EDIT: I ran a test pipeline that is simulating a multiconfig job with 3 axes: OS, JDK Fruit. Each branch of the config combinations runs in parallel and has a named branch. The executor status indicates each combination running:

enter image description here

于 2017-10-19T07:03:30.453 回答
3

尝试使用:

currentBuild.displayName = "My friendly name"
于 2016-07-02T07:16:13.663 回答
2

利用:

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

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

script
{
    currentBuild.displayName="${JOB_NAME} ${BUILD_NUMBER} (${BRANCH})"
}
于 2017-10-24T12:41:26.313 回答