Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-76023

Add support to disable individual branch jobs in Multibranch Pipeline projects.

XMLWordPrintable

      Description:
      In Multibranch Pipeline projects, branch jobs are automatically managed by Jenkins through the Branch API. Currently, there is no way to selectively disable a branch job in the GUI (or persistently via API). Users can only:

      • Remove branches from indexing via filters (wildcards, build strategies).
      • Add conditional logic in Jenkinsfile to skip builds.
      • Delete branches or rely on SCM clean-up.

      This makes it difficult to archive or temporarily disable specific branches while preserving their history.

      Proposal:
      Introduce the ability to disable/enable individual branch jobs in a Multibranch Pipeline, similar to Freestyle or standalone Pipeline jobs.

      Acceptance Criteria:

      • A “Disable Project” action is available on each branch job page.
      • Disabled branch jobs are marked in the Jenkins UI (e.g., greyed out, labelled “disabled”).
      • A disabled branch job will not trigger automatically, nor accept manual builds.
      • The disabled state persists across branch indexing/re-scans.
      • REST/API endpoints support /disable and /enable for branch jobs.

      Advantages:

      • ✅ Provides fine-grained control over which branches should build.
      • ✅ Preserves build history and logs while stopping future builds.
      • ✅ Avoids SCM changes (no need to edit Jenkinsfile to skip).
      • ✅ Useful for archiving release or feature branches.
      • ✅ Reduces unnecessary CI/CD load for obsolete branches.

      Disadvantages / Considerations:

      • ⚠️ Conflicts slightly with Branch API philosophy (automatic job management).
      • ⚠️ Requires persistence of disabled state across SCM indexing.
      • ⚠️ Needs careful handling of Job.Configure permissions to prevent misuse.
      • ⚠️ May create user confusion if disabled branches remain visible but unbuildable.

      Use Cases:

      • A team wants to archive release-1.0 but keep build logs, without deleting it.
      • Temporarily disabling noisy branches that are causing build queue congestion.
      • Selectively disabling legacy branches while continuing to build active ones.

            aytuncbeken Aytunc BEKEN
            maduka14 Maduka Ariyasiri
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: