io.fabric8.openshift.api.model.Build类的使用及代码示例

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

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

Build介绍

暂无

代码示例

代码示例来源: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: org.apache.stratos/kubernetes-model

public BuildBuilder( BuildFluent<?> fluent ){
  this(fluent, new Build());
}
public BuildBuilder( BuildFluent<?> fluent , Build instance ){

代码示例来源: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/kubernetes-client

private void deleteBuilds() {
 if (getName() == null) {
   return;
 }
 String buildConfigLabelValue = getName().substring(0, Math.min(getName().length(), 63));
 BuildList matchingBuilds = new BuildOperationsImpl(client, (OpenShiftConfig) config, namespace).inNamespace(namespace).withLabel(BUILD_CONFIG_LABEL, buildConfigLabelValue).list();
 if (matchingBuilds.getItems() != null) {
  for (Build matchingBuild : matchingBuilds.getItems()) {
   if (matchingBuild.getMetadata() != null &&
    matchingBuild.getMetadata().getAnnotations() != null &&
    getName().equals(matchingBuild.getMetadata().getAnnotations().get(BUILD_CONFIG_ANNOTATION))) {
    new BuildOperationsImpl(client, (OpenShiftConfig) config, namespace).inNamespace(matchingBuild.getMetadata().getNamespace()).withName(matchingBuild.getMetadata().getName()).delete();
   }
  }
 }
}

代码示例来源:origin: io.fabric8/fabric8-build-workflow

protected static Build createBuild(BuildCorrelationKey key) {
    Build build = new Build();
    build.setMetadata(new ObjectMeta());
    build.getMetadata().setName(key.getBuildName());
    build.getMetadata().setNamespace(key.getNamespace());
    build.getMetadata().setUid(key.getBuildUuid());
    BuildStatus status = new BuildStatus();
    status.setCompletionTimestamp(new Date().toString());
    build.setStatus(status);
    return build;
  }
}

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

public BuildCause(Build build) {
 if (build == null || build.getMetadata() == null) {
  return;
 }
 ObjectMeta meta = build.getMetadata();
 uid = meta.getUid();
 namespace = meta.getNamespace();
 name = meta.getName();
 if (build.getSpec() != null) {
  if (build.getSpec().getSource() != null && build.getSpec().getSource().getGit() != null) {
   GitBuildSource git = build.getSpec().getSource().getGit();
   gitUri = git.getUri();
  }
  if (build.getSpec().getRevision() != null && build.getSpec().getRevision().getGit() != null) {
   commit = build.getSpec().getRevision().getGit().getCommit();
  }
 }
}

代码示例来源: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

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.fabric8.jenkins.plugins/openshift-sync

@Override
 public int compare(Build b1, Build b2) {
  return Long.compare(
   parseTimestamp(b1.getMetadata().getCreationTimestamp()),
   parseTimestamp(b2.getMetadata().getCreationTimestamp())
  );
 }
});

代码示例来源: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: 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: 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: io.fabric8.jenkins.plugins/openshift-sync

public static void cancelOpenShiftBuild(Build build) {
 logger.info("cancelling build in namespace " + build.getMetadata().getNamespace() + " with name: " + build.getMetadata().getName());
 getOpenShiftClient().builds().inNamespace(build.getMetadata().getNamespace()).withName(build.getMetadata().getName())
  .edit()
  .editStatus().withPhase(CANCELLED).endStatus()
  .done();
}

代码示例来源: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: org.apache.stratos/kubernetes-model

public BuildBuilder(){
  this(new Build());
}
public BuildBuilder( BuildFluent<?> fluent ){

代码示例来源: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: io.fabric8/openshift-client

private void deleteBuilds() {
 if (getName() == null) {
   return;
 }
 String buildConfigLabelValue = getName().substring(0, Math.min(getName().length(), 63));
 BuildList matchingBuilds = new BuildOperationsImpl(client, (OpenShiftConfig) config, namespace).inNamespace(namespace).withLabel(BUILD_CONFIG_LABEL, buildConfigLabelValue).list();
 if (matchingBuilds.getItems() != null) {
  for (Build matchingBuild : matchingBuilds.getItems()) {
   if (matchingBuild.getMetadata() != null &&
    matchingBuild.getMetadata().getAnnotations() != null &&
    getName().equals(matchingBuild.getMetadata().getAnnotations().get(BUILD_CONFIG_ANNOTATION))) {
    new BuildOperationsImpl(client, (OpenShiftConfig) config, namespace).inNamespace(matchingBuild.getMetadata().getNamespace()).withName(matchingBuild.getMetadata().getName()).delete();
   }
  }
 }
}

代码示例来源: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.schemagenerator/kubernetes-model

public BuildBuilder( BuildFluent<?> fluent ){
  this(fluent, new Build());
}
public BuildBuilder( BuildFluent<?> fluent , Build instance ){

代码示例来源: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 ){

相关文章