[JIRA] (JENKINS-60304) Branches and merge requests disappear when calls to GitLab fail

8 views
Skip to first unread message

jenkins@lholota.com (JIRA)

unread,
Nov 27, 2019, 8:03:03 AM11/27/19
to jenkinsc...@googlegroups.com
Lukas Holota created an issue
 
Jenkins / Bug JENKINS-60304
Branches and merge requests disappear when calls to GitLab fail
Issue Type: Bug Bug
Assignee: Parichay Barpanda
Components: gitlab-branch-source-plugin
Created: 2019-11-27 13:02
Environment: Replicated on 2.19.2 and 2.190.3
Labels: plugin gitlab
Priority: Major Major
Reporter: Lukas Holota

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.

Line in code: https://github.com/jenkinsci/gitlab-branch-source-plugin/blob/master/src/main/java/io/jenkins/plugins/gitlabbranchsource/GitLabSCMSource.java#L537

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.

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

jenkins@lholota.com (JIRA)

unread,
Nov 27, 2019, 8:07:02 AM11/27/19
to jenkinsc...@googlegroups.com

redeamer@gmx.net (JIRA)

unread,
Apr 29, 2020, 5:08:03 AM4/29/20
to jenkinsc...@googlegroups.com

We now git the issue a few times already, and all our build history is lost again, including the build numbers. Manual restoration is time consuming and bothersome.

A simply updated of our gitlab instance (with a maintenance reboot) triggers the issue. Jenkins would need to be stopped before gitlab is updated.

I added a new PR, which solely addresses this issue (without retry as !63 does): https://github.com/jenkinsci/gitlab-branch-source-plugin/pull/88

This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo

redeamer@gmx.net (JIRA)

unread,
Apr 29, 2020, 5:10:02 AM4/29/20
to jenkinsc...@googlegroups.com
Michael Musenbrock edited a comment on Bug JENKINS-60304
We now git the issue a few times already, and all our build history is lost again, including the build numbers. Manual restoration is time consuming and bothersome.

A simply updated of our gitlab instance (with a maintenance reboot) triggers the issue. Jenkins would need to be stopped before gitlab is updated.

I added a new PR, which solely addresses this issue (without retry as ! # 63 does): [ https://github.com/jenkinsci/gitlab-branch-source-plugin/pull/88 ]

redeamer@gmx.net (JIRA)

unread,
Apr 29, 2020, 5:12:02 AM4/29/20
to jenkinsc...@googlegroups.com
Michael Musenbrock edited a comment on Bug JENKINS-60304
We now git the issue a few times already, and all our build history is lost again, including the build numbers. Manual restoration is time consuming and bothersome.

A simply updated of our gitlab instance (with a maintenance reboot) triggers the issue. Jenkins would need to be stopped before gitlab is updated.

I added a new PR, which solely addresses this issue (without retry as [ #63 |https://github.com/jenkinsci/gitlab-branch-source-plugin/pull/63] does): [ #88| https://github.com/jenkinsci/gitlab-branch-source-plugin/pull/88]
Reply all
Reply to author
Forward
0 new messages