
hudson.cli.DeleteBuildsCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hudson-core Show documentation
Show all versions of hudson-core Show documentation
Contains the core Hudson code and view files to render HTML.
The newest version!
/*******************************************************************************
*
* Copyright (c) 2004-2010, Oracle Corporation.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
*
*
*
*
*******************************************************************************/
package hudson.cli;
import hudson.Extension;
import hudson.model.AbstractBuild;
import hudson.model.Run;
import java.io.IOException;
import java.io.PrintStream;
import java.util.List;
/**
* Deletes builds records in a bulk.
*
* @author Kohsuke Kawaguchi
*/
@Extension
public class DeleteBuildsCommand extends AbstractBuildRangeCommand {
@Override
public String getShortDescription() {
return "Deletes build record(s)";
}
@Override
protected void printUsageSummary(PrintStream stderr) {
stderr.println(
"Delete build records of a specified job, possibly in a bulk. ");
}
@Override
protected int act(List> builds) throws IOException {
job.checkPermission(Run.DELETE);
for (AbstractBuild build : builds) {
build.delete();
}
stdout.println("Deleted " + builds.size() + " builds");
return 0;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy