From 92a410fceaf4cc79c6947b32e0d1082f49b79d11 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Thu, 23 Mar 2023 16:24:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E5=88=A4=E6=96=AD=E6=9D=A1=E4=BB=B6=20(#380)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/container.go | 3 ++- backend/app/service/image.go | 2 +- frontend/src/api/modules/container.ts | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/app/service/container.go b/backend/app/service/container.go index 375cd0c8b..b3acf43dc 100644 --- a/backend/app/service/container.go +++ b/backend/app/service/container.go @@ -3,6 +3,7 @@ package service import ( "context" "encoding/json" + "errors" "fmt" "io/ioutil" "os/exec" @@ -239,7 +240,7 @@ func (u *ContainerService) ContainerLogs(req dto.ContainerLog) (string, error) { } stdout, err := cmd.CombinedOutput() if err != nil { - return "", err + return "", errors.New(string(stdout)) } return string(stdout), nil } diff --git a/backend/app/service/image.go b/backend/app/service/image.go index 75acd08b1..575c62262 100644 --- a/backend/app/service/image.go +++ b/backend/app/service/image.go @@ -181,7 +181,7 @@ func (u *ImageService) ImageBuild(req dto.ImageBuild) (string, error) { return } - if strings.Contains(string(body), "error") && strings.Contains(string(body), "failed:") { + if strings.Contains(string(body), "errorDetail") || strings.Contains(string(body), "error:") { global.LOG.Errorf("build image %s failed", req.Name) _, _ = file.Write(body) _, _ = file.WriteString("image build failed!") diff --git a/frontend/src/api/modules/container.ts b/frontend/src/api/modules/container.ts index 5718ce2b0..3ceac9b87 100644 --- a/frontend/src/api/modules/container.ts +++ b/frontend/src/api/modules/container.ts @@ -9,7 +9,7 @@ export const createContainer = (params: Container.ContainerCreate) => { return http.post(`/containers`, params, 1200000); }; export const logContainer = (params: Container.ContainerLogSearch) => { - return http.post(`/containers/search/log`, params); + return http.post(`/containers/search/log`, params, 400000); }; export const ContainerStats = (id: string) => { return http.get(`/containers/stats/${id}`);