Git Product home page Git Product logo

Comments (12)

elvanja avatar elvanja commented on September 23, 2024

Hi, I haven't tried it with namespaced repos.
Could you send the payload? It is probably a payload parsing error, but I can't replicate it so your payload would be helpful. Thanks!

from jenkins-gitlab-hook-plugin.

lanwin avatar lanwin commented on September 23, 2024

Not so easy. Ive testet this by invoking the url directly and via test hook from gitlab. The latest one dose nothing the first one reports this error.

from jenkins-gitlab-hook-plugin.

elvanja avatar elvanja commented on September 23, 2024

OK, I just tried with namespaced projects and it seems to be working.

One note though, when you have a namespaced project on gitlab, it will change it's repo url.
E.g.:

  • previously: [email protected]:project.git
  • namespaced in some group: [email protected]:group/project.git
    So, when putting projects in groups, you'll effectively change the repo url, the project group is added to it.

Hence, you need to update your Jenkins git repo url to reflect the change.
After that, I believe the hook plugin will have no problems triggering the build.

Regarding invoking the hook url directly (e.g. in browser), the message you get is the result of invalid invoke url. To invoke manually you need to add repo_url or just url params. Without them the plugin assumes payload will be sent, and it is not there, hence the error.

Please let me know if this change of repo url was the cause.

from jenkins-gitlab-hook-plugin.

lanwin avatar lanwin commented on September 23, 2024

Right. But I did both. Changed the URL in Jenkins and changed the trigger to reflect the new URL. I also called the build new url with the right git url.

https://jenkins/gitlab/[email protected]:foo/barr.git

from jenkins-gitlab-hook-plugin.

elvanja avatar elvanja commented on September 23, 2024

What version of the plugin are you using?
Also, what version of git plugin are you using?

from jenkins-gitlab-hook-plugin.

elvanja avatar elvanja commented on September 23, 2024

I've upgraded Jenkins to 1.497 and the plugin versions are:

  • Git plugin - 1.1.26
  • Hook plugin - 0.2.5

Tried it a couple more times and hook trigger with payload seems to be working.

Even with direct URL access I get "no project references the given repo url and commit branch".
The direct URL is a bit questionable since I can't pass in the branch to build, hence the message, but there is no exception definitely.

Unless you can show me the payload, I really don't know how to help you further.
I never encountered a situation where logging would not be available so the best I can guess is that the plugin is not operational at all. Maybe more resources is needed for Jenkins? Or maybe a restart for Jenkins and/or Gitlab?

from jenkins-gitlab-hook-plugin.

lanwin avatar lanwin commented on September 23, 2024

I have the same version installed. Do you have a hint how to get the payload in an easy way?

from jenkins-gitlab-hook-plugin.

elvanja avatar elvanja commented on September 23, 2024

See the last paragraph in project readme, about logging. You should be able to add a logger for "Class" and see payloads there.

from jenkins-gitlab-hook-plugin.

lanwin avatar lanwin commented on September 23, 2024

Hmm ive turned that on. But the only thing I got (via test hook and manuel) is:

07.01.2013 15:28:28 sun.reflect.NativeMethodAccessorImpl invoke0
SCHWERWIEGEND: undefined method `[]' for nil:NilClass

07.01.2013 15:28:28 sun.reflect.GeneratedMethodAccessor591 invoke
INFO: project Foo.Bar matches the branch

07.01.2013 15:28:28 sun.reflect.GeneratedMethodAccessor591 invoke
INFO: with payload: N/A

07.01.2013 15:28:28 sun.reflect.GeneratedMethodAccessor591 invoke
INFO: gitlab web hook triggered for repo url [email protected]:foo/bar.git and branch

07.01.2013 15:27:35 sun.reflect.NativeMethodAccessorImpl invoke0
SCHWERWIEGEND: undefined method `[]' for nil:NilClass

07.01.2013 15:27:35 sun.reflect.GeneratedMethodAccessor591 invoke
INFO: project Foo.Bar matches the branch

07.01.2013 15:27:35 sun.reflect.GeneratedMethodAccessor591 invoke
INFO: with payload: N/A

07.01.2013 15:27:35 sun.reflect.GeneratedMethodAccessor591 invoke
INFO: gitlab web hook triggered for repo url [email protected]:foo/bar.git and branch

07.01.2013 15:27:30 sun.reflect.NativeMethodAccessorImpl invoke0
SCHWERWIEGEND: undefined method `[]' for nil:NilClass

07.01.2013 15:27:30 sun.reflect.GeneratedMethodAccessor591 invoke
INFO: project Foo.Bar matches the branch

07.01.2013 15:27:30 sun.reflect.GeneratedMethodAccessor591 invoke
INFO: with payload: N/A

07.01.2013 15:27:30 sun.reflect.GeneratedMethodAccessor591 invoke
INFO: gitlab web hook triggered for repo url [email protected]:foo/bar.git and branch

from jenkins-gitlab-hook-plugin.

elvanja avatar elvanja commented on September 23, 2024

INFO: gitlab web hook triggered for repo url [email protected]:foo/bar.git and branch

This would imply that the hook was triggered without branch information,
It should say something like

INFO: gitlab web hook triggered for repo url [email protected]:foo/bar.git and _master_ branch

Also, what is confusing is this:

INFO: project Foo.Bar matches the branch

If it really matches a branch, it should say something like

INFO: project Foo.Bar matches the _master_ branch

Is it possible that you have a commit in your project with some strange branch name?
Could you try it on some other project?
If not, maybe you can send me some more details about the repo, e.g. latest commit branch name, so I can reproduce the situation.
Also, would you mind writing which plugin version are you using, and which Git plugin version are you using too?

from jenkins-gitlab-hook-plugin.

lanwin avatar lanwin commented on September 23, 2024

I have the same versions as you

Jenkins to 1.497
Git plugin - 1.1.26
Hook plugin - 0.2.5

It seems that the test hook function dose not supply any branch informations.

Tested another project with the same result.

And there is currently only one branch called "master". There where other branches before. But non with strange name.

Can it be a problem that we run Jenkins on Windows?

from jenkins-gitlab-hook-plugin.

elvanja avatar elvanja commented on September 23, 2024

Well, the setup is the same.
That version is used of plugin is used in production Jenkins on Windows, with Gitlab 3.x and I tested with Jenkins on Linux and Gitlab 4.x (all stable releases). It parses namespaced and non namespaced projects normally.

I really need the payload information to help you further.

If I may suggest, I'd try the following:

  • restart Jenkins, Gitlab
  • try with a real push to Gitlab repo - change something trivial, or maybe create a new branch, manual hook tests might generate invalid payload
  • use some other http client to test payload that you know is correct

For the last item you can use http://restclient.net/ within Firefox or Chrome.
Just point it to http://your.jenkins/gitlab/build_now with POST method and a payload similar to the one below.
Of course, replace the repository/url and ref information (those two are used to identify Jenkins project to build) to match your Jenkins project.

{
  "before":"30070086872660c5b579ca5b75e5853de8945939",
  "after":"b9b1f7ea6845921a6f432c42ee59bf6304d4249c",
  "ref":"refs/heads/master",
  "user_id":2,
  "user_name":"Mr. Bean",
  "repository":{
    "name":"project",
    "url":"[email protected]:group/project.git",
    "description":null,"homepage":"http://git.domain.local/group/project"
  },
  "commits":[
    {
      "id":"f4fd4032554db28087e212e8defa341125f1b2a6",
      "message":"a change is born",
      "timestamp":"2012-09-28T14:44:59+02:00",
      "url":"http://git.domain.local/group/project/commits/f4fd4032554db28087e212e8defa341125f1b2a6",
      "author":{
        "name":"Mr. Bean",
        "email":"[email protected]"
      }
    }
  ],
  "total_commits_count":1
}

If you manage to get a build to run, then Gitlab is sending something fishy. You'll need to sniff out what exactly, maybe using Wireshark or similar.

If you manage to reproduce the exception, at least you'll be able to send me the payload that causes the exception, and we'll take it from there.

from jenkins-gitlab-hook-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.