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

undefined method `request_uri'

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: gitlab-hook-plugin
    • Labels:
    • Environment:
      Jenkins 1.650
      Gitlab Hook Plugin 1.4.1.1 and 1.4.0 (reverted to this and problem still appears)
    • Similar Issues:

      Description

      Hello,
      We're having the following problem. Please let me know what else I can provide to get to the bottom of what is happening here. Thanks!

      Console output from job:

      Started by user Blaine, Jeff
      [EnvInject] - Loading node environment variables.
      Building remotely on jenkins-rhel6-slave (8gb 4core rhel6) in workspace /var/lib/jenkins/workspace/pytika-test
      [WS-CLEANUP] Deleting project workspace...
      [WS-CLEANUP] Done
      Cloning the remote Git repository
      Cloning repository git@gitlab.our.org:cjk-apollo/pytika.git
       > /usr/rcf/bin/git init /var/lib/jenkins/workspace/pytika-test # timeout=10
      Fetching upstream changes from git@gitlab.our.org:cjk-apollo/pytika.git
       > /usr/rcf/bin/git --version # timeout=10
      using GIT_SSH to set credentials jblaine-Jenkins
       > /usr/rcf/bin/git -c core.askpass=true fetch --tags --progress git@gitlab.our.org:cjk-apollo/pytika.git +refs/heads/*:refs/remotes/origin/*
       > /usr/rcf/bin/git config remote.origin.url git@gitlab.our.org:cjk-apollo/pytika.git # timeout=10
       > /usr/rcf/bin/git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
       > /usr/rcf/bin/git config remote.origin.url git@gitlab.our.org:cjk-apollo/pytika.git # timeout=10
      Fetching upstream changes from git@gitlab.our.org:cjk-apollo/pytika.git
      using GIT_SSH to set credentials jblaine-Jenkins
       > /usr/rcf/bin/git -c core.askpass=true fetch --tags --progress git@gitlab.our.org:cjk-apollo/pytika.git +refs/heads/*:refs/remotes/origin/*
       > /usr/rcf/bin/git rev-parse refs/remotes/origin/develop^{commit} # timeout=10
       > /usr/rcf/bin/git rev-parse refs/remotes/origin/origin/develop^{commit} # timeout=10
      Checking out Revision 6b7043fd37a1bc4adc39b8989f5d1b57a4cf3605 (refs/remotes/origin/develop)
       > /usr/rcf/bin/git config core.sparsecheckout # timeout=10
       > /usr/rcf/bin/git checkout -f 6b7043fd37a1bc4adc39b8989f5d1b57a4cf3605
      > /usr/rcf/bin/git rev-list 6b7043fd37a1bc4adc39b8989f5d1b57a4cf3605 # timeout=10
      ERROR: undefined method `request_uri' for #<URI::Generic:0x5ba74f31 URL:/api/v3/projects/search/pytika> (NoMethodError)
      /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/lib/gitlab/client.rb:92:in `do_request'
      /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/lib/gitlab/client.rb:78:in `repo_id'
      /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/lib/gitlab/client.rb:18:in `name='
      /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/models/gitlab_notifier.rb:21:in `prebuild'
      /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/jenkins-plugin-runtime-0.2.3/lib/jenkins/tasks/build_step_proxy.rb:8:in `prebuild'
      /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/jenkins-plugin-runtime-0.2.3/lib/jenkins/tasks/build_step_proxy.rb:22:in `boolean_result'
      /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/jenkins-plugin-runtime-0.2.3/lib/jenkins/tasks/build_step_proxy.rb:7:in `prebuild'
      
      [pytika-test] $ git log -1 --oneline --format=%P
      ERROR: undefined method `request_uri' for #<URI::Generic:0x250d0d0a> (NoMethodError)
      /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/lib/gitlab/client.rb:89:in `do_request'
      /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/lib/gitlab/client.rb:61:in `post_commit_note'
      /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/lib/gitlab/client.rb:44:in `post_status'
      /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/models/gitlab_notifier.rb:34:in `perform'
      /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/jenkins-plugin-runtime-0.2.3/lib/jenkins/tasks/build_step_proxy.rb:14:in `perform'
      /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/jenkins-plugin-runtime-0.2.3/lib/jenkins/tasks/build_step_proxy.rb:22:in `boolean_result'
      /var/lib/jenkins/plugins/gitlab-hook/WEB-INF/classes/vendor/gems/gems/jenkins-plugin-runtime-0.2.3/lib/jenkins/tasks/build_step_proxy.rb:13:in `perform'
      

        Attachments

          Activity

          Hide
          javiplx Javier Palacios added a comment -

          Have a look at jenkins global configuration, and search for "Gitlab Notifier Configuration". If gitlab URL and token are empty as I suspect fill with right values, and it should work.
          If that is not possible, search gitlab_notifier.rb on the plugin installation directory and clean bodies of prebuild and perform functions. This will act as disabling the notification functionality, which I must implement with a configuration flag.

          Show
          javiplx Javier Palacios added a comment - Have a look at jenkins global configuration, and search for "Gitlab Notifier Configuration". If gitlab URL and token are empty as I suspect fill with right values, and it should work. If that is not possible, search gitlab_notifier.rb on the plugin installation directory and clean bodies of prebuild and perform functions. This will act as disabling the notification functionality, which I must implement with a configuration flag.
          Hide
          jblaine Jeff Blaine added a comment -

          Thanks for the reply, Javier.

          The Jenkins instance we offer to our users is not owned by a single project, team, or person. Setting a single global API token under "Configure System" that gets used by multiple teams' jobs is not an option for us security-wise I believe that is what your first option is asking me to do.

          It's my understanding that the URL + API token should be something configured per-job by the end user, just like any credential-like item. Am I misunderstanding?

          I will implement the second option and wait to hear from you.

          Show
          jblaine Jeff Blaine added a comment - Thanks for the reply, Javier. The Jenkins instance we offer to our users is not owned by a single project, team, or person. Setting a single global API token under "Configure System" that gets used by multiple teams' jobs is not an option for us security-wise I believe that is what your first option is asking me to do. It's my understanding that the URL + API token should be something configured per-job by the end user, just like any credential-like item. Am I misunderstanding? I will implement the second option and wait to hear from you.
          Hide
          javiplx Javier Palacios added a comment -

          Currently, the token can only be configured system wide, so it might not be an not an option for you, depending on your setup. First of all, that user needs permission search projects and submit statuses to all projects. But if you have a single ssh credential to clone the repositories at jenkins, you can just use the token from the gitlab user associated to that keys.
          Anyway, voiding the functions I mention will make the problem dissapear for now, and as the issue is somewhat limited I do not expect that a new release solving it will take long.

          Show
          javiplx Javier Palacios added a comment - Currently, the token can only be configured system wide, so it might not be an not an option for you, depending on your setup. First of all, that user needs permission search projects and submit statuses to all projects. But if you have a single ssh credential to clone the repositories at jenkins, you can just use the token from the gitlab user associated to that keys. Anyway, voiding the functions I mention will make the problem dissapear for now, and as the issue is somewhat limited I do not expect that a new release solving it will take long.
          Show
          javiplx Javier Palacios added a comment - Snapshot with the fix available at https://repo.jenkins-ci.org/snapshots/org/jenkins-ci/ruby-plugins/gitlab-hook/1.4.2-SNAPSHOT
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Javier Palacios
          Path:
          lib/gitlab/client.rb
          models/gitlab_notifier.rb
          http://jenkins-ci.org/commit/gitlab-hook-plugin/ae9825fe22ad50801eaccc352ccd12b4b7694c4c
          Log:
          JENKINS-33252 skip reporting if gitlab url/token not configured

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Javier Palacios Path: lib/gitlab/client.rb models/gitlab_notifier.rb http://jenkins-ci.org/commit/gitlab-hook-plugin/ae9825fe22ad50801eaccc352ccd12b4b7694c4c Log: JENKINS-33252 skip reporting if gitlab url/token not configured

            People

            • Assignee:
              javiplx Javier Palacios
              Reporter:
              jblaine Jeff Blaine
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: