Create "lastStable" symlink on the file system to point to the applicable build.

(<a href="http://www.nabble.com/lastStable-link-td21582859.html">report</a>)


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@14729 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2009-01-22 22:59:55 +00:00
1 parent 99a09d9672
commit 94530bc5f0
1 file changed
+12 -11
@@ -243,21 +243,22 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
Result result = doRun(listener);
// the two if statements here are a real mess.
// the "return null to mean success" convention is not very consistent
// so we should probably get rid of that. And in the mean time
// this check will allows us to create symlinks
if(result!=null && result!=Result.SUCCESS)
return result; // abort here
// this is ugly, but for historical reason, if non-null value is returned
// it should become the final say.
if(result==null) result = getResult();
if(result==null) result = Result.SUCCESS;
if(getResult()==null || getResult()==Result.SUCCESS)
createLastSuccessfulLink(listener);
if(result.isBetterOrEqualTo(Result.UNSTABLE))
createSymLink(listener,"lastSuccessful");
return Result.SUCCESS;
if(result.isBetterOrEqualTo(Result.SUCCESS))
createSymLink(listener,"lastStable");
return result;
}
private void createLastSuccessfulLink(BuildListener listener) throws InterruptedException {
Util.createSymlink(getProject().getBuildDir(),"builds/"+getId(),"../lastSuccessful",listener);
private void createSymLink(BuildListener listener, String name) throws InterruptedException {
Util.createSymlink(getProject().getBuildDir(),"builds/"+getId(),"../"+name,listener);
}
private boolean checkout(BuildListener listener) throws Exception {