Hi,
I have a job to do some cleanup in Jenkins.
the job is defined to run a "Execute system Groovy script" as build step. The
code contains something like:
import hudson.FilePath
import hudson.model.*
final GROOVY_SCRIPT ="scripts/do_job_cleanup.groovy"
evaluate(new FilePath(build.workspace,GROOVY_SCRIPT).read().text)
and within the script:
doCleanup() // code that checks and deletes stuff we want removed
if ( nrIssues > issueThreshold ) {
println("ERROR: too many issuesfound")
//currentBuild.result = 'FAIL'
manager.buildFailure()
}
During cleanup issues may be found; if we found too many, I want to set status
of the job to unstable or even fail, depending on some threshold.
Whatever I try, I always get an error when trying to set the status:
ERROR:Build step failed with exception
groovy.lang.MissingPropertyException:No such property: manager for class:
Script1
atorg.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
atorg.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:52)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:307)
at Script1.run(Script1.groovy:501)
I have almost identical code used in another job where the Groovy is run as a
postbuild step; then it works fine.
Why not here ??
thx, 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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/794414828.795738.1555063665312%40mail.yahoo.com.
For more options, visit https://groups.google.com/d/optout.