Reputation: 965
We are migrating a set of jobs (concerning the same codebase) to a pipeline. The main reason for the split into multiple jobs was the achieved parallelism and finegrained return-values. The pipeline/Jenkinsfile-approach seems to be a good fit. Some plugins are still missing but all in all we're on a good track.
One of the things that we are missing, is the good naming we had before. Before, each build would get a name like $jobname $buildnumber ($branch)
, which gave us app-spec #42 (new-feature)
. This lead to nice visibility in the jenkins "executor status"-sidebar.
With the pipeline, we only get part of app-pipeline #23
, which forces us to look into the build and determine what is running at any given moment in time.
Is there a way to override the name that is shown in the sidebar?
UPDATE
I mostly want the answer to "what part of the parallelized pipeline is running in that executor".
Upvotes: 28
Views: 1672
Reputation: 6458
Use:
currentBuild.displayName="${JOB_NAME} ${BUILD_NUMBER} (${BRANCH})"
If it a declarative pipeline, you need to wrap it with a script{}:
script
{
currentBuild.displayName="${JOB_NAME} ${BUILD_NUMBER} (${BRANCH})"
}
Upvotes: 2
Reputation: 5321
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:
Upvotes: 7
Reputation: 27476
Try using:
currentBuild.displayName = "My friendly name"
Upvotes: 3