mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-18 22:22:59 +08:00
feat: 创建运行环境逻辑修改 (#1079)
This commit is contained in:
parent
d065558865
commit
205e32dde8
@ -236,7 +236,7 @@ func upgradeInstall(installId uint, detailId uint) error {
|
||||
defer func() {
|
||||
if upErr != nil {
|
||||
install.Status = constant.UpgradeErr
|
||||
install.Message = err.Error()
|
||||
install.Message = upErr.Error()
|
||||
_ = appInstallRepo.Save(context.Background(), &install)
|
||||
}
|
||||
}()
|
||||
@ -318,6 +318,11 @@ func upgradeInstall(installId uint, detailId uint) error {
|
||||
return
|
||||
}
|
||||
fileOp := files.NewFileOp()
|
||||
envParams := make(map[string]string, len(envs))
|
||||
handleMap(envs, envParams)
|
||||
if err = env.Write(envParams, install.GetEnvPath()); err != nil {
|
||||
return
|
||||
}
|
||||
if upErr = fileOp.WriteFile(install.GetComposePath(), strings.NewReader(install.DockerCompose), 0775); upErr != nil {
|
||||
return
|
||||
}
|
||||
@ -424,8 +429,10 @@ func downloadApp(app model.App, appDetail model.AppDetail, appInstall *model.App
|
||||
|
||||
defer func() {
|
||||
if err != nil {
|
||||
appInstall.Status = constant.DownloadErr
|
||||
appInstall.Message = err.Error()
|
||||
if appInstall != nil {
|
||||
appInstall.Status = constant.DownloadErr
|
||||
appInstall.Message = err.Error()
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
|
@ -64,7 +64,13 @@ func (r *RuntimeService) Create(create request.RuntimeCreate) (err error) {
|
||||
return err
|
||||
}
|
||||
fileOp := files.NewFileOp()
|
||||
buildDir := path.Join(constant.AppResourceDir, app.Key, "versions", appDetail.Version, "build")
|
||||
appVersionDir := path.Join(constant.AppResourceDir, app.Resource, app.Key, appDetail.Version)
|
||||
if !fileOp.Stat(appVersionDir) {
|
||||
if err := downloadApp(app, appDetail, nil); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
buildDir := path.Join(appVersionDir, "build")
|
||||
if !fileOp.Stat(buildDir) {
|
||||
return buserr.New(constant.ErrDirNotFound)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user