1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-02-07 17:10:07 +08:00

feat: 修改应用安装超时时间 (#6983)

This commit is contained in:
zhengkunwang 2024-11-08 14:55:21 +08:00 committed by GitHub
parent 7bc06bb6b1
commit cccbaafd1b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -924,8 +924,17 @@ func upApp(appInstall *model.AppInstall, pullImages bool) {
errMsg string errMsg string
) )
if pullImages && appInstall.App.Type != "php" { if pullImages && appInstall.App.Type != "php" {
out, err = compose.Pull(appInstall.GetComposePath()) projectName := strings.ToLower(appInstall.Name)
envByte, err := files.NewFileOp().GetContent(appInstall.GetEnvPath())
if err != nil { if err != nil {
return err
}
images, err := composeV2.GetDockerComposeImages(projectName, envByte, []byte(appInstall.DockerCompose))
if err != nil {
return err
}
for _, image := range images {
if out, err = cmd.ExecWithTimeOut("docker pull "+image, 60*time.Minute); err != nil {
if out != "" { if out != "" {
if strings.Contains(out, "no such host") { if strings.Contains(out, "no such host") {
errMsg = i18n.GetMsgByKey("ErrNoSuchHost") + ":" errMsg = i18n.GetMsgByKey("ErrNoSuchHost") + ":"
@ -933,11 +942,18 @@ func upApp(appInstall *model.AppInstall, pullImages bool) {
if strings.Contains(out, "timeout") { if strings.Contains(out, "timeout") {
errMsg = i18n.GetMsgByKey("ErrImagePullTimeOut") + ":" errMsg = i18n.GetMsgByKey("ErrImagePullTimeOut") + ":"
} }
appInstall.Message = errMsg + out } else {
if err.Error() == buserr.New(constant.ErrCmdTimeout).Error() {
errMsg = i18n.GetMsgByKey("ErrImagePullTimeOut")
} else {
errMsg = i18n.GetMsgWithMap("ErrImagePull", map[string]interface{}{"err": err.Error()})
} }
}
appInstall.Message = errMsg + out
return err return err
} }
} }
}
out, err = compose.Up(appInstall.GetComposePath()) out, err = compose.Up(appInstall.GetComposePath())
if err != nil { if err != nil {