Thanks Devin. I have tried these, but getting "No such property: 
lastSuccessSVNRev for class: Script2" error. I am new to groovy, so 
couldn't find why it is causing.

On Monday, 13 April 2020 16:36:19 UTC+2, Devin Nusbaum wrote:
>
> 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] <javascript:>> 
> 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] <javascript:>.
> 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>
> .
>
>
>
On Monday, 13 April 2020 16:36:19 UTC+2, Devin Nusbaum wrote:
>
> 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] <javascript:>> 
> 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] <javascript:>.
> 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/f1da0dc0-3ac5-4432-9a1f-71e62148156a%40googlegroups.com.

Reply via email to