提交 c83e846f 编写于 作者: M mindless

[FIXED HUDSON-6925] Support LogRotator deletion of old artifacts in

multiconfiguration(matrix) projects, based on patch from cjo9900.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@33178 71c3de6d-444a-0410-be80-ed276b4c234a
上级 e444f5bd
/*
* The MIT License
*
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
......@@ -40,15 +40,25 @@ import java.io.IOException;
* @author Kohsuke Kawaguchi
*/
final class LinkedLogRotator extends LogRotator {
LinkedLogRotator(int artifactDaysToKeep, int artifactNumToKeep) {
super(-1, -1, artifactDaysToKeep, artifactNumToKeep);
}
/**
* @deprecated since 1.369
* Use {@link #LinkedLogRotator(int, int)}
*/
LinkedLogRotator() {
super(-1,-1);
super(-1, -1, -1, -1);
}
@Override
public void perform(Job _job) throws IOException, InterruptedException {
// copy it to the array because we'll be deleting builds as we go.
// Let superclass handle clearing artifacts, if configured:
super.perform(_job);
MatrixConfiguration job = (MatrixConfiguration) _job;
// copy it to the array because we'll be deleting builds as we go.
for( MatrixRun r : job.getBuilds().toArray(new MatrixRun[0]) ) {
if(job.getParent().getBuildByNumber(r.getNumber())==null)
r.delete();
......
/*
* The MIT License
*
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Tom Huybrechts
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi, Tom Huybrechts
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
......@@ -240,7 +240,9 @@ public class MatrixConfiguration extends Project<MatrixConfiguration,MatrixRun>
@Override
public LogRotator getLogRotator() {
return new LinkedLogRotator();
LogRotator lr = getParent().getLogRotator();
return new LinkedLogRotator(lr != null ? lr.getArtifactDaysToKeep() : -1,
lr != null ? lr.getArtifactNumToKeep() : -1);
}
@Override
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册