I didn’t notice that the return value should be ‘true’ for groovy scripts.  
This script works great.  The only drawback I’ve seen of using script trigger 
vs the built in scheduling is script trigger is not compatible with next 
executions, you will not see the next time the script will be evaluated.

Thanks again for the help!

println("Checking time of last successful run to determine if regression is 
needed")
def item = hudson.model.Hudson.instance.getItem("$JOB_NAME")
def build = item.getLastSuccessfulBuild()
def last_success_time = build.getTime()
println(last_success_time.time)
def today = new Date()

def hours_since_run = (today.time - last_success_time.time) / (60 * 60 * 1000)
println hours_since_run

if (hours_since_run < 20)
{
println("Ran successfully $hours_since_run ago, skipping automatic regression")
return false
}
else
{
println("Running regression")
return true
}

-- 
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/DM2PR05MB7175869417AF1F5E2625C0FB8460%40DM2PR05MB717.namprd05.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to