Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

wrong Cloud Build trigger is activated from GitLab merge web hook

Hi ALL,

Working on usage of GitLab web hooks for activating Cloud Build triggers. Problem that I'm facing is that my web hook to push trigger is working fine,  but merge trigger is never started, instead push trigger is activated. On GitLab side web hook URLs are different and pointing to right trigger URLs.

While trying to troubleshoot has following: when using dummy build trigger that has inline default step ( ubuntu image to run echo hello world) it works fine, when I'm adding Substitution vars getting an error:

Your build failed to run: generic::invalid_argument: generic::invalid_argument: invalid value for 'build.substitutions': key in the template "URL" is not a valid built-in substitution
 
_URL is using $(body.project.git_ssh_url), which in accordance to doc should be fine for Merge request event , so it could mean that there is a difference on event type. 
 
Please advise or suggest direction for debugging.
 
Best,
Alex

 

0 5 1,018
5 REPLIES 5

Have you taken a look at this documentation? You should also check this document about Substituting variable values. This tutorial could be helpful.

Hi Osvaldo,

Thanks for answering.
Yes, I've looked into documentation and substitution part as well. As for tutorial, I've not looked into it yet.

But your answers are general and I'm not sure if you understand that what I'm asking is pretty specific: I have a push trigger web hook working well, so all general conditions are met; what is not working is using another MR web hook that should activate another MR trigger but activating push trigger  instead. 

Point is that on GitLab  side both web hooks have different  URLs and ( I assume that ) they should not activate wrong trigger.

So still question that I want to be asked: how to debug such problem. What I need is to catch on Builder side events related to this specific web hook request.

And again I've used both clone of push trigger and new trigger build from scratch. and having the same results.

Thanks for helping.

Alex

 

For debugging purposes, as suggested in this post, you can try with pipedream. You can also take a look at this Stackoverflow post. Finally I recommend you to check this troubleshooting guide if you haven't already done so.

Hello, thanks for answering.

Per my further exploration by trying to use payload_bindings  I found following:

for push event I can use $(body.ref) and can see it inside build script

But if I in accordance with reference pushevent  trying to use  $(push.push_id) for push

getting error unable to fetch payload for push

or similar for pullrequestevent   $(pull_request.action) for merge I got error

unable to fetch payload for pull_request.

So per my understanding: payload of GCP  Build Trigger differs from either GitLab or GitHub specs and I'm asking for reference to real spec. Is any public repository with trigger code available?

Best,Alex

 

 

 


 

Please provide detailed information, the steps to replicate your issue, and any other relevant documentation you have checked and you might haven’t shared yet. On the other hand, please let me know if you have already taken a look at this information and if it helps you. Apparently, your issue is from the GitLab side, but please also let me know if you’re having any issues from the Google Cloud Build side.