Version Differences for Miscellaneous Scripts

(AHPSCRIPTS-95)
(AHPSCRIPTS-96)
Line 1569:
  e.printStackTrace(commandOutput);     e.printStackTrace(commandOutput);  
  }</pre>    }</pre> 
       
    + = Build Step Via Script and Run It =  
    + * This was created for a customer who wanted to change some inputs to our CvsGetChangelog Step, but could be used for other steps as well.  
       
    + ==== AHPSCRIPTS-98 ====  
    + <pre>import com.urbancode.anthill3.domain.source.cvs.CvsGetChangelogStepConfig;  
    + import com.urbancode.anthill3.domain.buildlife.*;  
    + import com.urbancode.anthill3.services.jobs.*;  
    + import org.apache.log4j.Logger;  
    + Logger log = Logger.getLogger("script");  
       
    + CvsGetChangelogStepConfig stepConfig = new CvsGetChangelogStepConfig();  
    + var status = StatusLookup.getStatusByName("passed-tests");  
       
    + BuildLife buildLife = BuildLifeLookup.mostRecentByStatus(status);  
    + if (buildLife == null) {  
    + var array = BuildLifeFactory.getInstance().restoreAllBefore(BuildLifeLookup.getCurrent());  
    + for (int i = array.length - 1; i >= 0; i--) {  
    + var curBuildLife = array[i];  
    + if (curBuildLife.hasStatus(ProjectLookup.getCurrent().getStatusGroup().getSuccessStatus())) {  
    + buildLife = curBuildLife;  
    + break;  
    + }  
    + }  
    + }  
       
    + stepConfig.setStartDate(buildLife.getActualWorkspaceDate());  
    + var step = stepConfig.buildStep();  
    + var stepExecutor = StepExecutor.getCurrent();  
    + step.setAgent(JobTraceLookup.getCurrent().getAgent());  
       
    + try {  
    + stepExecutor.execute(step, "Generated Changelog Step");  
    + }  
    + catch (Throwable e) {  
    + log.error("Exception:", e);  
    + }</pre>