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

Job DSL githubPullRequest: No signature of method

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Blocker
    • Resolution: Not A Defect
    • None
    • Jenkins 2.7.2
      Job DSL Plugin 1.50
      GHPRB 1.33.1

    Description

      Job DSL testing fail after upgrading GHPRB to 1.33.1 and using new DLS (change pullRequest to githubPullRequest):

      triggers {
              githubPullRequest {
                  admins(['user1', 'user2', 'user3'])
                  orgWhitelist('ORG1')
                  useGitHubHooks()
              }
          }
      

      ./gradlew clean test output:

      12:25:56.244 [DEBUG] [TestEventLogger] com.dslexample.JobScriptsSpec > test script seed.groovy FAILED
      12:25:56.244 [DEBUG] [TestEventLogger]     Expected no exception to be thrown, but got 'javaposse.jobdsl.dsl.DslScriptException'
      12:25:56.245 [DEBUG] [TestEventLogger]         at spock.lang.Specification.noExceptionThrown(Specification.java:118)
      12:25:56.245 [DEBUG] [TestEventLogger]         at com.dslexample.JobScriptsSpec.test script #file.name(JobScriptsSpec.groovy:27)
      12:25:56.245 [DEBUG] [TestEventLogger] 
      12:25:56.245 [DEBUG] [TestEventLogger]         Caused by:
      12:25:56.246 [DEBUG] [TestEventLogger]         javaposse.jobdsl.dsl.DslScriptException: (script, line 47) No signature of method: javaposse.jobdsl.dsl.helpers.triggers.TriggerContext.pullRequest() is applicable for argument types: (script$_run_closure2$_closure11$_closure16) values: [script$_run_closure2$_closure11$_closure16@37023619]
      12:25:56.246 [DEBUG] [TestEventLogger]             at javaposse.jobdsl.dsl.DslScriptLoader.runScriptEngine(DslScriptLoader.groovy:135)
      12:25:56.246 [DEBUG] [TestEventLogger]             at javaposse.jobdsl.dsl.DslScriptLoader.runScriptsWithClassLoader_closure1(DslScriptLoader.groovy:78)
      12:25:56.246 [DEBUG] [TestEventLogger]             at groovy.lang.Closure.call(Closure.java:414)
      12:25:56.247 [DEBUG] [TestEventLogger]             at groovy.lang.Closure.call(Closure.java:430)
      12:25:56.247 [DEBUG] [TestEventLogger]             at javaposse.jobdsl.dsl.DslScriptLoader.runScriptsWithClassLoader(DslScriptLoader.groovy:68)
      12:25:56.247 [DEBUG] [TestEventLogger]             at javaposse.jobdsl.dsl.DslScriptLoader.runScripts(DslScriptLoader.groovy:44)
      12:25:56.247 [DEBUG] [TestEventLogger]             at javaposse.jobdsl.dsl.DslScriptLoader.runScript(DslScriptLoader.groovy:58)
      12:25:56.248 [DEBUG] [TestEventLogger]             at javaposse.jobdsl.dsl.DslScriptLoader.runDslEngine(DslScriptLoader.groovy:182)
      12:25:56.248 [DEBUG] [TestEventLogger]             at com.dslexample.JobScriptsSpec.test script #file.name(JobScriptsSpec.groovy:24)
      12:25:56.248 [DEBUG] [TestEventLogger] 
      12:25:56.248 [DEBUG] [TestEventLogger]             Caused by:
      12:25:56.249 [DEBUG] [TestEventLogger]             groovy.lang.MissingMethodException: No signature of method: javaposse.jobdsl.dsl.helpers.triggers.TriggerContext.pullRequest() is applicable for argument types: (script$_run_closure2$_closure11$_closure16) values: [script$_run_closure2$_closure11$_closure16@37023619]
      12:25:56.249 [DEBUG] [TestEventLogger]                 at javaposse.jobdsl.dsl.AbstractExtensibleContext.methodMissing(AbstractExtensibleContext.groovy:19)
      12:25:56.249 [DEBUG] [TestEventLogger]                 at script.run_closure2$_closure11(script:47)
      12:25:56.249 [DEBUG] [TestEventLogger]                 at script.run_closure2$_closure11(script)
      12:25:56.250 [DEBUG] [TestEventLogger]                 at javaposse.jobdsl.dsl.ContextHelper.executeInContext(ContextHelper.groovy:16)
      12:25:56.250 [DEBUG] [TestEventLogger]                 at javaposse.jobdsl.dsl.Job.triggers(Job.groovy:584)
      12:25:56.250 [DEBUG] [TestEventLogger]                 at script.run_closure2(script:46)
      12:25:56.250 [DEBUG] [TestEventLogger]                 at groovy.lang.Closure.call(Closure.java:414)
      12:25:56.251 [DEBUG] [TestEventLogger]                 at groovy.lang.Closure.call(Closure.java:430)
      12:25:56.251 [DEBUG] [TestEventLogger]                 at javaposse.jobdsl.dsl.JobParent.processItem(JobParent.groovy:134)
      12:25:56.251 [DEBUG] [TestEventLogger]                 at javaposse.jobdsl.dsl.JobParent.freeStyleJob(JobParent.groovy:46)
      12:25:56.251 [DEBUG] [TestEventLogger]                 at javaposse.jobdsl.dsl.JobParent.job(JobParent.groovy:38)
      12:25:56.252 [DEBUG] [TestEventLogger]                 at script.run(script:28)
      12:25:56.252 [DEBUG] [TestEventLogger]                 at javaposse.jobdsl.dsl.DslScriptLoader.runScriptEngine(DslScriptLoader.groovy:129)
      12:25:56.252 [DEBUG] [TestEventLogger]                 ... 8 more
      

      Attachments

        Activity

          daspilker Daniel Spilker added a comment - See https://github.com/jenkinsci/job-dsl-plugin/wiki/Testing-DSL-Scripts
          lawyard LawYard LawYard added a comment - - edited

          Issue is not solved by this manual:

          13:05:29.782 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
          13:05:29.784 [ERROR] [org.gradle.BuildExceptionReporter] 
          13:05:29.786 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
          13:05:29.788 [ERROR] [org.gradle.BuildExceptionReporter] Cannot infer Groovy class path because no Groovy Jar was found on class path: configuration ':compile'
          

          I uses code from your link.

          Then I include in dependencies following code:

          compile 'org.codehaus.groovy:groovy:2.4.7'
          

          And get such error:

          /jenkins/workspace/seed/src/main/groovy/rest/RestApiJobManagement.groovy: 5: unable to resolve class groovyx.net.http.RESTClient
           @ line 5, column 1.
             import groovyx.net.http.RESTClient
             ^
          
          /jenkins/workspace/seed/src/main/groovy/rest/RestApiJobManagement.groovy: 4: unable to resolve class groovyx.net.http.HttpResponseDecorator
           @ line 4, column 1.
             import groovyx.net.http.HttpResponseDecorator
             ^
          
          /jenkins/workspace/seed/src/main/groovy/rest/RestApiJobManagement.groovy: 3: unable to resolve class groovyx.net.http.ContentType
           @ line 3, column 1.
             import groovyx.net.http.ContentType
             ^
          
          /jenkins/workspace/seed/src/main/groovy/rest/RestApiJobManagement.groovy: 8: unable to resolve class MockJobManagement 
           @ line 8, column 1.
             class RestApiJobManagement extends MockJobManagement {
             ^
          

          What am I doing wrong?

          lawyard LawYard LawYard added a comment - - edited Issue is not solved by this manual: 13:05:29.782 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception. 13:05:29.784 [ERROR] [org.gradle.BuildExceptionReporter] 13:05:29.786 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong: 13:05:29.788 [ERROR] [org.gradle.BuildExceptionReporter] Cannot infer Groovy class path because no Groovy Jar was found on class path: configuration ':compile' I uses code from your link. Then I include in dependencies following code: compile 'org.codehaus.groovy:groovy:2.4.7' And get such error: /jenkins/workspace/seed/src/main/groovy/ rest /RestApiJobManagement.groovy: 5: unable to resolve class groovyx.net.http.RESTClient @ line 5, column 1. import groovyx.net.http.RESTClient ^ /jenkins/workspace/seed/src/main/groovy/ rest /RestApiJobManagement.groovy: 4: unable to resolve class groovyx.net.http.HttpResponseDecorator @ line 4, column 1. import groovyx.net.http.HttpResponseDecorator ^ /jenkins/workspace/seed/src/main/groovy/ rest /RestApiJobManagement.groovy: 3: unable to resolve class groovyx.net.http.ContentType @ line 3, column 1. import groovyx.net.http.ContentType ^ /jenkins/workspace/seed/src/main/groovy/ rest /RestApiJobManagement.groovy: 8: unable to resolve class MockJobManagement @ line 8, column 1. class RestApiJobManagement extends MockJobManagement { ^ What am I doing wrong?

          This is a completely different problem and has nothing to do with the original bug report, so do not reopen a closed bug report. Use Stack Overflow or the mailing list to ask questions:

          https://stackoverflow.com/questions/tagged/jenkins-job-dsl
          https://groups.google.com/forum/?fromgroups#!forum/job-dsl-plugin

          The groovyx.net.http package is not contained in groovy-all, you probably need to add a dependency to org.codehaus.groovy.modules.http-builder:http-builder:0.7.2.

          daspilker Daniel Spilker added a comment - This is a completely different problem and has nothing to do with the original bug report, so do not reopen a closed bug report. Use Stack Overflow or the mailing list to ask questions: https://stackoverflow.com/questions/tagged/jenkins-job-dsl https://groups.google.com/forum/?fromgroups#!forum/job-dsl-plugin The groovyx.net.http package is not contained in groovy-all , you probably need to add a dependency to org.codehaus.groovy.modules.http-builder:http-builder:0.7.2 .

          People

            daspilker Daniel Spilker
            lawyard LawYard LawYard
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: