Correctly set issue title to origin's project name when using custom issue tracker
Summary
When custom issue trackers are configured, issue-bot was intended to set the issue title prefix to the name of the project where the failure occurred.
However, we were mistakenly using the issueTrackerClient
to get the
name of the project using the issue ID, which isn't the correct logic
whether that project is on the same instance or a separate one.
For example: "Project A" creates issues in custom issue tracker on "Project B". If a pipeline in "Project A" fails, it will create an issue in "Project B" with the title:
"[Project A] [CI] Pipeline failed <etc...>"
Testing
Setup
-
- Created Project A
-
- Created Project B
-
- Created access token with
api
scope and added to project A asISSUE_BOT_API_TOKEN
- Created access token with
-
- Added Project B's project ID to Project A as
ISSUE_TRACKER_PROJECT_ID
- Added Project B's project ID to Project A as
-
- Created CI file in Project A
Result
Pipeline in Project A created https://gitlab.com/mnielsen/project-b/-/issues/1 with the correct prefix ([Project A]
).
Edited by Mitchell Nielsen