The problem is that you are using Groovy method call syntax, but the name of the method is `getPreviousBuild`, so you should use `currentBuild.getPreviousBuild()`. You could also use `currentBuild.previousBuild` with no parentheses, since Groovy has syntactic sugar for accessing getter methods using property syntax.
> On Apr 12, 2020, at 18:29, Rajesh M <[email protected]> wrote: > > Hi, > > I am trying to get a variable value from last successful build, but getting > error "groovy.lang.MissingMethodException: No signature of method: > org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper.previousBuild() > is applicable for argument types: () values: []". > > void lastSuccessSVNRevision() { > def lastSuccessSVNRev = 0 > def build = currentBuild.previousBuild() > while (build != null) { > if (build.result == "SUCCESS") > { > lastSuccessSVNRev = build.getRawBuild().actions.find{ it > instanceof ParametersAction }?.parameters.find{it.name == > 'SVN_REVISION'}?.value > break > } > build = build.previousBuild() > } > } > > Could you someone help me to get the variable value from last success build. > > Thanks, > Rajesh M > > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-users/ae6d7cec-7b35-406f-9f26-dcad534a1eba%40googlegroups.com > > <https://groups.google.com/d/msgid/jenkinsci-users/ae6d7cec-7b35-406f-9f26-dcad534a1eba%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/33179141-0395-458D-AB5A-92DF3D4612DA%40cloudbees.com.
