本文整理了Java中hudson.model.AbstractProject.getBuildByNumber()
方法的一些代码示例,展示了AbstractProject.getBuildByNumber()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractProject.getBuildByNumber()
方法的具体详情如下:
包路径:hudson.model.AbstractProject
类名称:AbstractProject
方法名:getBuildByNumber
[英]More efficient implementation.
[中]更有效的实施。
代码示例来源:origin: jenkinsci/jenkins
public DependencyChange(AbstractProject<?,?> project, int fromId, int toId) {
this.project = project;
this.fromId = fromId;
this.toId = toId;
this.from = project.getBuildByNumber(fromId);
this.to = project.getBuildByNumber(toId);
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Works like {@link #getUpstreamRelationship(AbstractProject)} but returns the
* actual build object.
*
* @return
* null if no such upstream build was found, or it was found but the
* build record is already lost.
*/
public AbstractBuild<?,?> getUpstreamRelationshipBuild(AbstractProject<?,?> that) {
int n = getUpstreamRelationship(that);
if (n==-1) return null;
return that.getBuildByNumber(n);
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Performs an installation.
*/
private int install(ToolInstallation t, BuildIDs id, AbstractProject p) throws IOException, InterruptedException {
Run b = p.getBuildByNumber(Integer.parseInt(id.number));
if (b==null)
throw new IllegalStateException("No such build: "+id.number);
Executor exec = b.getExecutor();
if (exec==null)
throw new IllegalStateException(b.getFullDisplayName()+" is not building");
Node node = exec.getOwner().getNode();
if (node == null) {
throw new IllegalStateException("The node " + exec.getOwner().getDisplayName() + " has been deleted");
}
t = t.translate(node, EnvVars.getRemote(checkChannel()), new StreamTaskListener(stderr));
stdout.println(t.getHome());
return 0;
}
代码示例来源:origin: jenkinsci/jenkins
protected int run() throws Exception {
// this allows the caller to manipulate the JVM state, so require the execute script privilege.
Jenkins.getActiveInstance().checkPermission(Jenkins.RUN_SCRIPTS);
Binding binding = new Binding();
binding.setProperty("out",new PrintWriter(stdout,true));
binding.setProperty("stdin",stdin);
binding.setProperty("stdout",stdout);
binding.setProperty("stderr",stderr);
binding.setProperty("channel",channel);
if (channel != null) {
String j = getClientEnvironmentVariable("JOB_NAME");
if (j != null) {
Item job = Jenkins.getActiveInstance().getItemByFullName(j);
binding.setProperty("currentJob", job);
String b = getClientEnvironmentVariable("BUILD_NUMBER");
if (b != null && job instanceof AbstractProject) {
Run r = ((AbstractProject) job).getBuildByNumber(Integer.parseInt(b));
binding.setProperty("currentBuild", r);
}
}
}
GroovyShell groovy = new GroovyShell(Jenkins.getActiveInstance().getPluginManager().uberClassLoader, binding);
groovy.run(loadScript(),"RemoteClass",remaining.toArray(new String[remaining.size()]));
return 0;
}
代码示例来源:origin: jenkinsci/jenkins
@Override
public String getWhyKeepLog() {
// if any of the downstream project is configured with 'keep dependency component',
// we need to keep this log
OUTER:
for (AbstractProject<?,?> p : getParent().getDownstreamProjects()) {
if (!p.isKeepDependencies()) continue;
AbstractBuild<?,?> fb = p.getFirstBuild();
if (fb==null) continue; // no active record
// is there any active build that depends on us?
for (int i : getDownstreamRelationship(p).listNumbersReverse()) {
// TODO: this is essentially a "find intersection between two sparse sequences"
// and we should be able to do much better.
if (i<fb.getNumber())
continue OUTER; // all the other records are younger than the first record, so pointless to search.
AbstractBuild<?,?> b = p.getBuildByNumber(i);
if (b!=null)
return Messages.AbstractBuild_KeptBecause(p.hasPermission(Item.READ) ? b.toString() : "?");
}
}
return super.getWhyKeepLog();
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
public DependencyChange(AbstractProject<?,?> project, int fromId, int toId) {
this.project = project;
this.fromId = fromId;
this.toId = toId;
this.from = project.getBuildByNumber(fromId);
this.to = project.getBuildByNumber(toId);
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
public DependencyChange(AbstractProject<?,?> project, int fromId, int toId) {
this.project = project;
this.fromId = fromId;
this.toId = toId;
this.from = project.getBuildByNumber(fromId);
this.to = project.getBuildByNumber(toId);
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
public DependencyChange(AbstractProject<?,?> project, int fromId, int toId) {
this.project = project;
this.fromId = fromId;
this.toId = toId;
this.from = project.getBuildByNumber(fromId);
this.to = project.getBuildByNumber(toId);
}
代码示例来源:origin: etsy/jenkins-master-project
public AbstractBuild findBuild(AbstractProject project, int buildNumber) {
if (project == null) return null;
try {
return (AbstractBuild) project.getBuildByNumber(buildNumber);
} catch (java.lang.NullPointerException e) {
return null;
}
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
public DependencyChange(AbstractProject<?, ?> project, int fromId, int toId) {
this.project = project;
this.fromId = fromId;
this.toId = toId;
this.from = project.getBuildByNumber(fromId);
this.to = project.getBuildByNumber(toId);
}
代码示例来源:origin: hudson/hudson-2.x
public DependencyChange(AbstractProject<?,?> project, int fromId, int toId) {
this.project = project;
this.fromId = fromId;
this.toId = toId;
this.from = project.getBuildByNumber(fromId);
this.to = project.getBuildByNumber(toId);
}
代码示例来源:origin: jenkinsci/analysis-core-plugin
/**
* Added for backward compatibility. It generates <pre>AbstractBuild getReferenceBuild()</pre> bytecode during the build
* process, so old implementations can use that signature.
*
* @see {@link WithBridgeMethods}
*/
@Deprecated
private final Object getReferenceAbstractBuild(Run owner, Class targetClass) {
return owner instanceof AbstractBuild ? ((AbstractBuild) owner).getProject().getBuildByNumber(referenceBuild) : null;
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Works like {@link #getUpstreamRelationship(AbstractProject)} but returns the
* actual build object.
*
* @return
* null if no such upstream build was found, or it was found but the
* build record is already lost.
*/
public AbstractBuild<?,?> getUpstreamRelationshipBuild(AbstractProject<?,?> that) {
int n = getUpstreamRelationship(that);
if (n==-1) return null;
return that.getBuildByNumber(n);
}
代码示例来源:origin: jenkinsci/promoted-builds-plugin
@CheckForNull
public AbstractBuild<?,?> resolve(PromotionProcess parent) {
AbstractBuild<?,?> build = this.resolve();
if (build !=null){
return build;
}
//In case of project renamed.
AbstractProject<?,?> j = parent.getOwner();
if (j==null) return null;
return j.getBuildByNumber(number);
}
代码示例来源:origin: jenkinsci/promoted-builds-plugin
@CheckForNull
public AbstractBuild<?,?> resolve() {
AbstractProject<?,?> j = JenkinsHelper.getInstance().getItemByFullName(jobName, AbstractProject.class);
if (j==null) return null;
return j.getBuildByNumber(number);
}
代码示例来源:origin: org.jvnet.hudson.plugins/groovy-postbuild
public boolean setBuildNumber(int buildNumber) {
AbstractBuild<?, ?> newBuild = build.getProject().getBuildByNumber(buildNumber);
setBuild(newBuild);
return (newBuild != null);
}
public BuildListener getListener() {
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
protected int run() throws Exception {
Run run = job.getBuildByNumber(number);
run.checkPermission(Run.UPDATE);
if ("=".equals(description)) {
description = channel.call(new Callable<String,IOException>() {
public String call() throws IOException {
return IOUtils.toString(System.in);
}
});
}
run.setDescription(description);
return 0;
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
protected int run() throws Exception {
Run run = job.getBuildByNumber(number);
run.checkPermission(Run.UPDATE);
if ("=".equals(description)) {
description = channel.call(new Callable<String,IOException>() {
public String call() throws IOException {
return IOUtils.toString(System.in);
}
});
}
run.setDescription(description);
return 0;
}
代码示例来源:origin: org.eclipse.hudson/hudson-service
public AbstractBuild<?, ?> findBuild(final AbstractProject<?, ?> project, final int buildNumber) {
checkNotNull(project, "project");
checkBuildNumber(buildNumber);
AbstractBuild<?, ?> build = project.getBuildByNumber(buildNumber);
if (build != null) {
this.security.checkPermission(build, Item.READ);
}
return build;
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-service
public AbstractBuild<?,?> findBuild(final AbstractProject<?, ?> project, final int buildNumber) {
checkNotNull(project, "project");
checkBuildNumber(buildNumber);
AbstractBuild<?,?> build = project.getBuildByNumber(buildNumber);
if (build != null) {
this.security.checkPermission(build, Item.READ);
}
return build;
}
内容来源于网络,如有侵权,请联系作者删除!