我是 Jenkins 新手,我想使用 powershell 脚本获取 Jenkins 过去 15 天的所有作业的详细信息。我会通过邮件将 Jenkin 作业的详细信息发送给我的经理。如果有人能解决我的问题,我将不胜感激。
我已经尝试过以下脚本。
Hour=24;. Minute=60;. Second=60; oneDayInSecond=hourminutesecond;. sevenDayInSecond=hourminutesecond*7;. now=Calendar.instance;. List=[];. Println("${now.time}");
checkNewProjects(Hudson.instance.items).
def checkNewProjects(items). { For (items in items) { last_build = items.lastbuild //or item.getlastbuild(). If (last_build) {. build_time = last_build.timestamp. If (now.time.time/1000-build_time.time.time/1000<sevenDayInSecond) {. item.save(). Println(item.name). Println("\t\tlast build was built in less than 7 days"); Println("\t\tlast built was at ${build_time.time); . list<< item; }. }. }. }.