How to remove empty & old jobs from multibranch pipeline?

Hi,

I use multibranch pipeline Discard old items with Days to keep old items: 14

In addition, in my pipeline I have the buildDiscarder option

pipeline {
...
        options {
            timestamps()
            disableConcurrentBuilds()
            ansiColor('xterm')
            timeout(time: 3, unit: 'HOURS')
            buildDiscarder(logRotator(numToKeepStr:'20',daysToKeepStr: '90',artifactDaysToKeepStr: '30',artifactNumToKeepStr: '20'))
        }
...

I can see that I have many jobs with empty items/builds

There is a way to tell the multibranch pipeline to remove empty jobs after X days?

Hi,
Normally, If the branch no longer existed on the repo.
After scanning repo. the job for that branch is deleted by jenkins.
And as I remember we can config time preriod to scanning repo

Hi @daotoan-hd ,
You’re right, if the branch does not exist, the branch will be removed from that list.
In my case, I don’t want to remove my release branches from git.
Instead, I would like to ignore old branches (empty jobs or by time) in Jenkins multibranch pipeline branches listto get lean pages with minimum branches in the list.

@dsaydon90 I’m afraid there is no such feature supported by Jenkins.
On my previous company. We was have 3000+ branch.
And It lagging when open it.
If you want “hide” the build. I have this idea. create a timmer job to remove jenkins file from the old branch. No Jenkinsfile → no display. That might be dumb. But that is the only way I can come up with right now.
Or you could try to exclude old branch (regex pattern) in the setting

I’ve taken the shortcut solution on some of my repositories to remove or rename the Jenkinsfile so that the job is deleted from the Jenkins multibranch Pipeline. If someone needs to bring that branch “back to life”, they revert the commit.