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

hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: anchore.call()

      Plugin works fine when directly used in pipeline script  as below

       

       

      node('some node') {
      stage('Scan Docker Image') {
          imageLine = imageId
          writeFile file: 'anchore_images', text: imageLine
          anchore name: 'anchore_images', inputQueries: [[query: 'list-packages all'], [query: 'list-files        all'], [query: 'cve-scan all'], [query: 'show-pkg-diffs base']]
        }
       }

       

       

      However, when used with shared library script it throws the error

      import groovy.json.JsonSlurper
      def call(body) {
      // evaluate the body block, and collect configuration into the object
      def config = [:]
      body.resolveStrategy = Closure.DELEGATE_FIRST
      body.delegate = config
      body()
      node('some node') {
      stage('Scan Docker Image') {
          imageLine = imageId
          writeFile file: 'anchore_images', text: imageLine
          anchore name: 'anchore_images', inputQueries: [[query: 'list-packages all'], [query: 'list-files        all'], [query: 'cve-scan all'], [query: 'show-pkg-diffs base']]
        }
       }
      }

       

      hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of 
       method: anchore.call() is applicable for argument types: (java.util.LinkedHashMap) values: [[name:anchore_images, inputQueries:[[query:list-packages all], ...]]]
       Possible solutions: wait(), any(), wait(long), main([Ljava.lang.String, any(groovy.lang.Closure), each(groovy.lang.Closure)

          [JENKINS-45311] hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: anchore.call()

          Aditya C S created issue -
          Aditya C S made changes -
          Description Original: Plugin works fine when directly used in pipeline script  as below

           

           
          {code:java}
          node('some node') {
          stage('Scan Docker Image') {
              imageLine = imageId
              writeFile file: 'anchore_images', text: imageLine
              anchore name: 'anchore_images', inputQueries: [[query: 'list-packages all'], [query: 'list-files        all'], [query: 'cve-scan all'], [query: 'show-pkg-diffs base']]
            }
           }{code}
           

           

          However, when used with shared library script it throws the error
          {code:java}
          import groovy.json.JsonSlurper
          def call(body) {
          // evaluate the body block, and collect configuration into the object
          def config = [:]
          body.resolveStrategy = Closure.DELEGATE_FIRST
          body.delegate = config
          body()
          node('some node') {
          stage('Scan Docker Image') {
              imageLine = imageId
              writeFile file: 'anchore_images', text: imageLine
              anchore name: 'anchore_images', inputQueries: [[query: 'list-packages all'], [query: 'list-files        all'], [query: 'cve-scan all'], [query: 'show-pkg-diffs base']]
            }
           }
          }{code}
           
          hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of
          method: anchore.call() is applicable for argument types: (java.util.LinkedHashMap) values: [[name:anchore_images, inputQueries:[[query:list-packages all], ...]]]
          Possible solutions: wait(), any(), wait(long), main([Ljava.lang.String;), any(groovy.lang.Closure), each(groovy.lang.Closure)
          New: Plugin works fine when directly used in pipeline script  as below

           

           
          {code:java}
          node('some node') {
          stage('Scan Docker Image') {
              imageLine = imageId
              writeFile file: 'anchore_images', text: imageLine
              anchore name: 'anchore_images', inputQueries: [[query: 'list-packages all'], [query: 'list-files        all'], [query: 'cve-scan all'], [query: 'show-pkg-diffs base']]
            }
           }{code}
           

           

          However, when used with shared library script it throws the error
          {code:java}
          import groovy.json.JsonSlurper
          def call(body) {
          // evaluate the body block, and collect configuration into the object
          def config = [:]
          body.resolveStrategy = Closure.DELEGATE_FIRST
          body.delegate = config
          body()
          node('some node') {
          stage('Scan Docker Image') {
              imageLine = imageId
              writeFile file: 'anchore_images', text: imageLine
              anchore name: 'anchore_images', inputQueries: [[query: 'list-packages all'], [query: 'list-files        all'], [query: 'cve-scan all'], [query: 'show-pkg-diffs base']]
            }
           }
          }{code}
           
          {code:java}
          hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of
           method: anchore.call() is applicable for argument types: (java.util.LinkedHashMap) values: [[name:anchore_images, inputQueries:[[query:list-packages all], ...]]]
           Possible solutions: wait(), any(), wait(long), main([Ljava.lang.String, any(groovy.lang.Closure), each(groovy.lang.Closure){code}

          Aditya C S added a comment -

          It was my mistake. I had kept a groovy file by name anchore.groovy. So, Jenkins pipeline script was referring to this groovy. Solved by renaming the file.

          Aditya C S added a comment - It was my mistake. I had kept a groovy file by name anchore.groovy. So, Jenkins pipeline script was referring to this groovy. Solved by renaming the file.
          Aditya C S made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

          Daniel Nurmi added a comment -

          Thank you Aditya!  We just started investigating, thank you very much for responding and resolving the ticket.

          -D

          Daniel Nurmi added a comment - Thank you Aditya!  We just started investigating, thank you very much for responding and resolving the ticket. -D
          Mike Reardon made changes -
          Assignee Original: Daniel Nurmi [ nurmi ] New: Mike Reardon [ reardonm ]
          Mike Reardon made changes -
          Assignee Original: Mike Reardon [ reardonm ]
          Mike Reardon made changes -
          Assignee New: Daniel Nurmi [ nurmi ]

            nurmi Daniel Nurmi
            adityacs Aditya C S
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: