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); }
/** * 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); }
/** * 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; }
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; }
@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(); }
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); }
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); }
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); }
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; } }
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); }
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); }
/** * 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; }
/** * 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); }
@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); }
@CheckForNull public AbstractBuild<?,?> resolve() { AbstractProject<?,?> j = JenkinsHelper.getInstance().getItemByFullName(jobName, AbstractProject.class); if (j==null) return null; return j.getBuildByNumber(number); }
public boolean setBuildNumber(int buildNumber) { AbstractBuild<?, ?> newBuild = build.getProject().getBuildByNumber(buildNumber); setBuild(newBuild); return (newBuild != null); } public BuildListener getListener() {
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; }
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; }
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; }
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; }