Ver Fonte

fix: bug

wanghongkai há 5 anos atrás
pai
commit
c325401411

+ 7 - 3
src/main/java/cn/seecoder/paas/service/impl/EnvironmentServiceImpl.java

@@ -25,6 +25,7 @@ import com.spotify.docker.client.ProgressHandler;
 import com.spotify.docker.client.exceptions.DockerException;
 import com.spotify.docker.client.messages.ProgressMessage;
 import io.kubernetes.client.openapi.models.*;
+import org.apache.commons.lang.StringUtils;
 import org.eclipse.jgit.api.Git;
 import org.eclipse.jgit.api.ResetCommand;
 import org.slf4j.Logger;
@@ -376,10 +377,13 @@ public class EnvironmentServiceImpl implements EnvironmentService {
             } else if (result.getBuildType() == BuildType.FROM_IMAGE) {
                 result.setBuildStatus(BuildStatus.SUCCESS);
                 result.setBuildOutput("镜像构建无需部署");
+                result.setDeployStatus(DeployStatus.DEPLOYING);
+                result.setDeployStartTime(LocalDateTime.now());
+                result.setImage(imageName);
                 environmentDAO.save(result);
             }
 
-            String[] ports = configContent.getServicePort().split(",");
+            String[] ports = (configContent.getServicePort() == null ? "" : configContent.getServicePort()).split(",");
             if (configContent.getHostPrefix() != null) {
                 for (String port : ports) {
                     // ingress
@@ -510,8 +514,8 @@ public class EnvironmentServiceImpl implements EnvironmentService {
                                                             .protocol("TCP")
                                                             .build()).collect(Collectors.toSet())
                                     )
-                                    .args(configContent.getRunArgs() == null ? null : Arrays.asList(configContent.getRunArgs().split(" ")))
-                                    .command(configContent.getRunCommands() == null ? null : Arrays.asList(configContent.getRunCommands().split(" ")))
+                                    .args(StringUtils.isEmpty(configContent.getRunArgs()) ? null : Arrays.asList(configContent.getRunArgs().split(" ")))
+                                    .command(StringUtils.isEmpty(configContent.getRunCommands()) ? null : Arrays.asList(configContent.getRunCommands().split(" ")))
                                     .name(labelValue)
                                     .image(imageName)
                                     .volumeMounts(volumeMounts)