Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-30061

Can't get build status on GitLab Merge Request

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Hello!
      I am trying to configure autocreate projects, and report build status on merge request.
      So, everything works as expected except reporting build status to merge request page.

      Here is my configuration:

      On gitlab I have web-hook build_now configured for merge_request events.

      On "Jenkins global configuration -> Gitlab Web Hook" section I checked "Create new projects for merge requests" and unchecked "Automatic project creation". And there are no project templates there.

      On "Jenkins global configuration -> Gitlab Notifier Configuration", I entered GitLab URL (tried both with /api/v3 and without), GitLab Token, unchecked box "Send notification as commit statuses", and checked "Only submit status for merge projects".

      Also , on "Jenkins global configuration -> Gitlab" section I alse entered GitLab URL and GitLab Token.

      In Jenkins Log i see error, when I create merge request:
      Error appears in log after creating project, but just before execution

      sorry, but right now I only have error text, without log message before and after it

      NameError - no constructorfor arguments (java.lang.IllegalArgumentException) on Java::OrgJrubyExceptions::RaiseException:
      	/var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/models/api.rb:63: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:18: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'
      

        Attachments

          Activity

          Hide
          javiplx Javier Palacios added a comment -

          Apologies for the long delay, but I've been a bit apart of this project for a few months. I believe what you are seeing is an exception while capturing an exception. Around line 63 of $JENKINS_HOME/plugins/gitlab-hook/WEB-INF/classes/models/api.rb you should get this block:

              rescue => e
                # avoid method signature warnings
                severe = logger.java_method(:log, [Level, java.lang.String, java.lang.Throwable])
                severe.call(Level::SEVERE, e.message, RaiseException.new(e))
                status 500
                [e.message, '', 'Stack trace:', e.backtrace].flatten.join('<br>')
              end
          

          Replacing with

              rescue => e
                logger.warning(e.message)
                logger.warning(e.backtrace.join("\n" )
                status 500
              end
          

          should (after restarting) give the real error

          Show
          javiplx Javier Palacios added a comment - Apologies for the long delay, but I've been a bit apart of this project for a few months. I believe what you are seeing is an exception while capturing an exception. Around line 63 of $JENKINS_HOME/plugins/gitlab-hook/WEB-INF/classes/models/api.rb you should get this block: rescue => e # avoid method signature warnings severe = logger.java_method(:log, [Level, java.lang. String , java.lang.Throwable]) severe.call(Level::SEVERE, e.message, RaiseException. new (e)) status 500 [e.message, '', ' Stack trace: ', e.backtrace].flatten.join(' <br>') end Replacing with rescue => e logger.warning(e.message) logger.warning(e.backtrace.join( "\n" ) status 500 end should (after restarting) give the real error
          Hide
          javiplx Javier Palacios added a comment -

          Please grab the latest snapshot from http://repo.jenkins-ci.org/snapshots/org/jenkins-ci/ruby-plugins/gitlab-hook/1.4.2-SNAPSHOT, and chech if this issue still happens. It has improved support for build statuses on gitlab 8.1 and later

          Show
          javiplx Javier Palacios added a comment - Please grab the latest snapshot from http://repo.jenkins-ci.org/snapshots/org/jenkins-ci/ruby-plugins/gitlab-hook/1.4.2-SNAPSHOT , and chech if this issue still happens. It has improved support for build statuses on gitlab 8.1 and later
          Hide
          javiplx Javier Palacios added a comment -

          Waiting for feedback

          Show
          javiplx Javier Palacios added a comment - Waiting for feedback
          Hide
          rseek Arseniy Rozov added a comment - - edited

          Thank you for your reply and your work.
          I'm sorry, but I can't test it right now;
          we moved to "gitlab-plugin" some time ago.
          maybe you just close this issue because I don't think I will test it soon

          Show
          rseek Arseniy Rozov added a comment - - edited Thank you for your reply and your work. I'm sorry, but I can't test it right now; we moved to "gitlab-plugin" some time ago. maybe you just close this issue because I don't think I will test it soon

            People

            Assignee:
            javiplx Javier Palacios
            Reporter:
            rseek Arseniy Rozov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: