-
Bug
-
Resolution: Fixed
-
Major
-
Replicated on 2.19.2 and 2.190.3
How was this detected?
Branches in multibranch pipelines for projects hosted in GitLab.com started randomly appearing and disappearing (i.e. random results after every scan).
What's causing it?
We have discovered this issue by accident due to a bug in GitLab (https://gitlab.com/gitlab-org/gitlab/issues/37059) which causes the calls to /api/v*/projects/*/branches to return status code 500.
The gitlab-branch-source-plugin unfortunately handles the exceptions which are thrown during the scan incorrectly. The exceptions are ignored and only the stacktrace is printed into the output.
Because of this, Jenkins is not aware that the scan has failed and treats the empty list of branches and merge requests as successful result and thinks all the branches and MRs have been deleted from the repository.
How to fix this?
- Throw the exception out of the method as one of the exception types which are declared by the inherited method contract (e.g. IOException)
- Given how reliable GitLab APIs are (based on our experience over the last ~6 months as a paying customer...), retry logic should mitigate most of these issues.