jenkinsci / jenkinsci/github-branch-source-plugin

[JENKINS-55388] multibranch pipeline deleting history and building unexpectedly

Open
#1,227 13 comments 0 reactions 0 assignees View on GitHub
component:branch-api-plugin component:github-branch-source-plugin component:workflow-multibranch-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
217
Forks
398
Avg merge
30m
Merged PRs (30d)
1

Description

I have a multibranch pipeline setup with a Jenkinsfile. I have a release branch (current-release) that isn't updated very often. Every once in a while, around a month or so, Jenkins decides to delete all of the previous builds of the branch and build the branch again. The build number starts at 1 again.

I checked my repository scan log and it had already turned over since the build, so I don't know what was in there. The most recent build said it started because of branch indexing.

I have "Discard old items" set to 1 days. My understanding this is just for deleting old branches.

I'm using a github repository as my source with push notifications turned on.

In my jenkins stdout/stderr log I see the following. The build occurred at 12:51pm. Could this cleanup possibly have deleted information for the wrong branch?

```
INFO: ALPN callback dropped: SPDY and HTTP/2 are disabled. Is alpn-boot on the boot class path?
Jan 02, 2019 12:33:29 PM jenkins.branch.WorkspaceLocatorImpl getWorkspaceRoot
WARNING: JENKINS-2111 path sanitization ineffective when using legacy Workspace Root Directory ?${ITEM_ROOTDIR}/workspace?; switch to ?${JENKINS_HOME}/workspace/${ITEM_FULL_NAME}? as in JENKINS-8446 / JENKINS-21942
Jan 02, 2019 12:33:32 PM jenkins.branch.WorkspaceLocatorImpl getWorkspaceRoot
WARNING: JENKINS-2111 path sanitization ineffective when using legacy Workspace Root Directory ?${ITEM_ROOTDIR}/workspace?; switch to ?${JENKINS_HOME}/workspace/${ITEM_FULL_NAME}? as in JENKINS-8446 / JENKINS-21942
Jan 02, 2019 12:33:32 PM jenkins.branch.WorkspaceLocatorImpl$Deleter$CleanupTask run
INFO: deleting obsolete workspace C:\Users\fll\jenkins\workspace\SW_issue_675_group-name-location on fll-build
Jan 02, 2019 12:33:32 PM jenkins.branch.MultiBranchProject$BranchIndexing run
INFO: FLL-SW #20190102.123300 branch indexing action completed: SUCCESS in 32 sec
Jan 02, 2019 12:34:09 PM jenkins.branch.WorkspaceLocatorImpl$Deleter$CleanupTask run
INFO: deleting obsolete workspace C:\Users\fll\jenkins\workspace\SW_issue_675_group-name-location@​tmp on fll-build
Jan 02, 2019 12:51:02 PM com.squareup.okhttp.internal.Platform$JdkWithJettyBootPlatform getSelectedProtocol

```

The question is why is my build history getting deleted?

 

---
Originally reported by jpschewe, imported from: multibranch pipeline deleting history and building unexpectedly


  • status: Open
  • priority: Major
  • component(s): branch-api-plugin, github-branch-source-plugin, workflow-multibranch-plugin
  • label(s): pipeline-triaged
  • resolution: Unresolved
  • votes: 22
  • watchers: 20
  • imported: 2025-12-02

Raw content of original issue

I have a multibranch pipeline setup with a Jenkinsfile. I have a release branch (current-release) that isn't updated very often. Every once in a while, around a month or so, Jenkins decides to delete all of the previous builds of the branch and build the branch again. The build number starts at 1 again.

I checked my repository scan log and it had already turned over since the build, so I don't know what was in there. The most recent build said it started because of branch indexing.

I have "Discard old items" set to 1 days. My understanding this is just for deleting old branches.

I'm using a github repository as my source with push notifications turned on.

In my jenkins stdout/stderr log I see the following. The build occurred at 12:51pm. Could this cleanup possibly have deleted information for the wrong branch?



INFO: ALPN callback dropped: SPDY and HTTP/2 are disabled. Is alpn-boot on the boot class path?

Jan 02, 2019 12:33:29 PM jenkins.branch.WorkspaceLocatorImpl getWorkspaceRoot
WARNING: JENKINS-2111 path sanitization ineffective when using legacy Workspace Root Directory ?${ITEM_ROOTDIR}/workspace?; switch to ?${JENKINS_HOME}/workspace/${ITEM_FULL_NAME}? as in JENKINS-8446 / JENKINS-21942
Jan 02, 2019 12:33:32 PM jenkins.branch.WorkspaceLocatorImpl getWorkspaceRoot
WARNING: JENKINS-2111 path sanitization ineffective when using legacy Workspace Root Directory ?${ITEM_ROOTDIR}/workspace?; switch to ?${JENKINS_HOME}/workspace/${ITEM_FULL_NAME}? as in JENKINS-8446 / JENKINS-21942
Jan 02, 2019 12:33:32 PM jenkins.branch.WorkspaceLocatorImpl$Deleter$CleanupTask run
INFO: deleting obsolete workspace C:\Users\fll\jenkins\workspace\SW_issue_675_group-name-location on fll-build
Jan 02, 2019 12:33:32 PM jenkins.branch.MultiBranchProject$BranchIndexing run
INFO: FLL-SW #20190102.123300 branch indexing action completed: SUCCESS in 32 sec
Jan 02, 2019 12:34:09 PM jenkins.branch.WorkspaceLocatorImpl$Deleter$CleanupTask run
INFO: deleting obsolete workspace C:\Users\fll\jenkins\workspace\SW_issue_675_group-name-location@tmp on fll-build
Jan 02, 2019 12:51:02 PM com.squareup.okhttp.internal.Platform$JdkWithJettyBootPlatform getSelectedProtocol


The question is why is my build history getting deleted?

 

environment

```
Jenkins 2.150.1

SLOCCount Plug-in (sloccount): 1.24

PAM Authentication plugin (pam-auth): 1.4

Performance Plugin (performance): 3.14

Task Scanner Plug-in (tasks): 4.53

Timestamper (timestamper): 1.8.10

CVS Plug-in (cvs): 2.14

Javadoc Plugin (javadoc): 1.4

SSH Slaves plugin (ssh-slaves): 1.29.1

Token Macro Plugin (token-macro): 2.5

DRY Plug-in (dry): 3.0.0

FindBugs Plug-in (findbugs): 5.0.0

Mercurial plugin (mercurial): 2.4

Violations plugin (violations): 0.7.11

Email Extension Plugin (email-ext): 2.63

Static Analysis Utilities (analysis-core): 1.95

SSH Agent Plugin (ssh-agent): 1.17

description setter plugin (description-setter): 1.10

GitHub plugin (github): 1.29.3

LDAP Plugin (ldap): 1.20

Xvnc plugin (xvnc): 1.24

Ant Plugin (ant): 1.9

build-name-setter (build-name-setter): 1.6.9

Git plugin (git): 3.9.1

Cobertura Plugin (cobertura): 1.13

Project Description Setter (project-description-setter): 1.2

Cppcheck Plug-in (cppcheck): 1.24

External Monitor Job Type Plugin (external-monitor-job): 1.7

PMD Plug-in (pmd): 4.0.0

Monitoring (monitoring): 1.75.0

SCM API Plugin (scm-api): 2.3.0

Build Timeout (build-timeout): 1.19

Warnings Plug-in (warnings): 5.0.0

JUnit Plugin (junit): 1.26.1

Maven Integration plugin (maven-plugin): 3.2

Mailer Plugin (mailer): 1.22

Credentials Plugin (credentials): 2.1.18

disk-usage plugin (disk-usage): 0.28

SSH Credentials Plugin (ssh-credentials): 1.14

Git client plugin (git-client): 2.7.5

xUnit plugin (xunit): 2.3.1

Pipeline: Input Step (pipeline-input-step): 2.9

Icon Shim Plugin (icon-shim): 2.0.3

Variant Plugin (variant): 1.1

Pipeline: API (workflow-api): 2.33

Docker Commons Plugin (docker-commons): 1.13

JavaScript GUI Lib: ACE Editor bundle plugin (ace-editor): 1.1

Pipeline: Basic Steps (workflow-basic-steps): 2.13

OWASP Markup Formatter Plugin (antisamy-markup-formatter): 1.5

Durable Task Plugin (durable-task): 1.28

Matrix Project Plugin (matrix-project): 1.13

Pipeline: Milestone Step (pipeline-milestone-step): 1.3.1

Pipeline: Declarative (pipeline-model-definition): 1.3.4

JavaScript GUI Lib: jQuery bundles (jQuery and jQuery UI) plugin (jquery-detached): 1.2.1

Pipeline: Nodes and Processes (workflow-durable-task-step): 2.27

bouncycastle API Plugin (bouncycastle-api): 2.17

Branch API Plugin (branch-api): 2.1.2

jQuery plugin (jquery): 1.12.4-0

Pipeline Graph Analysis Plugin (pipeline-graph-analysis): 1.9

GitHub API Plugin (github-api): 1.95

Pipeline: Shared Groovy Libraries (workflow-cps-global-lib): 2.12

Throttle Concurrent Builds Plug-in (throttle-concurrents): 2.0.1

Pipeline: REST API Plugin (pipeline-rest-api): 2.10

Plain Credentials Plugin (plain-credentials): 1.5

JavaScript GUI Lib: Handlebars bundle plugin (handlebars): 1.1.1

JavaScript GUI Lib: Moment.js bundle plugin (momentjs): 1.1.1

Pipeline (workflow-aggregator): 2.6

Structs Plugin (structs): 1.17

Docker Pipeline (docker-workflow): 1.17

Display URL API (display-url-api): 2.3.0

Pipeline: Step API (workflow-step-api): 2.17

Pipeline: Stage Tags Metadata (pipeline-stage-tags-metadata): 1.3.4

Pipeline: Stage View Plugin (pipeline-stage-view): 2.10

Favorite (favorite): 2.3.2

GIT server Plugin (git-server): 1.7

Pipeline: Multibranch (workflow-multibranch): 2.20

Matrix Authorization Strategy Plugin (matrix-auth): 2.3

Pipeline: SCM Step (workflow-scm-step): 2.7

Pipeline: Groovy (workflow-cps): 2.61

Pipeline: Build Step (pipeline-build-step): 2.7

JIRA plugin (jira): 3.0.5

Credentials Binding Plugin (credentials-binding): 1.17

Blue Ocean (blueocean): 1.9.0

Script Security Plugin (script-security): 1.49

Authentication Tokens API Plugin (authentication-tokens): 1.3

Pipeline: Supporting APIs (workflow-support): 2.24

Pipeline: Declarative Agent API (pipeline-model-declarative-agent): 1.1.1

Pipeline: Stage Step (pipeline-stage-step): 2.3

Pipeline: Model API (pipeline-model-api): 1.3.4

MapDB API Plugin (mapdb-api): 1.0.9.0

WMI Windows Agents Plugin (windows-slaves): 1.4

Pipeline: Declarative Extension Points API (pipeline-model-extensions): 1.3.4

Folders Plugin (cloudbees-folder): 6.7

Pipeline: Job (workflow-job): 2.31

Parameterized Trigger plugin (parameterized-trigger): 2.35.2

Common API for Blue Ocean (blueocean-commons): 1.9.0

GitHub Pipeline for Blue Ocean (blueocean-github-pipeline): 1.9.0

Autofavorite for Blue Ocean (blueocean-autofavorite): 1.2.2

REST API for Blue Ocean (blueocean-rest): 1.9.0

Config API for Blue Ocean (blueocean-config): 1.9.0

GitHub Branch Source Plugin (github-branch-source): 2.4.1

Pipeline: Multibranch with defaults (pipeline-multibranch-defaults): 2.0

Run Condition Plugin (run-condition): 1.2

Command Agent Launcher Plugin (command-launcher): 1.2

Config File Provider Plugin (config-file-provider): 3.4.1

REST Implementation for Blue Ocean (blueocean-rest-impl): 1.9.0

Server Sent Events (SSE) Gateway Plugin (sse-gateway): 1.16

Git Pipeline for Blue Ocean (blueocean-git-pipeline): 1.9.0

Dashboard for Blue Ocean (blueocean-dashboard): 1.9.0

JSch dependency plugin (jsch): 0.1.54.2

Pipeline implementation for Blue Ocean (blueocean-pipeline-api-impl): 1.9.0

JDK Tool Plugin (jdk-tool): 1.2

Blue Ocean Pipeline Editor (blueocean-pipeline-editor): 1.9.0

JWT for Blue Ocean (blueocean-jwt): 1.9.0

i18n for Blue Ocean (blueocean-i18n): 1.9.0

Pub-Sub "light" Bus (pubsub-light): 1.12

Bitbucket Branch Source Plugin (cloudbees-bitbucket-branch-source): 2.2.16

JIRA Integration for Blue Ocean (blueocean-jira): 1.9.0

Jackson 2 API Plugin (jackson2-api): 2.9.8

Pipeline SCM API for Blue Ocean (blueocean-pipeline-scm-api): 1.9.0

Display URL for Blue Ocean (blueocean-display-url): 2.2.0

HTML Publisher plugin (htmlpublisher): 1.17

Bitbucket Pipeline for Blue Ocean (blueocean-bitbucket-pipeline): 1.9.0

Pipeline GitHub Notify Step Plugin (pipeline-githubnotify-step): 1.0.4

Conditional BuildStep (conditional-buildstep): 1.3.6

Build Pipeline Plugin (build-pipeline-plugin): 1.5.8

Web for Blue Ocean (blueocean-web): 1.9.0

Personalization for Blue Ocean (blueocean-personalization): 1.9.0

Events API for Blue Ocean (blueocean-events): 1.9.0

Lockable Resources plugin (lockable-resources): 2.3

Code Coverage API Plugin (code-coverage-api): 1.0.5

Blue Ocean Core JS (blueocean-core-js): 1.9.0

Handy Uri Templates 2.x API Plugin (handy-uri-templates-2-api): 2.1.6-1.0

Trilead API Plugin (trilead-api): 1.0.1

Apache HttpComponents Client 4.x API Plugin (apache-httpcomponents-client-4-api): 4.5.5-3.0

Analysis Model API Plug-in (analysis-model-api): 1.0.0

Design Language (jenkins-design-language): 1.9.0

Warnings Next Generation Plugin (warnings-ng): 1.0.0

Mail Watcher Plugin (mail-watcher-plugin): 1.16

Backup plugin (backup): 1.6.1

JavaNCSS plugin (javancss): 1.1

Hudson Locks and Latches plugin (locks-and-latches): 0.6

```

1 attachment

- [ci.png](https://issues.jenkins.io/secure/attachment/45989/ci.png)
> ![ci.png](https://issues.jenkins.io/secure/attachment/45989/ci.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.