When execute Jenkins manually or by scheduler, the execution time varies extremely different. This is based on the code below:
Code:
echo "BEFORE items.findAll."
def matchedJobs = Jenkins.instance.items.findAll { it.name.toUpperCase().startsWith(projectName.toUpperCase()) }
echo "AFTER items.findAll."
Console:
Start the build manual:
17:25:41 BEFORE items.findAll.
17:27:00 AFTER items.findAll.
Build started by scheduler:
17:32:18 BEFORE items.findAll.
17:32:18 AFTER items.findAll.