hudson.model.AbstractBuild.save()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(10.1k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中hudson.model.AbstractBuild.save()方法的一些代码示例,展示了AbstractBuild.save()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractBuild.save()方法的具体详情如下:
包路径:hudson.model.AbstractBuild
类名称:AbstractBuild
方法名:save

AbstractBuild.save介绍

暂无

代码示例

代码示例来源:origin: org.hudsonci.plugins/claim

public void save() throws IOException {
  build.save();
}

代码示例来源:origin: jenkinsci/promoted-builds-plugin

/**
 * Called when the build is qualified.
 */
public synchronized boolean add(Status status) throws IOException {
  for (Status s : statuses)
    if(s.name.equals(status.name))
      return false; // already qualified. noop.
  this.statuses.add(status);
  status.parent = this;
  owner.save();
  return true;
}

代码示例来源:origin: jenkinsci/testng-plugin-plugin

private void countAndSave(TestNGResult testngResults) {
  int savedPassCount = passCount != null ? passCount : -1;
  int savedFailCount = failCount;
  int savedSkipCount = skipCount;
  count(testngResults);
  if (passCount != savedPassCount || failCount != savedFailCount || skipCount != savedSkipCount) {
    LOGGER.log(Level.FINE, "saving {0}", owner);
    try {
      owner.save();
    } catch (IOException x) {
      LOGGER.log(Level.WARNING, "failed to save " + owner, x);
    }
  }
}

代码示例来源:origin: jenkinsci/docker-plugin

private void addJenkinsAction(AbstractBuild build, String dockerHost, String containerId, String tag_image) throws IOException {
  build.addAction(new DockerBuildAction(dockerHost, containerId, tag_image));
  build.save();
}

代码示例来源:origin: org.jenkins-ci.plugins/disk-usage

public static void addBuildDiskUsageAction(AbstractBuild build){
  BuildDiskUsageAction action = null;
  for(Action a: build.getActions()){
    if(a instanceof BuildDiskUsageAction){
      action = (BuildDiskUsageAction) a;
      break;
    }
  }
  if(action == null){
    build.addAction(new BuildDiskUsageAction(build));
    try {
      build.save();
    } catch (IOException ex) {
      Logger.getLogger(DiskUsageUtil.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
}
  public static void calculateDiskUsageForBuild(String buildId, AbstractProject project)

代码示例来源:origin: org.jvnet.hudson.plugins/jira

private void saveIssues(AbstractBuild<?, ?> build, JiraBuildAction a,
    Set<JiraIssue> issuesToBeSaved) {
  if (a != null) {
    a.addIssues(issuesToBeSaved);
  } else {
    JiraBuildAction action = new JiraBuildAction(build, issuesToBeSaved);
    build.addAction(action);
  }
  
  try {
    build.save();
  } catch (final IOException e) {
    LOGGER.log(Level.WARNING, "Error saving updated build", e);
  }
}

代码示例来源:origin: jenkinsci/tfs-plugin

public void save() throws IOException {
  if (!workspaceExists()) {
    build.getAction(WorkspaceConfiguration.class).setWorkspaceWasRemoved();
  }
  build.save();
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

public synchronized HttpResponse doSubmitDescription(
    @QueryParameter String description) throws IOException,
    ServletException {
  if (getOwner() == null) {
    LOGGER.severe("getOwner() is null, can't save description.");
  } else {
    getOwner().checkPermission(Run.UPDATE);
    setDescription(description);
    getOwner().save();
  }
  return new HttpRedirect(".");
}
private static final long serialVersionUID = 1L;

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

public synchronized HttpResponse doSubmitDescription(
    @QueryParameter String description) throws IOException,
    ServletException {
  if (getOwner() == null) {
    LOGGER.severe("getOwner() is null, can't save description.");
  } else {
    getOwner().checkPermission(Run.UPDATE);
    setDescription(description);
    getOwner().save();
  }
  return new HttpRedirect(".");
}
private static final long serialVersionUID = 1L;

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

public synchronized HttpResponse doSubmitDescription(
    @QueryParameter String description) throws IOException,
    ServletException {
  if (getOwner() == null) {
    LOGGER.severe("getOwner() is null, can't save description.");
  } else {
    getOwner().checkPermission(Run.UPDATE);
    setDescription(description);
    getOwner().save();
  }
  return new HttpRedirect(".");
}
private static final long serialVersionUID = 1L;

代码示例来源:origin: hudson/hudson-2.x

public synchronized HttpResponse doSubmitDescription(
    @QueryParameter String description) throws IOException,
    ServletException {
  if (getOwner() == null) {
    LOGGER.severe("getOwner() is null, can't save description.");
  } else {
    getOwner().checkPermission(Run.UPDATE);
    setDescription(description);
    getOwner().save();
  }
  return new HttpRedirect(".");
}
private static final long serialVersionUID = 1L;

代码示例来源:origin: jenkinsci/promoted-builds-plugin

@CheckForNull
public Future<Promotion> approve(AbstractBuild<?,?> build, PromotionProcess promotionProcess, List<ParameterValue> paramValues) throws IOException{
  if (canApprove(promotionProcess, build)) {            
    // add approval to build
    ManualApproval approval=new ManualApproval(promotionProcess.getName(), paramValues);
    build.addAction(approval);
    build.save();
    // check for promotion
    return promotionProcess.considerPromotion2(build, approval);
  }
  return null;
}
public List<ParameterValue> createDefaultValues(){

代码示例来源:origin: org.jvnet.hudson.plugins/groovy-postbuild

@Override
public final boolean perform(final AbstractBuild<?, ?> build, final Launcher launcher, final BuildListener listener) throws InterruptedException, IOException {
  Hudson.getInstance().checkPermission(Hudson.ADMINISTER);
  LOGGER.fine("perform() called for script:\n" + groovyScript);
  
  BadgeManager badgeManager = new BadgeManager(build, listener);
  GroovyShell shell = new GroovyShell();
  shell.setVariable("manager", badgeManager);
  try {
    shell.evaluate(groovyScript);
  } catch (Exception e) {
    e.printStackTrace(listener.error("Failed to evaluate groovy script."));
  }
  for(AbstractBuild<?, ?> b : badgeManager.builds) {
    b.save();
  }
  return build.getResult().isBetterThan(Result.FAILURE);
}

代码示例来源:origin: org.jvnet.hudson.plugins/perforce

public void tagBuild(String tagname, String description) throws IOException {
  tag = tagname;
  desc = description;
  Label label = new Label();
  label.setName(tag);
  label.setDescription(desc);
  label.setRevision(new Integer(changeNumber).toString());
  //Only take the depot paths and add them to the view.
  List<String> viewPairs = PerforceSCM.parseProjectPath(view, "workspace");
  for (int i=0; i < viewPairs.size(); i+=2){
    String depotPath = viewPairs.get(i);
    label.addView(depotPath);
  }
  try {
    depot.getLabels().saveLabel(label);
  } catch(PerforceException e) {
    tag = null;
    desc = null;
    e.printStackTrace();
    throw new IOException("Failed to issue perforce label." + e.getMessage());
  }
  build.save();
}

代码示例来源:origin: org.jenkins-ci.plugins/disk-usage

public synchronized void loadFirstTime(){
  load();
  buildDiskUsage = new HashSet<DiskUsageBuildInformation>();
  List<Run> list = job.getBuilds();
  for(Run run : list){
    if(run instanceof AbstractBuild){
      AbstractBuild build = (AbstractBuild) run;
      BuildDiskUsageAction usage = run.getAction(BuildDiskUsageAction.class);
      DiskUsageBuildInformation information = new DiskUsageBuildInformation(build.getId(), build.getTimeInMillis(), build.number, 0l);
      buildDiskUsage.add(information);
      if(usage==null){
        run.getActions().add(new BuildDiskUsageAction(build));
        try {
          build.save();
        } catch (IOException ex) {
          Logger.getLogger(ProjectDiskUsage.class.getName()).log(Level.SEVERE, null, ex);
        }
      }
      else{
        information.setSize(usage.buildDiskUsage);
      }
      DiskUsageUtil.addBuildDiskUsageAction(build);
    }
  }
  DiskUsageProperty property = (DiskUsageProperty) job.getProperty(DiskUsageProperty.class);
  property.checkWorkspaces(true);
  save();
}

代码示例来源:origin: org.hudsonci.plugins/disk-usage

build.save();

代码示例来源:origin: jenkinsci/promoted-builds-plugin

/**
 * Promote the given build by using the given qualification.
 *
 * @param build Build to promote
 * @param cause Why the build is promoted?
 * @param qualification Initial promotion status
 * @param params Promotion parameters
 * @return Future to track the completion of the promotion.
 * @throws IOException Promotion failure
 */
public Future<Promotion> promote2(AbstractBuild<?,?> build, Cause cause, Status qualification, List<ParameterValue> params) throws IOException {
  PromotedBuildAction a = build.getAction(PromotedBuildAction.class);
  // build is qualified for a promotion.
  if(a!=null) {
    a.add(qualification);
  } else {
    build.addAction(new PromotedBuildAction(build,qualification));
    build.save();
  }
  // schedule promotion activity.
  return scheduleBuild2(build,cause, params);
}

代码示例来源:origin: org.jvnet.hudson.main/maven-plugin

protected void perform(TaskListener listener) throws Exception {
    try {
      MavenEmbedder embedder = MavenUtil.createEmbedder(listener,getBuild());
      ArtifactRepositoryLayout layout =
        (ArtifactRepositoryLayout) embedder.lookup( ArtifactRepositoryLayout.class,"default");
      ArtifactRepositoryFactory factory =
        (ArtifactRepositoryFactory) embedder.lookup(ArtifactRepositoryFactory.ROLE);
      ArtifactRepository repository = factory.createDeploymentArtifactRepository(
          id, repositoryUrl, layout, uniqueVersion);
      WrappedArtifactRepository repo = new WrappedArtifactRepository(repository, uniqueVersion);
      deploy(embedder,repo,listener);
      record.result = Result.SUCCESS;
    } finally {
      if(record.result==null)
        record.result = Result.FAILURE;
      // persist the record
      getBuild().save();
    }
  }
}.start();

代码示例来源:origin: jenkinsci/maven-plugin

protected void perform(TaskListener listener) throws Exception {
    try {
      MavenEmbedder embedder = MavenUtil.createEmbedder(listener,getBuild());
      ArtifactRepositoryLayout layout =
        embedder.lookup( ArtifactRepositoryLayout.class,"default");
      ArtifactRepositoryFactory factory =
        (ArtifactRepositoryFactory) embedder.lookup(ArtifactRepositoryFactory.ROLE);
      ArtifactRepository repository = factory.createDeploymentArtifactRepository(
          id, repositoryUrl, layout, uniqueVersion);
      WrappedArtifactRepository repo = new WrappedArtifactRepository(repository, uniqueVersion);
      deploy(embedder,repo,listener);
      record.result = Result.SUCCESS;
    } finally {
      if(record.result==null)
        record.result = Result.FAILURE;
      // persist the record
      getBuild().save();
    }
  }
}.start();

代码示例来源:origin: jenkinsci/promoted-builds-plugin

protected void post2(BuildListener listener) throws Exception {
  if (getTarget() == null) {
    listener.error("No Promotion target, cannot save target or update status");
    return;
  }
  if(getResult()== Result.SUCCESS)
    getStatus().onSuccessfulPromotion(Promotion.this);
  // persist the updated build record
  getTarget().save();
  if (getResult() == Result.SUCCESS) {
    // we should evaluate any other pending promotions in case
    // they had a condition on this promotion
    PromotedBuildAction pba = getTarget().getAction(PromotedBuildAction.class);
    for (PromotionProcess pp : pba.getPendingPromotions()) {
      pp.considerPromotion2(getTarget());
    }
    // tickle PromotionTriggers
    for (AbstractProject<?,?> p : JenkinsHelper.getInstance().getAllItems(AbstractProject.class)) {
      PromotionTrigger pt = p.getTrigger(PromotionTrigger.class);
      if (pt!=null)
        pt.consider(Promotion.this);
    }
  }
}

相关文章

微信公众号

最新文章

更多

AbstractBuild类方法