Closed BOOMChiefRocka closed 6 years ago
You mention both GitLab Hook Plugin and GitLab plugin. These are two different plugins that provide basically the same functionality. You only need to use one, and I can only help with the GitLab plugin.
To debug this, please attach the config.xml of your job (redact anything sensitive), and also please describe how you have configured the webhook on the GitLab side which is triggering this job. Specifically, I need to know what URL you are using for the webhook.
Hello Omehegan,
First of all thank you for your time and interest.
I have uninstalled the Gitlab Hook Plugin as you adviced. Find attached the config.xml config.xml (2).txt
The webhook I'm using is:
What I expect is to be able to access the value of the field "target_branch" of the json and maybe some more values like the repo URL.
I've been reading all of your documentation and I've tried many different approaches without success.
Regards and thanks in advance.
@BOOMChiefRocka your webhook URL is incorrect. That is the problem. The documentation was not as clear as it could be (I just updated it a bit), but the correct webhook is displayed in the Jenkins job config when you set up the GitLab trigger. It should be something like http://JENKINS_URL/project/yourbuildname
rather than http://JENKINS_URL/job/yourbuildname/build?
etc.
@omehegan
Hello Omehegan,
Thanks for the tip but i'm afraid that this wasn't enough.
Using the following webhook i get a response HTTP 200, that means OK but doesn't trigger the job execution: http://XXX.XXX.XXX.XXX:8080/project/ejemplo_microservicio/build?delay=0sec
Using the following webhook behaves identically: http://XXX.XXX.XXX.XXX:8080/project/ejemplo_microservicio
Regards
First, do not append this build?delay=0sec
or anything to the webhook URL. Please read the docs, the URL is explained pretty clearly now in the README as well as in the config of the plugin. http://XXX.XXX.XXX.XXX:8080/project/ejemplo_microservicio would be correct assuming your job is named ejemplo_microsevicio.
Second, I can see from the config.xml you attached that you have not configured the plugin to trigger your job. That's why nothing is happening. Please read https://github.com/jenkinsci/gitlab-plugin#job-trigger-configuration
Hello Omehegan,
Thank you very much, you were right, after setting up the trigger everything works.
Cheers mate!!
Context
Hello Everyone,
I'm having trouble for weeks now trying to gather variables from the webhook.
I've declared my freestyle project as parametrized and created an empty string variable with the names described on the documentation, e.g. gitlabBranch.
What I was expecting is that, by declaring the git branch as ${gitlabBranch} (I'm using windows btw), I would be able to clone only the branch that the webhook passed.
The output of my Jenkins job is as follows:
=================================================================== Cloning the remote Git repository Cloning repository http://XXX/XXX/XXX.git
I guess that Jenkins decide to work with "develop" but I don't know why it chooses that branch, even when the parameter "gitlabBranch" appears to be empty.
I've been reading for weeks and I'm not able to understand how to get this to work.
Please help and regards in advance.