Skip to content

remove duplicate small labels#831

Merged
timja merged 2 commits intojenkinsci:mainfrom
lewisbirks:remove-duplicate-labels
Jun 6, 2025
Merged

remove duplicate small labels#831
timja merged 2 commits intojenkinsci:mainfrom
lewisbirks:remove-duplicate-labels

Conversation

@lewisbirks
Copy link
Contributor

@lewisbirks lewisbirks commented Jun 6, 2025

Fix an issue where duplicate labels (big and small) were added to the graph.

The issue was introduced in #816 by no longer mutating the original stage but instead copying it (via destructuring) and then overriding the required fields.
The fix is done by comparing by stage ids rather than the whole object as these will be static and unique.

Before

image

After

image

Notes

Initially I tried to mutate the original object but that caused a regression in test case returns proper columns (GH#18).

Testing done

The new test pass on this branch and fail on main.
The pipelines used for manual testing are:

Pipeline 1
pipeline {
    agent any

    stages {
        stage('Non-Parallel Stage') {
            steps {
                echo 'Executing Non-Parallel Stage'
            }
        }

        stage('Parallel Stage') {
            parallel {
                stage('Branch A') {
                    steps {
                        echo 'Executing Branch A'
                    }
                }
                stage('Branch B') {
                    steps {
                        echo 'Executing Branch B'
                    }
                }
                stage('Branch C') {
                    stages {
                        stage('Nested 1') {
                            steps {
                                echo 'Executing Nested 1'
                            }
                        }
                        stage('Nested 2') {
                            steps {
                                echo 'Executing Nested 2'
                            }
                        }
                    }
                }
            }
        }

        stage('Skipped stage') {
            steps {
                echo 'Executing Skipped stage'
            }
        }

        stage('Parallel Stage 2') {
            parallel {
                stage('Branch A') {
                    steps {
                        echo 'Executing Branch A'
                    }
                }
                stage('Branch B') {
                    steps {
                        echo 'Executing Branch B'
                    }
                }
                stage('Branch C') {
                    stages {
                        stage('Nested 1') {
                            steps {
                                echo 'Executing Nested 1'
                            }
                        }
                        stage('Nested 2') {
                            steps {
                                echo 'Executing Nested 2'
                            }
                        }
                    }
                }
            }
        }
    }
}
Pipeline 2
pipeline {
    agent any
    
    stages {
        stage('Stage 1') {
            steps {
                echo 'Executing Stage 1'
            }
        }
        
        stage('Stage 2') {
            steps {
                echo 'Executing Stage 2'
            }
        }
        
        stage('Stage6, When anyOf') {
            stages {
                stage('Stage 3') {
                    steps {
                        echo 'Executing Stage 3'
                    }
                }
                
                stage('Parallel') {
                    parallel {
                        stage('Parallel Stage 1') {
                            stages {
                                stage('Parallel Stage 1.1') {
                                    steps {
                                        echo 'Executing Parallel Stage 1.1'
                                    }
                                }
                                stage('Parallel Stage 1.2') {
                                    steps {
                                        echo 'Executing Parallel Stage 1.2'
                                    }
                                }
                            }
                        }
                        
                        stage('Parallel Stage 2') {
                            stages {
                                stage('Parallel Stage 2.1') {
                                    steps {
                                        echo 'Executing Parallel Stage 2.1'
                                    }
                                }
                                stage('Parallel Stage 2.2') {
                                    steps {
                                        echo 'Executing Parallel Stage 2.2'
                                    }
                                }
                            }
                        }
                    }
                }
                
                stage('Stage 4') {
                    stages {
                        stage('Stage 5') {
                            stages {
                                stage('Stage 7') {
                                    steps {
                                        echo 'Executing Stage 7'
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

Signed-off-by: lewisbirks <22620804+lewisbirks@users.noreply.github.com>
@lewisbirks lewisbirks requested a review from a team as a code owner June 6, 2025 12:26
Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@timja timja added the bug Something isn't working label Jun 6, 2025
Signed-off-by: lewisbirks <22620804+lewisbirks@users.noreply.github.com>
@timja timja enabled auto-merge (squash) June 6, 2025 12:38
@timja timja merged commit f1ae3d2 into jenkinsci:main Jun 6, 2025
16 of 17 checks passed
@lewisbirks lewisbirks deleted the remove-duplicate-labels branch June 7, 2025 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants