Content
Bug STC-652: Community contribution: GitHub/GitLab - Fix incorrect linking of MR/PR to work packages
View differences
Updated by Kabiru Mwenja 4 days ago
Ref: https://github.com/opf/openproject/pull/21932
### Steps to reproduce
Reproduces with the GitLab integration (the GitHub integration shows the same class **As** a \[enter role of mislinking): user\]
**I want to** \[enter objective\]
**so that** \[enter desired result\]
1. Connect **two** GitLab repositories (*Repo A* **Acceptance criteria**
* <br>
**Technical notes**
* <br>
**Permissions and *Repo B*) to the same OpenProject instance.
2. In *Repo A*, open merge request `!5` referencing a work package, e.g. `OP#100`.
3. In *Repo B*, open merge request `!5` (GitLab numbers merge requests per project, so visibility considerations**
* _To whom is this feature visible?_
* _When is also `!5`) referencing a different work package, e.g. `OP#200`.
4. Let both `merge_request` webhooks reach OpenProject. it not visible?_
**Translation considerations**
### What is the buggy behavior?
A webhook for *Repo B*'s `!5` matches * _Key terms and overwrites the record created for *Repo A*'s `!5`, because the lookup matches on the per-project merge request number (GitLab's internal ID, `iid`), which is `5` phrases in both repositories. Work packages then link to a merge request from the wrong repository — e.g. `#100` shows *Repo B*'s merge request — and the link flips back and forth as each repository's webhooks arrive. The same affects issues, pipelines and comments. There is no error; the linking is silently wrong. key languages_
**Out of scope**
### What is the expected behavior?
Each merge request, pull request and issue is identified by its unique webhook URL rather than a number that repeats across repositories. *Repo A*'s `!5` links only * <br>
_Set the_ **To be informed/consulted teams** _field to `#100`, *Repo B*'s `!5` links only include all teams necessary to `#200`, and pipelines/comments attach to the correct repository's record.
### Environment
Server-side bug in the GitHub/GitLab integration modules — independent be informed of installation type, browser, OS and language. Present in all current versions whenever more than one repository is connected; reproduced on the latest `dev`.
changes._
### Steps to reproduce
Reproduces with the GitLab integration (the GitHub integration shows the same class
**I want to** \[enter objective\]
**so that** \[enter desired result\]
1. Connect **two** GitLab repositories (*Repo A*
* <br>
**Technical notes**
* <br>
**Permissions
2. In *Repo A*, open merge request `!5` referencing a work package, e.g. `OP#100`.
3. In *Repo B*, open merge request `!5` (GitLab numbers merge requests per project, so
* _To whom is
* _When
4. Let both `merge_request` webhooks reach OpenProject.
**Translation considerations**
### What is the buggy behavior?
A webhook for *Repo B*'s `!5` matches
**Out of scope**
### What is the expected behavior?
Each merge request, pull request and issue is identified by its unique webhook URL rather than a number that repeats across repositories. *Repo A*'s `!5` links only
_Set the_ **To be informed/consulted teams** _field
### Environment
Server-side bug in the GitHub/GitLab integration modules — independent