elvanja / jenkins-gitlab-hook-plugin Goto Github PK
View Code? Open in Web Editor NEWEnables Gitlab web hooks to be used to trigger SMC polling on Gitlab projects
Enables Gitlab web hooks to be used to trigger SMC polling on Gitlab projects
When running tests with rspec v3, 22 failures similar to the following occur:
rspec ./spec/values/project_spec.rb:55 # GitlabWebHook::Project when determining if matches repository url and branch it is not matching when it is not buildable
In rspec v3 be_true is renamed to be_truthy and be_false to be_falsey (no change in functionality). Renaming the corresponding examples solves this issue.
The following job configuration setting in a job has no effect. Build are still triggered by the hooks (even with the "Ignore post-commit hooks" checkbox enabled).
Sometimes, you need to configure multiple jobs on a same Git repository managed by GitLab. Some jobs need to be triggered by the GitLab Hook Plugin, fine... But other jobs only need to be launched by other triggered.
I tried with build_now and notify_commit, with the same result: "Ignore post-commit hooks" has no effect.
Is that possible to make the Jenkins GitLab Hook Plugin compatible with this Jenkins "Ignore Hook" fetaure ?
I use:
This plugin fulfills almost all the requirements except one - is there a way to show build status of a Jenkins job triggered as a result of a merge request or a push?
This is extremely important for us as just running jobs in Jenkins is not the complete solution for most.
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)
Hi, I've configured a web hook within GitLab (v6.9.0) to fire after a MR has been opened, however I get a BadRequestException. The log contains the following warning:
WARNING: repo url not found in Gitlab payload or the HTTP parameters {},{"object_kind":"merge_request","object_attributes":{...
The job is therefore not triggered. Any help possible? If you need more information, let me know.
Hello guys,
I have 2 build jobs for the same repository.
The first build job is triggered by a gitlab webhook. It works as expected.
The 2nd is a nightly build and should not started by the webhook.
Is there a possibility to skip/ignore a job?
Thanks for your help
Stefan
here is the error I am getting whenever I run a web hook form gitlab
TypeError - cannot convert instance of class org.jruby.RubyException to class java.lang.Throwable:
org/jruby/RubyMethod.java:130:in call' /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/models/api.rb:53:in
process_projects'
/var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/models/api.rb:30:in POST /build_now' org/jruby/RubyMethod.java:118:in
call'
/var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/sinatra-1.3.3/lib/sinatra/base.rb:1265:in compile!' org/jruby/RubyProc.java:249:in
call'
/var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/sinatra-1.3.3/lib/sinatra/base.rb:835:in route!' /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/sinatra-1.3.3/lib/sinatra/base.rb:851:in
route_eval'
/var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/sinatra-1.3.3/lib/sinatra/base.rb:835:in route!' /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/sinatra-1.3.3/lib/sinatra/base.rb:872:in
process_route'
org/jruby/RubyKernel.java:1174:in catch' /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/sinatra-1.3.3/lib/sinatra/base.rb:870:in
process_route'
/var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/sinatra-1.3.3/lib/sinatra/base.rb:834:in route!' org/jruby/RubyArray.java:1613:in
each'
/var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/sinatra-1.3.3/lib/sinatra/base.rb:833:in route!' /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/sinatra-1.3.3/lib/sinatra/base.rb:936:in
dispatch!'
/var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/sinatra-1.3.3/lib/sinatra/base.rb:769:in call!' /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/sinatra-1.3.3/lib/sinatra/base.rb:921:in
invoke'
org/jruby/RubyKernel.java:1174:in catch' /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/sinatra-1.3.3/lib/sinatra/base.rb:921:in
invoke'
/var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/sinatra-1.3.3/lib/sinatra/base.rb:769:in call!' /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/sinatra-1.3.3/lib/sinatra/base.rb:755:in
call'
/var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/rack-protection-1.2.0/lib/rack/protection/xss_header.rb:22:in call' /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/rack-protection-1.2.0/lib/rack/protection/path_traversal.rb:16:in
call'
/var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/rack-protection-1.2.0/lib/rack/protection/json_csrf.rb:17:in call' /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/rack-protection-1.2.0/lib/rack/protection/base.rb:47:in
call'
/var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/rack-protection-1.2.0/lib/rack/protection/xss_header.rb:22:in call' /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/rack-1.4.1/lib/rack/nulllogger.rb:9:in
call'
/var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/rack-1.4.1/lib/rack/head.rb:9:in call' /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/sinatra-1.3.3/lib/sinatra/showexceptions.rb:21:in
call'
/var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/sinatra-1.3.3/lib/sinatra/base.rb:99:in call' /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/models/root_action.rb:16:in
call'
file:/var/lib/jenkins/plugins/ruby-runtime/WEB-INF/lib/jruby-rack-1.1.13.1.jar!/rack/handler/servlet.rb:22:in `call'
I recently tried to turn on the automatic project copy mode. But I always get the error message that it can't find the master project. But if I push to master it finds the project for the master branch and starts building it. Is there more documentation how I have to setup the git repository in my master jenkins job so the plugin can find it?
In my jenkins server (Azure VM), in Configure Global Security I have Role-Based Strategy security configurated :
In my Gitlab server (another azure VM) I installed this plugin.
When I push into repository, nothing happens on jenkins.
I think thats is because my jenkins blocking for anonimous users, so gitlab can't post into jenkins;
That's is true?
http://{{JENKINS_SERVER_URL}}/gitlab/buildnow
I created tabs in Jenkins to organise my projects but build_now only seems to work for projects that are not in a tab, i.e
Jenkins > Project A [works]
Jenkins > Project Group > Project B [does not work]
Hi
I am having this issue .
https://issues.jenkins-ci.org/browse/JENKINS-24232
I clone the master and trying to build but it is failing . I am not a ruby guy so having troubles.
bundle install
jpi build
running above commands give me this
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:126:in require': cannot load such file -- java (LoadError) from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:126:in
require'
from /Library/Ruby/Gems/2.0.0/gems/jpi-0.4.0/lib/jenkins/plugin/tools/bundle.rb:12:in install' from /Library/Ruby/Gems/2.0.0/gems/jpi-0.4.0/lib/jenkins/plugin/tools/package.rb:23:in
build'
from /Library/Ruby/Gems/2.0.0/gems/jpi-0.4.0/lib/jenkins/plugin/cli.rb:35:in build' from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/command.rb:27:in
run'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in invoke_command' from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor.rb:359:in
dispatch'
from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/base.rb:440:in start' from /Library/Ruby/Gems/2.0.0/gems/jpi-0.4.0/bin/jpi:6:in
<top (required)>'
from /usr/bin/jpi:23:in load' from /usr/bin/jpi:23:in
Any help would be appreciated.
I'm a real nitpicker, and this doesn't really matter - I'm just glad I can hook, but if in future this may be cleaned up a bit I'd be even happier.
This is what I see when it triggers a build via GitLab commit:
"Started by remote host git.majornoob.com with note:
triggered by push on branch refs/heads/bleeding
with 1 commits:
* Modify README"
It doesn't parse the HTML, and also uses the entire branch name which isn't quite necessary (but also NOT a problem.) I'm mostly worried about it not parsing the HTML.
I know this isn't related to this but the pre reqs require it so I am not sure if I am missing something or doing it wrong...
This is what I get:
hudson.util.IOException2: Failed to dynamically deploy this plugin
at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1317)
at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1116)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:104)
at java.lang.Thread.run(Unknown Source)
Caused by: java.nio.file.FileSystemException: C:\Program Files (x86)\Jenkins\plugins\ruby-runtime\WEB-INF\lib\classes.jar: The process cannot access the file because it is being used by another process.
at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at sun.nio.fs.WindowsFileSystemProvider.implDelete(Unknown Source)
at sun.nio.fs.AbstractFileSystemProvider.delete(Unknown Source)
at java.nio.file.Files.delete(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at hudson.Util.deleteFile(Util.java:239)
at hudson.Util.deleteRecursive(Util.java:307)
at hudson.Util.deleteContentsRecursive(Util.java:204)
at hudson.Util.deleteRecursive(Util.java:298)
at hudson.Util.deleteContentsRecursive(Util.java:204)
at hudson.Util.deleteRecursive(Util.java:298)
at hudson.Util.deleteContentsRecursive(Util.java:204)
at hudson.Util.deleteRecursive(Util.java:298)
at hudson.ClassicPluginStrategy.explode(ClassicPluginStrategy.java:423)
at hudson.ClassicPluginStrategy.createPluginWrapper(ClassicPluginStrategy.java:129)
at hudson.PluginManager.dynamicLoad(PluginManager.java:413)
at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1313)
... 6 more
I am using jenkins v 1.538
I'm trying to install this plugin via the Update Center in Jenkins but it fails with the following error message:
hudson.util.IOException2: Failed to dynamically deploy this plugin
at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1314)
at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1111)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:679)
Caused by: hudson.util.IOException2: Failed to install gitlab-hook plugin
at hudson.PluginManager.dynamicLoad(PluginManager.java:417)
at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1310)
... 7 more
Caused by: hudson.util.IOException2: Failed to initialize
at hudson.ClassicPluginStrategy.load(ClassicPluginStrategy.java:379)
at hudson.PluginManager.dynamicLoad(PluginManager.java:408)
... 8 more
Caused by: java.lang.Exception: unable to locate gem bundle for gitlab-hook at /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems
at ruby.RubyPlugin.initRubyLoadPaths(RubyPlugin.java:202)
at ruby.RubyPlugin.start(RubyPlugin.java:158)
at hudson.ClassicPluginStrategy.startPlugin(ClassicPluginStrategy.java:387)
at hudson.ClassicPluginStrategy.load(ClassicPluginStrategy.java:376)
... 9 more
Manually downloading the .hpi
file into the jenkins plugin directory does not solve the issue.
Is it currently possible to get the JSON payload from the GitLab hook during the Jenkins project build? I'm fairly new to Jenkins and Ruby for that matter as well, but I looked through everything and didn't see anything for this sort of functionality. If not, is it possible/difficult to implement this?
Use case:
When a merge request is opened, I want to fire off a Jenkins build with the web hook. In the build, I want to run my build and at the last step, read the JSON payload to see if it's a merge request, get the merge request ID, and then POST JSON back to the GitLab API to add a comment to the merge request with something like ":+1:, build passed" or ":-1:, build failed".
I'm finding your plugin very useful but I was wondering if it is possible to have multiple projects trigger one generic Jenkins job.
For example, we have lots of Puppet modules (one module per repo) that undergo same set of unit tests. Therefore, it would be ideal to trigger a generic Jenkins job say Test_Puppet_Module
and have the project.namespace
and project.name
as parameters which gets passed into the Git configuration as follows;
[email protected]:${project.namespace}/${project.name}.git
I know this is currently possible for multiple branches so was wondering if it can be applicable for projects. Maybe there is a better way to achieve this but thought I'll post this question.
Thank you in advance.
Regards,
Dinesh
I'm trying to use the /gitlab/build_now hook with my projects, however I think that because I'm using the Multiple SCMs plugin (https://wiki.jenkins-ci.org/display/JENKINS/Multiple+SCMs+Plugin) my projects aren't being found and I'm getting the Jenkins warning log message:
no project references the given repo url and commit branch
Thank you for your interesting plugin. But we have on trouble during him use.
For the regular "Push Event" builds everything works perfectly. But when we set only "Tag push events" trigger from our Gitlab we have a message "no project references the given repo url and commit branch" in Jenkins logs
Sep 01, 2016 4:02:34 PM INFO org.jruby.javasupport.JavaMethod invokeDirectWithExceptionHandling
gitlab web hook triggered for
What's interesting, when we start project through "Test Hook" from gitlab. We have success build status.
exp.
success_build.txt
In this case we can see what "branch:" is not empty
Configuration.
In GitLab setting Web Hook configuration:
URL = http://our-jenkins-server/gitlab/build_now
Trigger = "Tag push events"
In jenkins configuration:
Source Code Management / Gitlab /
Branch specifier: /refs/heads/master
Build triggers/
enabled - "Build when a change is pushed to GitLab. GitLab CI Service URL: http://our-jenkins-server/gitlab/build_now"
enabled - "Build on Push Events"
Аccept merge request on success selected "Allow all branches to trigger this job"
Jenkins ver. 1.650
And Gitlab Hook Plugin ver 1.4.2
What are we doing wrong? Can I use your plugin only to "Tag push events" trigger from gitlab?
When the CSRF protection is set in Jenkins security config, the web hook requests fail with this error:
Jun 9, 2014 9:31:58 AM hudson.security.csrf.CrumbFilter doFilter
WARNING: No valid crumb was included in request for /gitlab/notify_commit. Returning 403.
This is caused by the POST request which does not use a crumb.
A simple fix could be implementing a CrumbExclusion
in the plugin like the gitbucket plugin
(see https://github.com/jenkinsci/gitbucket-plugin/blob/master/src%2Fmain%2Fjava%2Forg%2Fjenkinsci%2Fplugins%2Fgitbucket%2FGitBucketWebHook.java)
(I already opened a ticket in Jenkins JIRA JENKINS-23370; but maybe here is a better place)
Ive enabled the namespaces in gitlab and upgraded and updated Jenkins to 1497.
Now the 'build_now' url generates the following error:
undefined method `[]' for nil:NilClass
Hey,
I've set up a parametrised build using the guide on your blog, with Jenkins 1.522, Gitlab Hook 0.2.9 and ruby-runtime 0.12.
It doesn't really want to work so I started to debug it with requestb.in, test hooks and the POSTMan Chrome plugin.
What seems to be happening is that Jenkins returns a 500 error with the message undefined method 'getDefaultParametersValues' for #
. I figured out that it's a method which is an alias for a Jenkins Java method, but no idea how to go any further: https://github.com/manishval/gitlab-hook-plugin/blob/master/models/gitlab_project.rb#L115
Please help :)
Git throws error while branch specifier is */develop
.
Specifier like */develop*
does the trick.
Started on Jul 3, 2014 1:19:00 PM
Using strategy: Default
[poll] Last Built Revision: Revision 5bcd1c33a0ac3e8a3b0ef71b8befc1c2ae5a63dc (origin/develop)
> /usr/bin/git ls-remote -h ssh://[email protected] develop
FATAL: hudson.plugins.git.GitException: Command "/usr/bin/git ls-remote -h ssh://[email protected] develop" returned status code 128:
stdout:
stderr: Access denied.
fatal: The remote end hung up unexpectedly
hudson.util.IOException2: hudson.plugins.git.GitException: Command "/usr/bin/git ls-remote -h ssh://[email protected] develop" returned status code 128:
stdout:
stderr: Access denied.
fatal: The remote end hung up unexpectedly
at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:459)
at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:357)
at hudson.scm.SCM.poll(SCM.java:374)
at hudson.model.AbstractProject._poll(AbstractProject.java:1428)
at hudson.model.AbstractProject.poll(AbstractProject.java:1331)
at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:477)
at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:506)
at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:118)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git ls-remote -h ssh://[email protected] develop" returned status code 128:
stdout:
stderr: Access denied.
fatal: The remote end hung up unexpectedly
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1325)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1186)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1110)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1101)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getHeadRev(CliGitAPIImpl.java:1788)
at hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:492)
at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:457)
... 12 more
Done. Took 0.27 sec
No changes
I'm runing GitLab 4.1 and Jenkins 1.504, with version 0.2.5 of this plugin (since it's the newest available in Jenkins repository)
Git it will not trigger builds. Here is the raw output from the jenkins log for an attempt to push to the repo:
Mar 8, 2013 8:04:28 AM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: gitlab web hook triggered for repo url git@localhost:felested/test.git and master branch
Mar 8, 2013 8:04:28 AM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: with payload: {"before"=>"b510a3f24394939210357eac338cbb7e1fc286da", "after"=>"7a6c9bee94e61629aa5aabea07d818b1a2bfc3aa", "ref"=>"refs/heads/master", "user_id"=>5, "user_name"=>"Fredrik Elestedt", "repository"=>{"name"=>"test", "url"=>"git@localhost:felested/test.git", "description"=>nil, "homepage"=>"http://gitlabdev/felested/test"}, "commits"=>[{"id"=>"7a6c9bee94e61629aa5aabea07d818b1a2bfc3aa", "message"=>"Testing commit", "timestamp"=>"2013-03-08T08:04:10-05:00", "url"=>"http://gitlabdev/felested/test/commit/7a6c9bee94e61629aa5aabea07d818b1a2bfc3aa", "author"=>{"name"=>"Fredrik Elestedt", "email"=>"[email protected]"}}], "total_commits_count"=>1}
Mar 8, 2013 8:04:28 AM sun.reflect.NativeMethodAccessorImpl invoke0
WARNING: no project references the given repo url and commit branch
According to documentation an autogenerated project should be named by the repo name and then postfixed with the branch, i.e. REPONAME_BRANCH
In my testing i have observed that this is not the case the first time a project is created from an unknown repository notification. Then the name of the Jenkins project will match only the gitlab repo name and not prefix the branchname.
Setup:
base project
has a valueScenario:
Prerequisite.
FOO
FOO
has webhook to jenkins using build_now
FOO
Reproduce:
master
branch of repo FOO
FOO
. Expected name should be FOO_master
master
branch of repo FOO
again and observe that Jenkins/plugin creates a new project named FOO_master
. This is wierd since the Jenkins project FOO
relate to the master
branchdevelop
branch of repo FOO
FOO_develop
as expected. According to log the project FOO_develop
is based on project FOO
Jenkins Version: 1.572
Ruby-runtime Version: 0.12
I have installed gitlab-hook-plugin successfully at jenkins ver.1.556 for another host,
but for Jenkins ver.1572, i got the following error.
Failed Loading plugin gitlab-hook
java.io.IOException: Failed to initialize
at hudson.ClassicPluginStrategy.load(ClassicPluginStrategy.java:394)
at hudson.PluginManager$2$1$1.run(PluginManager.java:357)
at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169)
at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
at jenkins.model.Jenkins$7.runTask(Jenkins.java:885)
at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1156)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:626)
at java.lang.Thread.run(Thread.java:804)
Caused by: org.jruby.embed.EvalFailedException: (LoadError) load error: jenkins/model/build -- java.lang.IncompatibleClassChangeError: incompatible InnerClasses attribute between "hudson.model.Queue$Executable" and "hudson.model.Queue"
at org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:133)
at org.jruby.embed.ScriptingContainer.runUnit(ScriptingContainer.java:1264)
at org.jruby.embed.ScriptingContainer.runScriptlet(ScriptingContainer.java:1257)
at ruby.RubyPlugin.eval(RubyPlugin.java:244)
at ruby.RubyPlugin.require(RubyPlugin.java:248)
at ruby.RubyPlugin.initRubyNativePlugin(RubyPlugin.java:186)
at ruby.RubyPlugin.start(RubyPlugin.java:163)
at hudson.ClassicPluginStrategy.startPlugin(ClassicPluginStrategy.java:402)
at hudson.ClassicPluginStrategy.load(ClassicPluginStrategy.java:391)
... 9 more
Caused by: org.jruby.exceptions.RaiseException: (LoadError) load error: jenkins/model/build -- java.lang.IncompatibleClassChangeError: incompatible InnerClasses attribute between "hudson.model.Queue$Executable" and "hudson.model.Queue"
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1027)
at RUBY.require(jar:file:/var/lib/jenkins/plugins/ruby-runtime/WEB-INF/lib/jruby-complete-1.7.3.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:36)
at RUBY.(root)(/var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/jenkins-plugin-runtime-0.2.3/lib/jenkins/model.rb:70)
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1027)
at RUBY.(root)(jar:file:/var/lib/jenkins/plugins/ruby-runtime/WEB-INF/lib/jruby-complete-1.7.3.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:1)
at RUBY.require(jar:file:/var/lib/jenkins/plugins/ruby-runtime/WEB-INF/lib/jruby-complete-1.7.3.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:36)
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1027)
at RUBY.(root)(/var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/jenkins-plugin-runtime-0.2.3/lib/jenkins/plugin/runtime.rb:10)
at RUBY.(root)(jar:file:/var/lib/jenkins/plugins/ruby-runtime/WEB-INF/lib/jruby-complete-1.7.3.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:1)
Is that a issue about Jenkins intead of gitlab-webhook-plugin?
We have a set up where we have 1 git repo with many subdirs and many jenkins projects.
For example:
gitrepo/
proj1/
proj2/
proj3/
proj1, proj2 and proj3 are independent applications and built independently.
The current jenkins setup we have for them is using jenkins scm includedRegions and git plugin's sparsepath we can effectively treat proj1, proj2 and proj3 as separate repos. This means that with the usual jenkins notifyCommit jenkins will only build proj1 if proj1 has changed.
We'd really like to use build_now with this scm/git feature but right now it will indiscriminately fire a change (commits on proj2 will cause an unnecessary build of proj1).
My initial readings of the gitlab docs (https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/web_hooks/web_hooks.md) suggest we do get posted enough information to do this. Is this something you'd consider developing or consider a pull request for?
Thanks
I have a project which uses the Multiple SCMs plugin to checkout two repositories. One of the repositories has "Don't trigger a build on commit notifications" set. However, when a notification for the other repository is fired the project is also not build.
Me again ^^
Now that the main job is correctly triggered, I add other jobs.
One of these jobs is extremely time consuming and I want to trigger it only twice a day.
So, I filled crontab planning and I see a checkbox
"Ignore post-commit hooks"
Is it possible to take care of this value ?
e.g when this box is checked, the gitlab_hook plugin don't trigger that job.
Hi,
Just tried to install in jenkins (lastest version) and after download, an error occur on plugin installation: "failed to load haml"
Jenkins is installed in windows 2008 environment, all updated.
Is there a workaround for that?
Is there a way to get this plugin working for pipeline projects?
We have been running the plugin with GitLab for several months now, but got bit by that ruby issue. when we updated a few weeks ago. Now, with Jenkins ver. 1.520, we can get the ruby plugin, but the gitlab plugin is not installed & will not. It goes though the motions like it is installing, but hangs on restarting Jenkins. I drop into a shell & do service jenkins restart; service httpd restart, and everything comes back up--however, the gitlab plugin still shows that it is not installed. I have rm'ed gitlab-* from the plugins folder & tried again, but no go. You have any suggestions? I have looked for logs, but have not been able to locate them. Thanks.
It appears that upgrading to versions of Jenkins 1.633 and greater will cause this plugin to no longer work due to an issue with the ruby runtime plugin.
https://issues.jenkins-ci.org/browse/JENKINS-31019?jql=project%20%3D%20JENKINS%20AND%20status%20in%20%28Open%2C%20%22In%20Progress%22%2C%20Reopened%29%20AND%20component%20%3D%20%27ruby-runtime-plugin%27
Until the ruby runtime plugin is fixed, it may be helpful to update the documentation to let people know that this will only work on Jenkins 1.632 and earlier.
If I visit notify_commit and build_now, I only get "Read timed out".
I can not yet see whats the reason for that.
In the log, I get this:
INFORMATION: gitlab web hook triggered for
- group/repo url: ssh://git@repo-host/group/repo.git
- branch: master
- with payload:
{
"object_kind": "push",
"event_name": "push",
"before": "651522384df8f144ffaaa367578ad5cd6f090443",
"after": "17c5c6e90b1b2822e062b87d9ea029281221bf21",
"ref": "refs/heads/master",
"checkout_sha": "17c5c6e90b1b2822e062b87d9ea029281221bf21",
"message": null,
"user_id": 2,
"project_id": 23,
"project": {
"name": "repo",
"description": null,
"web_url": "https://repo-host/group/repo",
"avatar_url": null,
"git_ssh_url": "ssh://git@repo-host/group/repo.git",
"git_http_url": "https://repo-host/group/repo.git",
"namespace": "rttr",
"visibility_level": 0,
"path_with_namespace": "group/repo",
"default_branch": "master",
"homepage": "https://repo-host/group/repo",
"url": "ssh://git@repo-host/group/repo.git",
"ssh_url": "ssh://git@repo-host/group/repo.git",
"http_url": "https://repo-host/group/repo.git"
},
"commits": [
{
"id": "17c5c6e90b1b2822e062b87d9ea029281221bf21",
"message": "mailer needs node\n",
"timestamp": "2016-09-03T23:25:32+02:00",
"url": "https://repo-host/group/repo/commit/17c5c6e90b1b2822e062b87d9ea029281221bf21",
"added": [
],
"modified": [
"Jenkinsfile"
],
"removed": [
]
},
{
"id": "31c9eeb7af4094e66051c3303cc4add360febb61",
"message": "add email notification\n",
"timestamp": "2016-09-03T23:24:15+02:00",
"url": "https://repo-host/group/repo/commit/31c9eeb7af4094e66051c3303cc4add360febb61",
"added": [
],
"modified": [
"Jenkinsfile"
],
"removed": [
]
},
{
"id": "651522384df8f144ffaaa367578ad5cd6f090443",
"timestamp": "2016-08-29T07:30:04+02:00",
"url": "https://repo-host/group/repo/commit/651522384df8f144ffaaa367578ad5cd6f090443",
"author": {
},
"added": [
],
"modified": [
],
"removed": [
]
}
],
"total_commits_count": 3,
"repository": {
"name": "repo",
"url": "ssh://git@repo-host/group/repo.git",
"description": null,
"homepage": "https://repo-host/group/repo",
"git_http_url": "https://repo-host/group/repo.git",
"git_ssh_url": "ssh://git@repo-host/group/repo.git",
"visibility_level": 0
}
}
Sep 03, 2016 11:39:09 PM org.jruby.javasupport.JavaMethod invokeDirectWithExceptionHandling
INFORMATION: matching projects:
Sep 03, 2016 11:39:09 PM org.jruby.javasupport.JavaMethod invokeDirectWithExceptionHandling
WARNUNG: no project references the given group/repo url and commit branch
the git-url set in the project is "ssh://git@repo-host/group/repo.git" so I dont know why it does not work?
Hi.
I'm having a problem with builds started by jenkins-gitlab-hook-plugin
Scenario:
gitlab tag push webhook is sent to jenkins instance
Branch Specifier is filled with wildcard expression [part of tag name]
when name is matched build start but git repo in workspace checks out to wrong commit
Am I doing something wrong or plugin doesn't support building from tags??
Cheers,
Dominik
Hi,
I set up a Jenkins server and installed this plugin.
Then I set up the build now hook with http://URL_to_server/gitlab/build_now and with the "Push events" option checked.
In Jenkins I didn't configure anything (except the build task), because I didn't see in your docs what I should configure.
The build task is not parameterized and the project is activated.
When I call the hook URL in the browser I get the following, which should be correct when it's called without any payload:
repo url could not be found in Gitlab payload or the HTTP parameters:
- body: {}
- parameters: {
}
Any ideas what I'm doing wrong?
Thanks in advance!
From what I can tell, this plugin looks at the git repo configured for all Jenkins projects to figure out which job to trigger for a given commit. Given that, it appears that if I have more than one job pulling from the same repo, a commit to that repo will trigger all those jobs. Is that correct? Is there any way we can easily specify only one specific job to build for commits to a given repo?
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
Hi,
First, thank you for your plugin !
I'm trying your plugin using multi-branch project style and hitting a wall : "no project references the given repo url and commit branch"
Here is my setting:
CONTAINER ID | IMAGE | COMMAND | CREATED | STATUS | PORTS NAMES |
---|---|---|---|---|---|
dd171360530b | sameersbn/gitlab:7.11.0 | "/app/init app:start | 4 minutes ago | Up 4 minutes | 443/tcp, 0.0.0.0:10022->22/tcp, 0.0.0.0:10080->80/tcp |
077fddf03c21 | sameersbn/redis:latest | "/start" | 4 minutes ago | Up 4 minutes | 6379/tcp |
83fee3e63d59 | sameersbn/postgresql:9.4 | "/start" | 4 minutes ago | Up 4 minutes | 5432/tcp |
6c9d19e73cef | enalean/tuleap-aio:latest | "/root/app/run.sh" 49 minutes ago Up 48 minutes 0.0.0.0:80->80/tcp, 22/tcp, 0.0.0.0:443->443/tcp | tuleap | ||
7a7e0b55df6f | jenkins:latest | "/usr/local/bin/jenk | 55 minutes ago | Up 55 minutes | 50000/tcp, 0.0.0.0:8090->8080/tcp |
Adding a commit in a branch (git flow)
serard@ubuntu:~/test-prj/test$ echo 1 >> README; git add -A; git commit -m"test"; git push
[hotfix/1.0.1 281a57c] test
1 file changed, 1 insertion(+)
Décompte des objets: 3, fait.
Écriture des objets: 100% (3/3), 236 bytes | 0 bytes/s, fait.
Total 3 (delta 0), reused 0 (delta 0)
To ssh://[email protected]:10022/root/test.git
fbd3c09..281a57c hotfix/1.0.1 -> hotfix/1.0.1
serard@ubuntu:~/test-prj/test$
Stack trace in jenkins logs :
May 21, 2015 9:43:58 PM org.jruby.javasupport.JavaMethod invokeDirectWithExceptionHandling
INFO: gitlab web hook triggered for
- repo url: ssh://[email protected]:10022/root/test.git
- branch: hotfix/1.0.1
- with payload:
{
"object_kind": "push",
"before": "fbd3c09bc6f6c2f40eb22d2e4962e5069137dfa6",
"after": "281a57ce4de936645d92d3f4cb3e18e88641c958",
"ref": "refs/heads/hotfix/1.0.1",
"checkout_sha": "281a57ce4de936645d92d3f4cb3e18e88641c958",
"message": null,
"user_id": 1,
"user_name": "Administrator",
"user_email": "[email protected]",
"project_id": 1,
"repository": {
"name": "test",
"url": "ssh://[email protected]:10022/root/test.git",
"description": "test",
"homepage": "http://192.168.0.17:10080/root/test",
"git_http_url": "http://192.168.0.17:10080/root/test.git",
"git_ssh_url": "ssh://[email protected]:10022/root/test.git",
"visibility_level": 10
},
"commits": [
{
"id": "281a57ce4de936645d92d3f4cb3e18e88641c958",
"message": "test\n",
"timestamp": "2015-05-21T23:43:57+02:00",
"url": "http://192.168.0.17:10080/root/test/commit/281a57ce4de936645d92d3f4cb3e18e88641c958",
"author": {
"name": "Your Name",
"email": "[email protected]"
}
}
],
"total_commits_count": 1
}
May 21, 2015 9:43:58 PM org.jruby.javasupport.JavaMethod invokeDirectWithExceptionHandling
INFO: matching projects:
- test/develop
- test/hotfix/1.0.1
- test/master
- test/release/1
May 21, 2015 9:43:58 PM org.jruby.javasupport.JavaMethod invokeDirectWithExceptionHandling
WARNING: no project references the given repo url and commit branch
Obviously I want it to trigger a build for test/hotfix/1.0.1 :)
Is it made to work this way ?
Going to the configuration of the sub-project : http://192.168.0.17:8090/job/test/branch/hotfix%2F1.0.1/configure
I can see the "Branches to build Branch Specifier (blank for 'any')" parameter is set to "hotfix/1.0.1".
Thank you very much !
Jenkins use the new ruby-runtime 0.11 and the jenkins-gitlab-hook-plugins needs the ruby-runtime 0.10.
Finally the plugin doesn't install with error.
Version of plugin: 0.2.6
INFO: Attempting to dynamic load /opt/jenkins/plugins/gitlab-hook.jpi
jun 30, 2013 3:24:42 PM hudson.model.UpdateCenter$DownloadJob run
SEVERE: Failed to install Gitlab Hook Plugin
hudson.util.IOException2: Failed to dynamically deploy this plugin
at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1314)
at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1111)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Caused by: hudson.util.IOException2: Failed to install gitlab-hook plugin
at hudson.PluginManager.dynamicLoad(PluginManager.java:417)
at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1310)
... 7 more
Caused by: hudson.util.IOException2: Failed to initialize
at hudson.ClassicPluginStrategy.load(ClassicPluginStrategy.java:379)
at hudson.PluginManager.dynamicLoad(PluginManager.java:408)
... 8 more
Caused by: java.lang.Exception: unable to locate gem bundle for gitlab-hook at /opt/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems
at ruby.RubyPlugin.initRubyLoadPaths(RubyPlugin.java:202)
at ruby.RubyPlugin.start(RubyPlugin.java:158)
at hudson.ClassicPluginStrategy.startPlugin(ClassicPluginStrategy.java:387)
at hudson.ClassicPluginStrategy.load(ClassicPluginStrategy.java:376)
... 9 more
Hi Vanja -
Is there a way to prevent the plugin from explicitly triggering both the upstream and downstream builds of a multi-configuration project? For example, if I have a job named 'foo', which has 'debug' and 'release' configurations, 'foo' will be triggered, as will 'foo/BUILD=debug' and 'foo/BUILD=release'. However, foo itself will also trigger these jobs, resulting in queued duplicate jobs.
For now, I changed the code to return false in matches? (project.rb) if self includes a slash, though I doubt this is the most robust way of handling this. Any ideas? Is this a configuration I'm missing?
Thanks,
Derek
We have been using the hook for a while & is has been great. In the last few days we have done some upgrades (os patches, gitlab 6.0.0.pre, jenkins 1.526, etc). Anyhow, the automatic building stopped working & we assumed that it was some update we did. I just noticed this in the logs...
{
"before"=>"<sha 1>",
"after"=>"<sha 2>",
"ref"=>"refs/heads/develop",
"user_id"=>2,
"user_name"=>"Jimmy Puckett",
"repository"=>{
"name"=>"<repository>",
"url"=>"<user>@<git server>:<group>/<repository>.git",
"description"=>"",
"homepage"=>"https://<git server>/<group>/<repository>"
},
"commits"=>[
{
"id"=>"<commit>",
"message"=>"<The message>",
"timestamp"=>"2013-08-06T06:31:42-04:00",
"url"=>"https://<git server>/<group>/<repository>/commit/<commit>",
"author"=>{
"name"=>"Jimmy Puckett",
"email"=>"<email>"
}
},
{
"id"=>"<sha 2>",
"message"=>"<The message>",
"timestamp"=>"2013-08-06T06:34:05-04:00",
"url"=>"https://<git server>/<group>/<repository>/commit/<sha 2>",
"author"=>{
"name"=>"Jimmy Puckett",
"email"=>"<email>"
}
}
],
"total_commits_count"=>2
}
For some reason (maybe I just don't know what I am looking at?), there are '=>' between the key/value pairs instead of ':'. I would think that it should be...
{
"before": "<sha 1>",
"after": "<sha 2>",
"ref": "refs/heads/develop",
"user_id": 2,
"user_name": "Jimmy Puckett",
"repository": {
"name": "<repository>",
"url": "<user>@<git server>:<group>/<repository>.git",
"description": "",
"homepage": "https://<git server>/<group>/<repository>"
},
"commits": [
{
"id": "<commit>",
"message": "<The message>",
"timestamp": "2013-08-06T06:31:42-04:00",
"url": "https://<git server>/<group>/<repository>/commit/<commit>",
"author": {
"name": "Jimmy Puckett",
"email": "<email>"
}
},
{
"id": "<sha 2>",
"message": "<The message>",
"timestamp": "2013-08-06T06:34:05-04:00",
"url": "https://<git server>/<group>/<repository>/commit/<sha 2>",
"author": {
"name": "Jimmy Puckett",
"email": "<email>"
}
}
],
"total_commits_count": 2
}
The odd part is that I then see this in the log...
...
Aug 06, 2013 6:18:08 AM INFO sun.reflect.NativeMethodAccessorImpl invoke0
project <project> matches the develop branch
Aug 06, 2013 6:18:08 AM SEVERE sun.reflect.NativeMethodAccessorImpl invoke0
...
so I guess that means that you can use the '=>' separator? Anyhow, do you have any ideas on where to start looking?
I am trying to get the tag value as a git paramater, the default value is the branch to build (*/master)
but getting the error in jenkins log
only string parameters for branch parameter are supported
So, would it be possible to modify this plugin such that the payload can be sent to a parameterized Jenkins job that expects a 'payload' parameter?
This way, the Jenkins job could act accordingly on the payload/data sent in. Basically, I would like to see the entire JSON object sent by gitlab in my Jenkins job. A sample use case would be that I would like to take certain actions when a new branch is created for a project.
Or, could this plugin be modified to realize a new branch creation action and send in the branch name as a parameter or something?
right now we have our repositories set up in gitlab to trigger whenever a push happens to master using the web hooks. The webhook is set up to invoke jenkins by way of this great plugin.
We also use a jenkins build to automatically increase the pre release version of our software and push to master. This means we have an infinite build loop.
What I would like to do is skip a build based on some value in a commit message. I imagine this would be a good enhancement to this plugin but I'm not sure if thats the appropriate place for it or if someone is aware of another way to achieve this.
Just like the headline says, I would really like to have automaticaly created Projects for each branch and also to have them deleted as soon as the branch dies, but I don't know how to configure Jenkins to do so.
it is working as expected, eg: jenkins job builds commits both from master and branches if we use option build_now and ${BRANCH_TO_BUILD}. Is there a plan to make the plugin to execute the job which has the specific branch value in ${BRANCH_TO_BUILD}.
jenkins 1.526 gitlab hook plugin 0.2.12
i input http://myserver/gitlab/build_now?url=http://mygit.git
returns "undefined method []' for nil:NilClass" here is log 八月 13, 2013 12:08:10 下午 严重 sun.reflect.NativeMethodAccessorImpl invoke0 undefined method
[]' for nil:NilClass
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.