Add gitlab project id to defined variable
What feature do you want to see added?
Gitlab webhook sends post request that contains "project_id". Currently, this is not mapped to a defined variable. This can be useful when repository are trying to call gitlab's api, for example when uploading generic package.
Upstream changes
No response
Are you interested in contributing this feature?
No response
@mikhatanu , I am interested to solve it. Can you assign me this issue?
Hi @Aditya-PS-05 we do not assign issues but you are welcome to work on this via a PR
@krisstern I have a problem while trying to solve this.
There are originally 2 attributes inside CauseData about this, sourceProjectId and targetProjectId.
There are at least 5 WebHookTriggerHandlers according to the code I read that will assign them, each with its own behavior:
PushHookTriggerHandlerImplassigns both with theproject_idattribute of the hook directly as mentioned in this issue.PipelineHookTriggerHandlerImplassigns both with theproject.idattribute of the hook.MergeRequestHookTriggerHandlerImplassignsourceProjectIdwith theobjectAttributes.sourceProjectIdattribute of the hook andtargetProjectIdwith theobjectAttributes.sourceProjectIdattribute of the hook.NoteHookTriggerHandlerImplassignsourceProjectIdwith themergeRequest.sourceProjectIdattribute of the hook andtargetProjectIdwith themergeRequest.targetProjectIdattribute of the hook.OpenMergeRequestPushHookTriggerHandlerassignsourceProjectIdwith the project ID of the opened MR andtargetProjectIdwith the "project_id" attribute of the hook.
I believe that CauseData can use one of sourceProjectId and targetProjectId as its value directly without having to change any other logic. The problem is, which one should it be? Otherwise, another projectId attribute in the CauseData can be created, but that doesn't solve the problem because it's still uncertain what value should be given since not eveny WebHook extension has a projectId attribute to be required.