Git Product home page Git Product logo

Comments (18)

elvanja avatar elvanja commented on September 23, 2024

Hello :-)
I don't have this option in my build parameters. Maybe it comes from another Jenkins plugin?
Also, the whole idea behind this hook plugin was to avoid having to define polling or scheduling at all.

Maybe I could add this as a feature "skip Gitlab hook processing for this project", but that is another problem - I haven't figured out how to add project build parameters to it's configuration in a Ruby plugin. So, unfortunately, there is nothing I can do at this time.

The current situation is that project will get build by hook trigger if branch specification matches the payload from commit. I suppose this Jenkins job is on the same Gitlab project as the other, so you can't really detach it?
If so, don't really see how this can be solved at this time.

Maybe you could create a separate branch, that you can merge changes into with some cron job, and then the hook would trigger the Jenkins build. Just a half baked idea...

from jenkins-gitlab-hook-plugin.

Isammoc avatar Isammoc commented on September 23, 2024

Indeed, I have not this option in the old jenkins I used...

I see it's a new option in 1.493
Changelog
Dedicated JIRA

I agree with the whole idea for some jobs (almost all)... But the one I would like to not be triggered by the plugin is building manual test environment (integration) and pull down the environment for half an hour.

I guess I can manually update local repo (shell build step) instead of using git SCM plugin for that job.

But your idea of "skip Gitlab hook processing for this project" feature would be awesome ^^

Or a better idea would be do the opposite : "Enable Gitlab hook to process for this project", as opt-in (rather than opt-out)

from jenkins-gitlab-hook-plugin.

Isammoc avatar Isammoc commented on September 23, 2024

Here is the commit from the subversion plugin.
jenkinsci/subversion-plugin@2de66bb

I don't know if you can do something like this in ruby

from jenkins-gitlab-hook-plugin.

elvanja avatar elvanja commented on September 23, 2024

Just remembered, Git SCM plugin has a setting: Ignore this repository during notify commit (in Advanced options).
If this is checked for a project, then this plugin will not trigger the build even if branches match.
In effect this should do what you are asking.

As for this new thing, I believe it will be doable once Git SCM plugin supports this feature. So, when they update that plugin, I'll definitely refresh this one too (it seems reasonable that they'll just refactor the same option to work with Jenkins definition instead their own, so maybe no changes will actually be needed here).

Let me know how it goes with this option checked.

from jenkins-gitlab-hook-plugin.

Isammoc avatar Isammoc commented on September 23, 2024

I have just tested checking the "Ignore this repository during notify commit", but the job is unexpectedly triggered...

INFO: gitlab web hook triggered for repo url http://gitlab.example.com/myproject and dev branch
INFO: with payload: {"before"=>"db128bc5f79b620d784858135768ffd8005c99f2", "after"=>"47a3cb9db9f63c412f5c9d26d513040e3fa2543f", "ref"=>"refs/heads/dev", "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"=>"355754fe0269634879b207755dab37124f97f692", "message"=>"Dummy test 11", "timestamp"=>"2012-12-11T11:23:54+01:00", "url"=>"http://gitlab.example.com/myproject/commits/355754fe0269634879b207755dab37124f97f692", "author"=>{"name"=>"Me", "email"=>"[email protected]"}}, {"id"=>"47a3cb9db9f63c412f5c9d26d513040e3fa2543f", "message"=>"Another message", "timestamp"=>"2012-12-11T13:46:46+01:00", "url"=>"http://gitlab.example.com/myproject/commits/47a3cb9db9f63c412f5c9d26d513040e3fa2543f", "author"=>{"name"=>"Me", "email"=>"[email protected]"}}], "total_commits_count"=>2}
INFO: project build-webapp matches the dev branch
INFO: project Integration matches the dev branch
INFO: build-webapp scheduled for build
Integration scheduled for build

build-webapp is triggered as expected
but Integration should not be triggered cause of the "Ignore this repository during notify commit" option checked.

Perhaps the matches_repo_uri_and_branch? method should use notify_commit method or directly is_ignoring_notify_commit? in models/gitlab_project.rb, shouldn't it ?

from jenkins-gitlab-hook-plugin.

elvanja avatar elvanja commented on September 23, 2024

Yes, the reason is that you are using build_now hook.
It skips this option: https://github.com/elvanja/jenkins-gitlab-hook-plugin/blob/master/models/gitlab_project.rb#L39
So, if you set the hook on Gitlab to notify_commit, then it would behave as described. Can you try it? If it works (should) maybe I can change the behavior and use that option in both hooks.

from jenkins-gitlab-hook-plugin.

Isammoc avatar Isammoc commented on September 23, 2024

Changed to notify_commit

INFO: gitlab web hook triggered for repo url http://gitlab.example.com/myproject and dev branch
INFO: with payload: {"before"=>"47a3cb9db9f63c412f5c9d26d513040e3fa2543f", "after"=>"bb36c1bad617d8ad6ff19d944515f4a03d0fa370", "ref"=>"refs/heads/dev", "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"=>"b3d8c20b9971a021e4a0e78a8ce9965dd2a78aaf", "message"=>"Commit message", "timestamp"=>"2012-12-11T11:59:35+01:00", "url"=>"http://gitlab.example.com/myproject/commits/b3d8c20b9971a021e4a0e78a8ce9965dd2a78aaf", "author"=>{"name"=>"Me", "email"=>"[email protected]"}}, {"id"=>"febd19cddca43a27afed037ca81e240b1b7db4de", "message"=>"Another message", "timestamp"=>"2012-12-11T14:49:16+01:00", "url"=>"http://gitlab.example.com/myproject/commits/febd19cddca43a27afed037ca81e240b1b7db4de", "author"=>{"name"=>"Me", "email"=>"[email protected]"}}, {"id"=>"bb36c1bad617d8ad6ff19d944515f4a03d0fa370", "message"=>"Yet another message", "timestamp"=>"2012-12-11T15:00:35+01:00", "url"=>"http://gitlab.example.com/myproject/commits/bb36c1bad617d8ad6ff19d944515f4a03d0fa370", "author"=>{"name"=>"Me", "email"=>"[email protected]"}}], "total_commits_count"=>3}
INFO: project build-webapp matches the dev branch
INFO: project Integration matches the dev branch
INFO: build-webapp could not be scheduled for polling, it is disabled or has no SCM trigger
Integration is configured to ignore notify commit, skipping scheduling for polling

I guess, it's a correct behaviour.

from jenkins-gitlab-hook-plugin.

elvanja avatar elvanja commented on September 23, 2024

So Integration is skipped now, that is OK.
As for build-webapp, with notify commit I call "Poll SCM" action on the project.
This is something you can trigger in Jenkins UI (on the project page).
If polling works on UI, it should here too (maybe you are missing the polling schedule, which has to be set to something, e.g. once a year).
If this doesn't work for you, I can enable the check both for notify commit and build now hook.
It makes sense.

from jenkins-gitlab-hook-plugin.

Isammoc avatar Isammoc commented on September 23, 2024

It would be great if this is enable both for notify_commit and build_now.
I will try as soon as possible for polling once a year for my build-webapp job.

from jenkins-gitlab-hook-plugin.

elvanja avatar elvanja commented on September 23, 2024

OK, added.
Latest release should take that flag into account.

from jenkins-gitlab-hook-plugin.

Isammoc avatar Isammoc commented on September 23, 2024

Great !
Working like a charm !

Thanks ^^

from jenkins-gitlab-hook-plugin.

elvanja avatar elvanja commented on September 23, 2024

Glad to help :-)

from jenkins-gitlab-hook-plugin.

gkiko avatar gkiko commented on September 23, 2024

Hi @elvanja thanks for your project.
I've been struggling to make the plugin work for several hours until I saw your comment here

maybe you are missing the polling schedule, which has to be set to something, e.g. once a year

Maybe you should indicate this step in README

from jenkins-gitlab-hook-plugin.

elvanja avatar elvanja commented on September 23, 2024

@gkiko The entire idea of this plugin is to avoid setting polling schedule at all (hence, this is not mentioned in documentation). The comment you found was related to the fact that @Isammoc wanted the job to be skipped by this plugin but still build on regular intervals or manually. So, everything should work if you set the job not to be scheduled at all. At least that is my usage of the plugin. Maybe your case is a bit different. More details would help.

from jenkins-gitlab-hook-plugin.

gkiko avatar gkiko commented on September 23, 2024

This is my working setup. Do I need to change something?
setup

from jenkins-gitlab-hook-plugin.

elvanja avatar elvanja commented on September 23, 2024

Hey, it seems to me this is not this plugin at all.
There is another Gitlab plugin I think, maybe you got the wrong address?

from jenkins-gitlab-hook-plugin.

gkiko avatar gkiko commented on September 23, 2024

Sorry for the late reply.
Is that the correct plugin?
jk

These are other gitlab plugins installed. The layout in previous post was generated by enabling the last plugin. The first two does not affect anything.

EDIT
I think I made it work without checking polling option. Thanks anyway

from jenkins-gitlab-hook-plugin.

elvanja avatar elvanja commented on September 23, 2024

OK, so you've got this plugin enabled in plugins. But, this plugin has no job configuration available. And it certainly does not support merge requests. So, as I said, I am sure you are struggling with some other plugin.

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.