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

multibranch pipeline deleting history and building unexpectedly

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major

      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?

       

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

          jpschewe created issue -
          Andrew Bayer made changes -
          Component/s New: branch-api-plugin [ 18621 ]
          Component/s New: workflow-multibranch-plugin [ 21465 ]
          Component/s Original: pipeline [ 21692 ]
          Hai Nguyen made changes -
          Attachment New: ci.png [ 45989 ]

          Hai Nguyen added a comment -

          I had the same bug too, I don't remember the multi branch plugin version at the first time I saw this bug, but that's when I'm using Blue Ocean 1.0.0, and now, I'm using Blue Ocean 1.7.0 and this one is still happening. 

          This morning, all my repositories and all branches in each repository are starting again from build #1, all at the same time, all history is also deleted. This is not the first time I have this problem. Usually this happens when I change my configuration (like only build branches that match my wildcard), but also so many times it starts building unexpectedly like now.

          Hai Nguyen added a comment - I had the same bug too, I don't remember the multi branch plugin version at the first time I saw this bug, but that's when I'm using Blue Ocean 1.0.0, and now, I'm using Blue Ocean 1.7.0 and this one is still happening.  This morning, all my repositories and all branches in each repository are starting again from build #1, all at the same time, all history is also deleted. This is not the first time I have this problem. Usually this happens when I change my configuration (like only build branches that match my wildcard), but also so many times it starts building unexpectedly like now.
          Vivek Pandey made changes -
          Labels New: pipeline-triaged

          jpschewe added a comment -

          I just had a build do this again. I looked at the scan repository log and it said no changes for the branch. However it could be that the scanning happened after the build started. Is there some logging I can turn on to see the results of all scans over time and catch the error?

          jpschewe added a comment - I just had a build do this again. I looked at the scan repository log and it said no changes for the branch. However it could be that the scanning happened after the build started. Is there some logging I can turn on to see the results of all scans over time and catch the error?

          steve nolen added a comment -

          we are also seeing this happen randomly among multibranch pipeline builds as well. For branches where we make use of the build history, it can be extremely frustrating to restore/recover.

          steve nolen added a comment - we are also seeing this happen randomly among multibranch pipeline builds as well. For branches where we make use of the build history, it can be extremely frustrating to restore/recover.

          jpschewe added a comment -

          I found a clue. I've been capturing the git index log and found a message in the log just before the the branch was rebuilt.

          [Mon Jun 03 10:39:07 EDT 2019] Finished branch indexing. Indexing took 7.5 sec
          Evaluating orphaned items in FLL-SW
          Will remove current-release as it is too old
          Finished: SUCCESS
           

           

          What is this message about the branch being too old? I want the branch jobs to stay around forever, unless the branch is deleted.

           

          jpschewe added a comment - I found a clue. I've been capturing the git index log and found a message in the log just before the the branch was rebuilt. [Mon Jun 03 10:39:07 EDT 2019] Finished branch indexing. Indexing took 7.5 sec Evaluating orphaned items in FLL-SW Will remove current-release as it is too old Finished: SUCCESS   What is this message about the branch being too old? I want the branch jobs to stay around forever, unless the branch is deleted.  

          jpschewe added a comment -

          I'm using the github plugin for the source. For the others seeing this issue are you also using the github plugin for the source?

          jpschewe added a comment - I'm using the github plugin for the source. For the others seeing this issue are you also using the github plugin for the source?

          jpschewe added a comment -

          More information. Found something else that is odd.

          On scan shows

              Checking branch current-release
                ‘Jenkinsfile’ found
              Met criteria
          No changes detected: current-release (still at d79cc62c7dc3e036229e8bd1adc5a8aab7f9aa57)
          

          The next scan shows

              Checking branch current-release
                ‘Jenkinsfile’ not found
              Does not meet criteria
          

          and this is the one that also says at the bottom that current-release is being removed.

           

          I haven't made any changes to the current release branch and it does in fact have a Jenkinsfile as can be seen by the next scan that says

              Checking branch current-release
                ‘Jenkinsfile’ found
              Met criteria
          Scheduled build for branch: current-release 

          The repository for this Jenkins job is at https://github.com/jpschewe/fll-sw/

          The last commit was February 4, 2019. This particular reset of the history was on June 3, 2019. I think I've had a reset between those two dates, but not since I started monitoring the scan log in May.

           

          jpschewe added a comment - More information. Found something else that is odd. On scan shows Checking branch current-release ‘Jenkinsfile’ found Met criteria No changes detected: current-release (still at d79cc62c7dc3e036229e8bd1adc5a8aab7f9aa57) The next scan shows Checking branch current-release ‘Jenkinsfile’ not found Does not meet criteria and this is the one that also says at the bottom that current-release is being removed.   I haven't made any changes to the current release branch and it does in fact have a Jenkinsfile as can be seen by the next scan that says Checking branch current-release ‘Jenkinsfile’ found Met criteria Scheduled build for branch: current-release The repository for this Jenkins job is at https://github.com/jpschewe/fll-sw/ The last commit was February 4, 2019. This particular reset of the history was on June 3, 2019. I think I've had a reset between those two dates, but not since I started monitoring the scan log in May.  

            Unassigned Unassigned
            jpschewe jpschewe
            Votes:
            22 Vote for this issue
            Watchers:
            20 Start watching this issue

              Created:
              Updated: