Continuous Integration

Give Jenkins builds a description to keep the pipeline…

— Nesha Zoric

Short answer: The Jenkins build description is a short HTML string attached to each build in the build history. Set it from a pipeline with currentBuild.description = '...'. Useful patterns: branch + PR number, trigger reason, deploy target, failing test name, feature flag state. The limitations are real — plain HTML, no templating, no structure. If you need more, use build annotations in Buildkite or Ruby.ci, or badge annotations in GitHub Actions.

A string of HTML markup attached to each build in a job’s build history is called a Jenkins build description. The item visible in the UI next to the build number is referred to as the label. If you do not specify this option, then your history appears just #42, #43, #44. Which is no good. If the CI config is set appropriately, one can easily pinpoint at a glance which build broke which deploy, which build was triggered by which chaos test, and which build built the artifact that is in production right now.

If you’re authoring a Jenkins pipeline and want to make the build history useful, this post is for you. We’ll look at the Groovy snippets that actually work, five patterns that cut debug time in half, the limitations (there are many), and when to migrate to a richer alternative like Buildkite annotations or Ruby.ci’s build metadata.

Ruby.ci is a self-hosted CI platform that integrates seamlessly with Jenkins, GitHub Actions, Buildkite, and GitLab. We say so twice: earlier and later.

What the build description is

Jenkins terminology.

  • Each job has a description (set in the job configuration UI).
  • Each build of that job has its own description, settable at pipeline runtime.
  • The build description renders as HTML in the build history list and on the build detail page.
  • There is also a build display name — the thing that shows as #42 by default — settable the same way.

The display name replaces the text “#42”, while the description adds a sentence next to it. Utilize both.

The Groovy snippet that works

The original design for a Jenkins pipeline that’s declarative or scripted.

Scripting pipeline.

node { stage('describe') { currentBuild.description = "deploy to prod from main" currentBuild.displayName = "#" + env.BUILD_NUMBER + " · " + env.BRANCH_NAME } }

Expression pipeline.

pipeline { agent any stages { stage('describe') { steps { script { currentBuild.description = "deploy to prod from main" currentBuild.displayName = "#${env.BUILD_NUMBER} · ${env.BRANCH_NAME}" } } } // ... } }

Three points to keep in mind.

  • The field is settable at any point in the pipeline. You can set a provisional description at the start and overwrite it after a stage succeeds or fails.
  • HTML is allowed. You can put links, bold text, colour spans. Keep it minimal; the UI is narrow.
  • The field is persisted. It survives Jenkins restarts, is included in currentBuild.getRawBuild(), and is exposed via the REST API at /job/<name>/<build>/api/json.

For a detailed guide on the shape of Jenkins pipelines, check out ci-cd-with-jenkins.

Five patterns that cut debug time

Descriptive adjectives. Each line consists of a single Groovy command.

1. Branch and PR number

"build #42" is visible as default history. It shows "build #42 • main • PR 1234" when usefull history. Display name set on entry

currentBuild.displayName = "#${env.BUILD_NUMBER} · ${env.BRANCH_NAME}" currentBuild.description = env.CHANGE_ID ? "PR #${env.CHANGE_ID}: ${env.CHANGE_TITLE}" : "no PR (direct push)"

You can know about the pull request and branch for which this build is crated. You can scroll rather than click-through if someone asks “which build was the one that broke prod?

2. Trigger reason

What caused this build to initiate push, pull request, scheduled task, manual action, chaos test or hotfix? Prefixing the description field with the reason for triggering the incident makes post-mortems easier.

def cause = currentBuild.getBuildCauses() currentBuild.description = "triggered by: ${cause[0]?.shortDescription ?: 'unknown'}"

The API getBuildCauses() returns a List of causes: upstreamBuild, user, timer and SCM push. When is the best time to shop?

3. Deploy target

When the pipeline executes a deploy, incorporate the target in the designation.

def target = params.DEPLOY_TARGET ?: "none" currentBuild.description = "deploy target: ${target}" if (target == "prod") { currentBuild.displayName = "#${env.BUILD_NUMBER} 🚀 PROD" }

When you examine the history of a job, it is apparent that production deployments are easily noticeable while the staging deployments do not catch your eye. Refer to deployment automation for the general deploy pattern.

4. Failing test name on failure

Assign a placeholder description at the entrance that can be overwritten if the outcome is a failure.

currentBuild.description = "pending" // ... pipeline runs ... post { failure { script { def firstFail = sh(script: "head -1 test-results/failures.txt", returnStdout: true).trim() currentBuild.description = "failed: ${firstFail}" } success { currentBuild.description = "green" } } }

The build failed: UserBillingSpec#test_annual_discount in history instantly gives away the diagnosis without clicking in. If your test setup outputs JUnit XML, parse that instead of grepping it.

5. Artifact fingerprint

The fingerprint may be carried by a description when the build produces a docker image or a jar.

currentBuild.description = "image: ${imageTag} · sha: ${env.GIT_COMMIT.substring(0, 8)}"

The history transforms into a miniature artifact log. The question "Which build generated the image currently running in production?" can be answered with a scroll rather than a cross-reference.

Refer to build artifact definition for accompanying artifact lineage patterns.

The limitations (and they are real)

The Jenkins build description has three real pain points.

Plain HTML, no structure

The description consists of a string. Key-value pairs cannot be nested. Filtering builds by field is impossible. Querying is not supported for selects. The records of data do not exist, it lives in a UI.

Length is unlimited but UI truncates

Jenkins will retain descriptions 10,000 characters long. The history page shows a truncated version with ~120 characters. Lengthy explanations impede readability. Maximum one line and under 80 characters is practical limit.

XSS risk

If you connect user input to the description (branch names, PR titles, commit messages) you have an injection vector. Some HTML is escaped while others are not by Jenkins. Utilize org.jenkinsci.plugins.html.HtmlStringUtil or clean up manually. The Jenkins security guidance encompasses this.

No parallel-build semantics

You have a race condition if a pipeline executes parallel branches that wish to update the description. The last writer wins in a non-deterministic way. Sequentially apply description updates or implement a lock. Click on jenkins concurrent builds for the wider concurrency pattern.

Alternatives when you outgrow it

The build details have an outdated user experience. By 2026, there are many options.

Buildkite annotations

With Buildkite, you can create and update structured annotations from within your builds. They are essentially markdown blocks that stick to the top of your build page, letting you use styling, images, and expandable sections. You are able to execute buildkite-agent annotate from any stage. Supports incident post-mortems and deployment manifests in a manner that's not possible with Jenkins descriptions. Refer to alternatives to Jenkins for complete comparison.

GitHub Actions step summaries

You can output Markdown to the GITHUB_STEP_SUMMARY file at any step of your job in GitHub Actions to render a pane summarizing your job. It is structured but not as rich as Buildkite’s annotations. Refer github self hosted runners for the operational context.

GitLab CI job metadata

Using GitLab’s $CI_JOB_URL and job trace API can help you set metadata on the merge request. More elaborate than Jenkins descriptions yet lighter than Buildkite annotations.

Ruby.ci build metadata

Our product sends build metadata in a dedicated field. These key-value pairs you set directly in the pipeline are filterable in the UI and queryable via an API. The key features in that map include the build description, deploy target trigger reason, and artifact fingerprint. The schema can be found in Ruby.ci documentation.

When to invest in build description polish

A build description offers low-effort, high-leverage polish. The time you invest to set a useful description pays you back the very first time a 2am incident needs scanning a build history. Situations Where It’s Overkill.

  • A one-off script with a one-off job. Default #42 is fine.
  • A pipeline you plan to retire in a quarter.
  • A pipeline nobody looks at. If no human reads the history, do not decorate the history.

The flip side is, if your Jenkins instance has 50+ jobs, if your incident post-mortems reference one or more builds, if you have ever asked “which build is this?” spending an hour on this trade is likely worth it.

A short glossary

  • Build description — short HTML string attached to a specific build run.
  • Build display name — the text that replaces "#42" in the UI.
  • currentBuild — the Jenkins pipeline variable representing the running build.
  • Job description — the longer description attached to the job itself, not a specific build.
  • Build cause — the trigger reason (upstream build, user, SCM push, timer).
  • Annotation — Buildkite's structured alternative to a flat description string.
  • Step summary — GitHub Actions' structured alternative to a flat description string.

Check what-is-jenkins-used-for for more information on Jenkins.

Frequently asked

What is the Jenkins build description?

Each build's job build history contains one short HTML string. Update it from a pipeline using currentBuild.description = '...'. When it's empty, teams' build histories are harder to scan; better builders set it well.

How do I set the build description in a Jenkinsfile?

To define the description in a declarative pipeline wrap it in a script block as in the following. script { currentBuild.description = “deploy to prod” } To do this in a scripted pipeline use the syntax: currentBuild.description = "deploy to prod" where deploy to prod can be any string value.

How do I change the display name of a build?

You set the same way you set the description currentBuild.displayName. The default “#42” can be replaced via the display name. Utilize both features - the display name for a quick label, and the description for the context.

Can I use HTML in the build description?

Of course. The description is rendered as HTML by Jenkins. Keep it short, the UI truncates at around 120 characters in the history. If you combine strings provided by users, beware of XSS risk.

Is the build description queryable via API?

Indeed, it is but just a string. The description field is exposed by /job/<name>/<build>/api/json. Builds cannot be filtered by substructure in the description because it has no substructure it is a string.

What are the alternatives to Jenkins build description?

GitLab CI job metadata, GitHub Actions step summaries (GITHUB_STEP_SUMMARY Markdown), Ruby.ci build metadata (key-value pairs), and Buildkite annotations (structured Markdown blocks). All descriptions in 2026 that are richer than Jenkins

Does the build description support emojis?

Absolutely, HTML supports emoji rendering. Whether you ought to is a style question At Ruby.ci our style is text, not emoji a build description that scans at a glance is better than one that is decked out.

Still stuck

If at a glance your Jenkins builds show you the branch you’re on, the PR number, the deploy target and the failure reason, you’re doing ok. Keep the Groovy snippets for later review if pipeline changes.

This means that if you run into limits with what's possible in the Jenkins description you want structured metadata, parallel-safe updates, queryable fields you swap the runner, not the pipeline file. Jenkins runner offered by Ruby.ci comprehends the same Jenkinsfile and shows richer UI build metadata. Just drop it in and compare. Our service won't be suitable for you if our metadata does not help you ship faster.