io.fabric8.openshift.api.model.Build.getStatus()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(164)

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

Build.getStatus介绍

暂无

代码示例

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

public static String getBuildStatusPhase(Build build) {
  if (build != null && build.getStatus() != null) {
    return build.getStatus().getPhase();
  }
  return null;
}

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

public static String getBuildStatusReason(Build build) {
  if (build != null && build.getStatus() != null) {
    String reason = build.getStatus().getReason();
    String phase = build.getStatus().getPhase();
    if (StringUtils.isNotBlank(phase)) {
      if (StringUtils.isNotBlank(reason)) {
        return phase + ": " + reason;
      } else {
        return phase;
      }
    } else {
      return StringUtils.defaultIfEmpty(reason, "");
    }
  }
  return "";
}

代码示例来源:origin: io.fabric8.jenkins.plugins/openshift-sync

@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE")
private void buildAdded(Build build) throws IOException {
 if (build.getStatus() != null && Boolean.TRUE.equals(build.getStatus().getCancelled())) {
  cancelOpenShiftBuild(build);
  return;
 }
 Job job = getJobFromBuild(build);
 if (job != null) {
  JenkinsUtils.triggerJob(job, build);
 }
}

代码示例来源:origin: io.fabric8.jenkins.plugins/openshift-sync

private void buildModified(Build build) {
 if (Boolean.TRUE.equals(build.getStatus().getCancelled())) {
  Job job = getJobFromBuild(build);
  if (job != null) {
   JenkinsUtils.cancelBuild(job, build);
  }
 }
}

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

@Override
public void eventReceived(Action action, Build build) {
  buildHolder.set(build);
  String status = KubernetesResourceUtil.getBuildStatusPhase(build);
  log.verbose("BuildWatch: Received event %s , build status: %s", action, build.getStatus());
  if (!lastStatus.equals(status)) {
    lastStatus = status;
    log.verbose("Build %s status: %s", buildName, status);
  }
  if (OpenshiftHelper.isFinished(status)) {
    latch.countDown();
  }
}

代码示例来源:origin: io.fabric8.jenkins.plugins/openshift-sync

@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE")
public void onInitialBuilds(BuildList buildList) {
 List<Build> items = buildList.getItems();
 if (items != null) {
  Collections.sort(items, new Comparator<Build>() {
   @Override
   public int compare(Build b1, Build b2) {
    return Long.compare(
     parseTimestamp(b1.getMetadata().getCreationTimestamp()),
     parseTimestamp(b2.getMetadata().getCreationTimestamp())
    );
   }
  });
  for (Build build : items) {
   if (build.getStatus().getPhase().equals(NEW)) {
    try {
     buildAdded(build);
    } catch (IOException e) {
     e.printStackTrace();
    }
   }
  }
 }
}

代码示例来源:origin: io.syndesis.server/server-openshift

private Build waitForBuild(Build r, long timeout, TimeUnit timeUnit) throws InterruptedException {
  long end = System.currentTimeMillis() + timeUnit.toMillis(timeout);
  Build next = r;
  int retriesLeft = config.getMaximumRetries();
  while ( System.currentTimeMillis() < end) {
    if (next.getStatus() != null && ("Complete".equals(next.getStatus().getPhase()) || "Failed".equals(next.getStatus().getPhase()))) {
      return next;
    }
    try {
      next = openShiftClient.builds().inNamespace(next.getMetadata().getNamespace()).withName(next.getMetadata().getName()).get();
    } catch (KubernetesClientException e) {
      checkRetryPolicy(e, retriesLeft--);
    }
    Thread.sleep(config.getPollingInterval());
  }
  throw SyndesisServerException.launderThrowable(new TimeoutException("Timed out waiting for build completion."));
}

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

private void logBuildFailure(OpenShiftClient client, String buildName) throws Fabric8ServiceException {
  try {
    List<Build> builds = client.builds().inNamespace(client.getNamespace()).list().getItems();
    for(Build build : builds) {
      if(build.getMetadata().getName().contains(buildName)) {
        log.error(build.getMetadata().getName() + "\t" + "\t" + build.getStatus().getReason() + "\t" + build.getStatus().getMessage());
        throw new Fabric8ServiceException("Unable to build the image using the OpenShift build service", new KubernetesClientException(build.getStatus().getReason() + " " + build.getStatus().getMessage()));
      }
    }
    log.error("Also, check cluster events via `oc get events` to see what could have possibly gone wrong");
  } catch (KubernetesClientException clientException) {
    Status status = clientException.getStatus();
    if (status != null)
      log.error("OpenShift Error: [%d] %s", status.getCode(), status.getMessage());
  }
}

代码示例来源:origin: io.syndesis.server/server-openshift

@Override
public String build(String name, DeploymentData deploymentData, InputStream tarInputStream) throws InterruptedException {
  final String sName = openshiftName(name);
  ensureImageStreams(sName);
  ensureBuildConfig(sName, deploymentData, this.config.getBuilderImageStreamTag(), this.config.getImageStreamNamespace(), this.config.getBuildNodeSelector());
  Build build = openShiftClient.buildConfigs().withName(sName)
          .instantiateBinary()
          .fromInputStream(tarInputStream);
  Build complete = waitForBuild(build, 10, TimeUnit.MINUTES);
  if (complete != null && complete.getStatus() != null) {
    return build.getStatus().getOutputDockerImageReference();
  } else {
    return null;
  }
}

代码示例来源:origin: io.fabric8.jenkins.plugins/openshift-sync

public static Job getJobFromBuild(Build build) {
  String buildConfigName = build.getStatus().getConfig().getName();
  if (StringUtils.isEmpty(buildConfigName)) {
   return null;
  }
  BuildConfig buildConfig = getOpenShiftClient().buildConfigs().inNamespace(build.getMetadata().getNamespace()).withName(buildConfigName).get();
  if (buildConfig == null) {
   return null;
  }
  return BuildTrigger.DESCRIPTOR.getJobFromBuildConfigUid(buildConfig.getMetadata().getUid());
 }
}

代码示例来源:origin: org.apache.stratos/kubernetes-model

public BuildBuilder( BuildFluent<?> fluent , Build instance ){
  this.fluent = fluent; fluent.withApiVersion(instance.getApiVersion()); fluent.withKind(instance.getKind()); fluent.withMetadata(instance.getMetadata()); fluent.withSpec(instance.getSpec()); fluent.withStatus(instance.getStatus()); 
}
public BuildBuilder( Build instance ){

代码示例来源:origin: org.domeos/kubernetes-model

public BuildBuilder(BuildFluent<?> fluent,Build instance,Boolean validationEnabled){
    this.fluent = fluent; 
    fluent.withApiVersion(instance.getApiVersion()); 
    fluent.withKind(instance.getKind()); 
    fluent.withMetadata(instance.getMetadata()); 
    fluent.withSpec(instance.getSpec()); 
    fluent.withStatus(instance.getStatus()); 
    this.validationEnabled = validationEnabled; 
}
public BuildBuilder(Build instance){

代码示例来源:origin: org.domeos/kubernetes-model

public BuildBuilder(Build instance,Boolean validationEnabled){
    this.fluent = this; 
    this.withApiVersion(instance.getApiVersion()); 
    this.withKind(instance.getKind()); 
    this.withMetadata(instance.getMetadata()); 
    this.withSpec(instance.getSpec()); 
    this.withStatus(instance.getStatus()); 
    this.validationEnabled = validationEnabled; 
}

代码示例来源:origin: org.domeos/kubernetes-model

public BuildFluentImpl(Build instance){
    this.withApiVersion(instance.getApiVersion()); 
    this.withKind(instance.getKind()); 
    this.withMetadata(instance.getMetadata()); 
    this.withSpec(instance.getSpec()); 
    this.withStatus(instance.getStatus()); 
}

代码示例来源:origin: io.fabric8.schemagenerator/kubernetes-model

public BuildBuilder( Build instance ){
  this.fluent = this; this.withApiVersion(instance.getApiVersion()); this.withKind(instance.getKind()); this.withMetadata(instance.getMetadata()); this.withSpec(instance.getSpec()); this.withStatus(instance.getStatus()); 
}

代码示例来源:origin: io.fabric8.schemagenerator/kubernetes-model

public BuildBuilder( BuildFluent<?> fluent , Build instance ){
  this.fluent = fluent; fluent.withApiVersion(instance.getApiVersion()); fluent.withKind(instance.getKind()); fluent.withMetadata(instance.getMetadata()); fluent.withSpec(instance.getSpec()); fluent.withStatus(instance.getStatus()); 
}
public BuildBuilder( Build instance ){

代码示例来源:origin: org.apache.stratos/kubernetes-model

public BuildBuilder( Build instance ){
  this.fluent = this; this.withApiVersion(instance.getApiVersion()); this.withKind(instance.getKind()); this.withMetadata(instance.getMetadata()); this.withSpec(instance.getSpec()); this.withStatus(instance.getStatus()); 
}

相关文章