Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not find project for composite branch names #2

Closed
Isammoc opened this issue Dec 5, 2012 · 12 comments
Closed

Do not find project for composite branch names #2

Isammoc opened this issue Dec 5, 2012 · 12 comments
Labels

Comments

@Isammoc
Copy link

Isammoc commented Dec 5, 2012

Hi,

First, thanks for this usefull plugin.
But I have a small issue.

I configured Jenkins with git plugin to build several branches pattern :

  • gitlab/story/*
  • gitlab/bug/*
  • gitlab/dev
    (gitlab is the name of my repo)

When I trigger build with a remote trigger (or manually), all run fine .
But when I use gitlab hook, only fully specified branches are built like gitlab/dev

In log :

Dec 5, 2012 2:27:41 PM sun.reflect.GeneratedMethodAccessor549 invoke
INFO: gitlab web hook triggered for repo url http://gitlab.example.com/myproject
Dec 5, 2012 2:27:41 PM sun.reflect.GeneratedMethodAccessor579 invoke
WARNING: no project references the given repo url and commit branch

(url is manually changed)

@elvanja
Copy link
Owner

elvanja commented Dec 5, 2012

Hi, glad you use it :-)

Funny thing, I did test multilevel / composite branch names, especially since I use gitflow. But, I did notice you are probably using version 0.1.1. And this is entirely my fault. I committed the code to mine and Jenkins fork, but didn't release the plugin.

So, just did that. You should be seeing version 0.2.0 in your Jenkins plugin update center, and if not (it takes time to propagate), you can find it @ jenkins repo.

Before we go on, please use that updated version. In log, there should be some more info, e.g.

INFO: gitlab web hook triggered for repo url http://gitlab.example.com/myproject
INFO: with payload: ... here comes the payload from gitlab, you can delete sensitive data

Please send me this info.
It should be enough for me to be able to figure out the cause.

@Isammoc
Copy link
Author

Isammoc commented Dec 6, 2012

Thanks for replying,

You're right, I'm using version 0.1.1.
No update is available for now, I'm waiting for propagation and will come back then.

@Isammoc
Copy link
Author

Isammoc commented Dec 6, 2012

Ok, I'm on version 0.2.0 now.

I created a new branch story/test and push it to gitlab

Here the jenkins log :

INFO: gitlab web hook triggered for repo url http://gitlab.example.com/myproject and test branch
INFO: with payload: {"before"=>"0000000000000000000000000000000000000000", "after"=>"3e213054239ede90231239a41a4308bbf51df0a4", "ref"=>"refs/heads/story/test", "user_id"=>14, "user_name"=>"Me ****", "repository"=>{"name"=>"myproject", "url"=>"http://gitlab.example.com/myproject", "description"=>nil, "homepage"=>"http://gitlab.example.com/myproject"}, "commits"=>[{"id"=>"3e213054239ede90231239a41a4308bbf51df0a4", "message"=>"Dummy test 1", "timestamp"=>"2012-12-06T11:25:31+01:00", "url"=>"http://gitlab.dev.example.com/myproject/commits/3e213054239ede90231239a41a4308bbf51df0a4", "author"=>{"name"=>"Me ****", "email"=>"me@example.com"}}], "total_commits_count"=>1}
INFO: project build-webapp doesn't match the test branch
WARNING: no project references the given repo url and commit branch

(urls, names and mails manually changed)

I expected to see story/test instead of test in the first line. Maube this is the issue ?

@elvanja
Copy link
Owner

elvanja commented Dec 6, 2012

Yes, you are right, I've been using only the last in payload["ref"].split("/").
Wait for a fix...

@Isammoc
Copy link
Author

Isammoc commented Dec 6, 2012

I can't test my fix (and I am not used to code in ruby), but I think something like this could be fix the issue :

  def get_commit_branch(payload)
    payload["ref"].split("/")[2..-1].join("/") if payload && payload["ref"]
  end

in models/gitlab_web_hook_api.rb (lines 115-117)

@elvanja elvanja closed this as completed Dec 6, 2012
@elvanja elvanja reopened this Dec 6, 2012
@elvanja
Copy link
Owner

elvanja commented Dec 6, 2012

Excellent, I wrote it a bit different, to ensure the intent is clear (removing head and ref from the entire path). I can't release from here but the update will be available later today. Let me know how it goes after you try it.

@Isammoc
Copy link
Author

Isammoc commented Dec 6, 2012

Thanks,
I cannot wait to see this working ^^

@elvanja
Copy link
Owner

elvanja commented Dec 6, 2012

OK, so the new version 0.2.3 is up with another fix.
It should now accept branches like refactoring-what-not.
If you're impatient, you can find it here. Fingers crossed :-)

@Isammoc
Copy link
Author

Isammoc commented Dec 7, 2012

INFO: gitlab web hook triggered for repo url http://gitlab.example.com/myproject and story/test branch
INFO: with payload: {"before"=>"3e213054239ede90231239a41a4308bbf51df0a4", "after"=>"04a609729d97f803f084695909a2751ec2172b9e", "ref"=>"refs/heads/story/test", "user_id"=>14, "user_name"=>"Me **********", "repository"=>{"name"=>"myproject", "url"=>"http://gitlab.example.com/myproject", "description"=>nil, "homepage"=>"http://gitlab.example.com/myproject"}, "commits"=>[{"id"=>"04a609729d97f803f084695909a2751ec2172b9e", "message"=>"Dummy test 5", "timestamp"=>"2012-12-07T15:59:28+01:00", "url"=>"http://gitlab.example.com/myproject/commits/04a609729d97f803f084695909a2751ec2172b9e", "author"=>{"name"=>"Me ********", "email"=>"me@example.com"}}], "total_commits_count"=>1}
INFO: project build-webapp matches the story/test branch
INFO: project build-webapp doesn't match the master branch
INFO: project build-webapp doesn't match the ** branch
WARNING: could not determine master project, please create a project for the repo (usually for the master branch)

My job is not triggered :'(

@elvanja
Copy link
Owner

elvanja commented Dec 7, 2012

Yep, residue from another feature I am building (automatic Jenkins project creating per Gitlab branch).
Switched it off, should work now. New version @ jenkins repo, and please test as usual :-)

@Isammoc
Copy link
Author

Isammoc commented Dec 10, 2012

Tried this morning.
Job is well triggered ^^

Thanks a lot.

@Isammoc Isammoc closed this as completed Dec 10, 2012
@elvanja
Copy link
Owner

elvanja commented Dec 10, 2012

Great :-)

elvanja added a commit that referenced this issue May 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants