mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-31 14:08:06 +08:00
fix: 修改构建失败判断条件 (#380)
This commit is contained in:
parent
5d1fced8e9
commit
92a410fcea
@ -3,6 +3,7 @@ package service
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
@ -239,7 +240,7 @@ func (u *ContainerService) ContainerLogs(req dto.ContainerLog) (string, error) {
|
|||||||
}
|
}
|
||||||
stdout, err := cmd.CombinedOutput()
|
stdout, err := cmd.CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", errors.New(string(stdout))
|
||||||
}
|
}
|
||||||
return string(stdout), nil
|
return string(stdout), nil
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ func (u *ImageService) ImageBuild(req dto.ImageBuild) (string, error) {
|
|||||||
return
|
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)
|
global.LOG.Errorf("build image %s failed", req.Name)
|
||||||
_, _ = file.Write(body)
|
_, _ = file.Write(body)
|
||||||
_, _ = file.WriteString("image build failed!")
|
_, _ = file.WriteString("image build failed!")
|
||||||
|
@ -9,7 +9,7 @@ export const createContainer = (params: Container.ContainerCreate) => {
|
|||||||
return http.post(`/containers`, params, 1200000);
|
return http.post(`/containers`, params, 1200000);
|
||||||
};
|
};
|
||||||
export const logContainer = (params: Container.ContainerLogSearch) => {
|
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) => {
|
export const ContainerStats = (id: string) => {
|
||||||
return http.get<Container.ContainerStats>(`/containers/stats/${id}`);
|
return http.get<Container.ContainerStats>(`/containers/stats/${id}`);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user