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

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

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

AbstractBuild.doStop介绍

[英]Stops this build if it's still going. If we use this/executor/stop URL, it causes 404 if the build is already killed, as #getExecutor() returns null.
[中]如果仍在运行,则停止此生成。如果我们使用这个/executor/stop URL,如果构建已经被终止,它将导致404,因为#getExecutor()返回null。

代码示例

代码示例来源:origin: jenkinsci/jenkins

/**
 * @deprecated as of 1.489
 *      Use {@link #doStop()}
 */
@Deprecated
@RequirePOST // #doStop() should be preferred, but better to be safe
public void doStop(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
  doStop().generateResponse(req,rsp,this);
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * @deprecated as of 1.489
 *      Use {@link #doStop()}
 */
@Deprecated
@RequirePOST // #doStop() should be preferred, but better to be safe
public void doStop(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
  doStop().generateResponse(req,rsp,this);
}

代码示例来源:origin: Diabol/delivery-pipeline-plugin

@Override
public void abortBuild(String projectName, String buildId) throws TriggerException {
  AbstractProject project = ProjectUtil.getProject(projectName, Jenkins.getInstance());
  if (!project.hasPermission(Item.CANCEL)) {
    throw new BadCredentialsException("Not authorized to abort build");
  }
  AbstractBuild build = project.getBuildByNumber(Integer.parseInt(buildId));
  try {
    build.doStop();
  } catch (IOException | ServletException e) {
    throw new TriggerException("Could not abort build");
  }
}

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

public void stopBuild(final AbstractProject<?, ?> project, final int buildNumber){
  AbstractBuild<?, ?> build = getBuild(project, buildNumber);
  log.debug("Stopping build: {} #{}", project.getName(), buildNumber);
  try {
    // Security: doStop eventually checks to see if the task owner has permission to abort the build
    build.doStop(DummyStaplerRequest.INSTANCE, DummyStaplerResponse.INSTANCE);
  } catch (IOException e) {
    throw new ServiceRuntimeException("Stop failed for " + project.getName() + " #" + buildNumber, e);
  } catch (ServletException e) {
    throw new ServiceRuntimeException("Stop failed for " + project.getName() + " #" + buildNumber, e);
  }
}

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

public void stopBuild(final AbstractProject<?, ?> project, final int buildNumber) {
    AbstractBuild<?, ?> build = getBuild(project, buildNumber);
    log.debug("Stopping build: {} #{}", project.getName(), buildNumber);
    try {
      // Security: doStop eventually checks to see if the task owner has permission to abort the build
      build.doStop(DummyStaplerRequest.INSTANCE, DummyStaplerResponse.INSTANCE);
    } catch (IOException e) {
      throw new ServiceRuntimeException("Stop failed for " + project.getName() + " #" + buildNumber, e);
    } catch (ServletException e) {
      throw new ServiceRuntimeException("Stop failed for " + project.getName() + " #" + buildNumber, e);
    }
  }
}

相关文章

微信公众号

最新文章

更多

AbstractBuild类方法