Jenkins并行分支名称显示不全,能否调整位置使其完整展示?
Solution: Move Parallel Branch Names to Top of Their Flow
The issue you're facing is that Jenkins displays parallel branch names inline with nested stages, which often leads to truncation for longer names. To fix this, we can wrap each parallel job in a top-level stage using your desired branch name. This will make the name appear as a prominent header above all sub-stages for that branch, ensuring it’s fully visible in the UI.
Here’s the adjusted pipeline code:
def build_jobs = [:] build_jobs['BUILD PROGRAMM1'] = { stage('BUILD PROGRAMM1') { // Top-level stage with full branch name node('node1'){ stage('Clean WS'){ /* Add your logic here */ } stage('GIT'){ /* Add your logic here */ } stage('Build'){ /* Add your logic here */ } } } } build_jobs['BUILD PROGRAMM2'] = { stage('BUILD PROGRAMM2') { // Top-level stage with full branch name node('node1'){ stage('Clean WS'){ /* Add your logic here */ } stage('GIT'){ /* Add your logic here */ } stage('Build'){ /* Add your logic here */ } } } } build_jobs['Basic Checks'] = { stage('Basic Checks') { // Top-level stage with full branch name node('node1'){ stage('Clean WS'){ /* Add your logic here */ } stage('GIT'){ /* Add your logic here */ } stage('Build'){ /* Add your logic here */ } } } } parallel build_jobs
Why this works:
- Jenkins treats each parallel branch as a separate execution path. By adding a top-level stage with your branch name to each path, the UI renders that name as the header for the entire branch’s flow—no more truncation from competing with sub-stage labels.
- This approach keeps your parallel structure intact while prioritizing visibility of branch names.
Quick notes:
- This requires Jenkins 2.222 or newer (when parallel stages were officially supported). If you’re on an older version, upgrading will let you take advantage of this feature.
- You can keep the parallel map keys matching the stage names for consistency, but they don’t strictly need to—though it’s recommended for readability.
内容的提问来源于stack exchange,提问作者Ziv M
相关产品推荐
相关产品推荐

