Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Error to get "clean up strategy's reserve days" : ((ReserveBuildsByDays) targetConf.getBuildCleanupStrategy()).getReserveDays(); #3745

jisuson ·

I set "15" to build clean up days but when I execute below script, it just returns infinite number..

groovy:
import com.pmease.quickbuild.*;
import com.pmease.quickbuild.setting.configuration.buildcleanup.ReserveBuildsByDays;

def targetConf = system.configurationManager.get(${vars.getValue("ConfigurationName")});
if (targetConf == null)
  throw new QuickbuildException("Unable to find target configuration.");
def builds = system.buildManager.getBuilds(targetConf);
def reserveDays = ((ReserveBuildsByDays)targetConf.getBuildCleanupStrategy()).getReserveDays();

Log:

java.lang.NumberFormatException: For input string: "15151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151

I don't know how to fix it.. Any body save me ? T_T

  • replies 3
  • views 1725
  • stars 0
robinshen ADMIN ·

Will below work?

def reserveDays = ((ReserveBuildsByDays)targetConf.getBuildCleanupStrategy()).getReserveDays().toInteger()
#3
steveluo added the scripts label
#4
steveluo changed title from Error to get "clean up strategy's reserve days" : ((ReserveBuildsByDays)targetConf.getBuildCleanupStrategy()).getReserveDays(); to Error to get "clean up strategy's reserve days" : ((ReserveBuildsByDays) targetConf.getBuildCleanupStrategy()).getReserveDays();