Browse Source

fix: 修改构建失败判断条件 (#380)

pull/385/head
ssongliu 2 years ago committed by GitHub
parent
commit
92a410fcea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      backend/app/service/container.go
  2. 2
      backend/app/service/image.go
  3. 2
      frontend/src/api/modules/container.ts

3
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
}

2
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!")

2
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<string>(`/containers/search/log`, params);
return http.post<string>(`/containers/search/log`, params, 400000);
};
export const ContainerStats = (id: string) => {
return http.get<Container.ContainerStats>(`/containers/stats/${id}`);

Loading…
Cancel
Save