Skip to content

Instantly share code, notes, and snippets.

@adampats
Last active June 1, 2017 23:43
Show Gist options
  • Save adampats/c059babc01c2e1b65f68b0d4d8da3059 to your computer and use it in GitHub Desktop.
Save adampats/c059babc01c2e1b65f68b0d4d8da3059 to your computer and use it in GitHub Desktop.
Jenkinsfile Shared Library
@Library('jenkinsfile-library')
import com.foo.Methods
node {
def m = new com.foo.Methods()
def ip = m.getPublicIP()
echo ip
}
#!/usr/bin/env groovy
package com.foo
class Methods implements Serializable {
static def getPublicIP() {
sh returnStdout: true, script: 'curl icanhazip.com'
}
}
@adampats
Copy link
Author

adampats commented Jun 1, 2017

Error message from line 6 of Jenkinsfile:

hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: static com.foo.Methods.sh() is 
applicable for argument types: (java.util.LinkedHashMap) values: [[returnStdout:true, script:curl icanhazip.com]]
Possible solutions: is(java.lang.Object), use([Ljava.lang.Object;), any(), any(groovy.lang.Closure), 
each(groovy.lang.Closure), use(java.lang.Class, groovy.lang.Closure)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment