|
|
@@ -341,14 +341,16 @@ public class EnvironmentServiceImpl implements EnvironmentService {
|
|
|
dockerApi.buildAndPush(directory.toString(), "seecoder-paas-" + labelValue, imageTag, new ProgressHandler() {
|
|
|
@Override
|
|
|
public void progress(ProgressMessage message) throws DockerException {
|
|
|
- sb.append(message.stream());
|
|
|
- if (sb.length() > DEFAULT_BUFFER_LENGTH) {
|
|
|
- result.setBuildOutput(result.getBuildOutput() + sb.toString());
|
|
|
- if (result.getBuildOutput().length() > MAX_BUFFER_SIZE) {
|
|
|
- result.setBuildOutput(result.getBuildOutput().substring((int) (result.getBuildOutput().length() - MAX_BUFFER_SIZE)));
|
|
|
+ if (message.stream() != null) {
|
|
|
+ sb.append(message.stream());
|
|
|
+ if (sb.length() > DEFAULT_BUFFER_LENGTH) {
|
|
|
+ result.setBuildOutput(result.getBuildOutput() + sb.toString());
|
|
|
+ if (result.getBuildOutput().length() > MAX_BUFFER_SIZE) {
|
|
|
+ result.setBuildOutput(result.getBuildOutput().substring((int) (result.getBuildOutput().length() - MAX_BUFFER_SIZE)));
|
|
|
+ }
|
|
|
+ sb.setLength(0);
|
|
|
+ environmentDAO.save(result);
|
|
|
}
|
|
|
- sb.setLength(0);
|
|
|
- environmentDAO.save(result);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -369,7 +371,9 @@ public class EnvironmentServiceImpl implements EnvironmentService {
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
result.setBuildStatus(BuildStatus.FAIL);
|
|
|
- result.setBuildOutput(e.getLocalizedMessage());
|
|
|
+ if (!e.getLocalizedMessage().contains("Could not acquire image ID or digest following build")) {
|
|
|
+ result.setBuildOutput(e.getLocalizedMessage());
|
|
|
+ }
|
|
|
environmentDAO.save(result);
|
|
|
LoggerUtil.error(logger, e, "构建失败!gitUrl={}, branchOrCommit={}", application.getGitUrl(), result.getBuildTypeValue());
|
|
|
return;
|
|
|
@@ -397,9 +401,19 @@ public class EnvironmentServiceImpl implements EnvironmentService {
|
|
|
if (configContent.getIngressAnnotations() != null && configContent.getIngressAnnotations().get(port) != null) {
|
|
|
ingress.setAnnotations(configContent.getIngressAnnotations().get(port));
|
|
|
}
|
|
|
+ String ingressHost = configContent.getHostPrefix() + "-" + port + "." + deploymentHost;
|
|
|
+ if (configContent.getIngressPort() != null) {
|
|
|
+ if (port.equals(configContent.getIngressPort())) {
|
|
|
+ ingressHost = configContent.getHostPrefix() + "." + deploymentHost;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (ports.length == 1 || port.equals("80")) {
|
|
|
+ ingressHost = configContent.getHostPrefix() + "." + deploymentHost;
|
|
|
+ }
|
|
|
+ }
|
|
|
ingress.setAnnotation(Ingress.REWRITE_ANNOTATION, Ingress.DEFAULT_REWRITE_PATH);
|
|
|
ingress.setHttpRules(Collections.singletonList(
|
|
|
- Ingress.IngressRule.builder().host(configContent.getHostPrefix() + "-" + port + "." + deploymentHost).ruleValues(
|
|
|
+ Ingress.IngressRule.builder().host(ingressHost).ruleValues(
|
|
|
Collections.singleton(Ingress.IngressPath.builder()
|
|
|
.path("/")
|
|
|
.serviceName(labelValue)
|