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.
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.
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.
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.