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

Folder computation / branch indexing can unexpectedly delete things when bitbucket goes down

XMLWordPrintable

      We use bitbucket server (former known as stash) to internally host a bunch of repos.

      We have a number of "Bitbucket Team/Project" items set up. These map one to one with bitbucket server projects, and each one scans all of the repos (and their branches), looking for Jenkinsfiles and creating subitems for each repo (and branch). It also deletes branches (and I assume repos) when the branches and repos go away. This is all pretty sweet.

      Then our Bitbucket Server "went down" (the JVM locked up) and we kicked it to get it fired back up. We found that almost all of the corresponding entities (repos and branches) had been deleted from our jenkins instance. We suspect that the repos that were not deleted were preserved because they were building in Jenkins at the time of the Bitbucket Server outage.

      One of the negative outcomes from this is that all of our repos have been re-created in jenkins and the branches are starting with build 1. This isn't cool because we use the BUILD_TAG environment variable to uniquely identity build artifacts in various artifact repositories. So now our builds are all failing because jenkins-blah-master-1 "is already taken" and so on.

      I'm not sure this would happen whenever Bitbucket server goes offline (I hope not), so I didn't mark this critical.

      Under the configuration for our "Bitbucket Team/Project" items, we have "Discard old items" checked under "Orphaned Item Strategy". "Days to keep old items" was set to 2 and "Max # of old items to keep" was set to 0. I'm not sure what either of these mean, since branches seem to be deleted from jenkins immediately when they are deleted from source control. We've updated "Max # of old items to keep" to 2, hoping that this might help avert a similar disaster in the future, but have no evidence that it would.

            amuniz Antonio Muñiz
            kburnett Kevin Burnett
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: