elvanja / jenkins-gitlab-hook-plugin

Enables Gitlab web hooks to be used to trigger SMC polling on Gitlab projects
142 stars 81 forks source link

How to disable automatic build in a job #40

Closed junxy closed 9 years ago

junxy commented 10 years ago

If Branches to build fields using variables ( such as: {branches} ) so will always trigger a build.

In fact I was using the Jenkins Dynamic Parameter Plug-in to get the parameters and then build.

So, How to disable automatic build in a single job?

Thanks

elvanja commented 10 years ago

Hi @junxy!

If you need the entire job definition not to be built upon payload from Gitlab, then you can just set "Ignore notify commit" in Git section and the job will never get built on commit.

Also, if you need only commits to a specific branch to be built, you can set up that branch in branch specifier in Git section as well. But, that will prevent building other branches altogether.

But if you need a partial build, for some branches yes and for some not, e.g. yes for master or branches named *_fix, and no for all others, then I am afraid that I don't have a solution. I plan on adding a new feature that will enable such a configuration, but it's not there yet.

junxy commented 10 years ago

Hi @elvanja

I encountered was that last case. Thanks you for your reply.

If Branches to build fields using variables ( such as: prefix/{branches} ) so will always trigger a build. If do not use the variables ( such as: prefix/* ). Is working. But Jenkins Dynamic Parameter will not be available. So, I think we need a new feature to configure the enable. This should be the best solution.

elvanja commented 9 years ago

Hey @junxy, in latest master there is new support for refspec matching. See issue #41.

In upcoming release (from that master) it will be possible to setup refspec to filter out unwanted branches. E.g. if you work in a set of branches prefixed "feature", then you could set the refspec for the job to "+refs/heads/feature:refs/remotes/origin/". This will trigger job build only if the payload comes for e.g. branches "feature", "feature1" etc.

You can even combine multiple refspecs so this servers pretty much as a regex pattern, but in a more "git" way. Hence, there is no need to add this explicit feature. Closing the issue.

junxy commented 9 years ago

@elvanja Got it, and thank you very much!