You can define this as its own job in the “Job Library” folder and include it as a last step of any workflow you want to generate a one page report for. Create a job with one step that does Miscellaneous -> Evaluate Script.

 

Then, paste in the beanshell script as such:

 

Now you can include this step in any workflow, and it will create a report in the “Reports” tab of the build-life dashboard called “Installation Report”.

 

import com.urbancode.anthill3.domain.jobtrace.*;
import com.urbancode.anthill3.domain.workflow.*;
import com.urbancode.anthill3.domain.buildlife.BuildLife;
import com.urbancode.anthill3.domain.buildlife.BuildLifeFactory;
import com.urbancode.anthill3.domain.workflow.*;
import com.urbancode.anthill3.domain.agent.*;

import com.urbancode.anthill3.runtime.*;
import com.urbancode.devilfish.services.*;

import java.io.*;
import java.util.*;
import com.urbancode.commons.fileutils.FileUtils;


private String getStreamAsString(InputStream inStream)
	throws IOException {
	StringBuffer result = new StringBuffer();
	try {
		byte[] buffer = new byte[4096];
		int length = 0;
		while ((length = inStream.read(buffer)) > 0) {
			result.append(new String(buffer, 0, length));
		}
	} finally {
		try {
			inStream.close();
		} catch (Exception e) {
		}
	}
		return result.toString();
}

WorkflowCase workflow = WorkflowLookup.getCurrentCase();
JobTrace[] jobTraces = workflow.getJobTraceArray();
JobTrace jobTrace = JobTraceLookup.getCurrent();
String publishPath = VarService.getInstance().resolve(PublishPathHelper.getInstance().getPublishPath(jobTrace, "Installation Report"));
FileUtils.assertDirectory(publishPath);
File reportFile = new File(publishPath, "installation-report.html");
BufferedWriter writer = new BufferedWriter(new FileWriter(reportFile));

writer.write(
	"\n" + "\n" +"Anthill3 - Installation Report\n" +
	"" +
	"\n" + "\n" + "\n" + "\n" + "\n"
);

for (int j=0; j"
	);
	StepTrace[] stepTraces = jobTraces[j].getStepTraceArray();
	for (int s=0; s
		");
		
		try{
			CommandTrace cmdTrace = stepTraces[s].getCommandTraceArray()[0];
			FileInfo outputFile = LogPathHelper.getInstance().getLogFileInfoArray(cmdTrace)[0];
			InputStream inStream = FileInfoService.getInstance().getFileInfoAsStream(outputFile);
			String output = getStreamAsString(inStream);
			writer.write(
                                 // change /pr3 to /pre below. Thanks!
				""
			);
		}catch(Exception e) {
			writer.write(
				""
			);
			continue;
		}
	}
}
writer.write("
\n" + "

Installation Report

\n" + "
JOB NAME: " + jobTraces[j].name + "
" + "Agent Name: " + thisAgent.getName() + "
Agent Hostname: " + thisAgent.getHostname() + "
Step:
" + stepTraces[s].getName() + "
Agent Name: " + thisAgent.getName() + "
Agent Hostname: " + thisAgent.getHostname() + "
" + output + "
NO OUTPUT
"); writer.flush(); writer.close();

 

You can download the beanshell script here.