Skip to content

Commit cb8ecd5

Browse files
feat: Change openresty upgrade logic (#11714)
1 parent 33ad31d commit cb8ecd5

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

agent/app/service/app_utils.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,30 @@ func upgradeInstall(req request.AppInstallUpgrade) error {
764764

765765
command := exec.Command("/bin/bash", "-c", fmt.Sprintf("cp -rn %s/* %s || true", detailDir, install.GetPath()))
766766
_, _ = command.CombinedOutput()
767+
if install.App.Key == constant.AppOpenresty {
768+
installBuildDir := path.Join(install.GetPath(), "build")
769+
detailBuildDir := path.Join(detailDir, "build")
770+
if !fileOp.Stat(installBuildDir) {
771+
if err := fileOp.CreateDir(installBuildDir, constant.DirPerm); err != nil {
772+
return err
773+
}
774+
}
775+
if err := fileOp.DeleteDir(path.Join(installBuildDir, "tmp")); err != nil {
776+
return err
777+
}
778+
if err := fileOp.CopyDir(path.Join(detailBuildDir, "tmp"), installBuildDir); err != nil {
779+
return err
780+
}
781+
if err := fileOp.CopyFile(path.Join(detailBuildDir, "Dockerfile"), installBuildDir); err != nil {
782+
return err
783+
}
784+
if err := fileOp.CopyFile(path.Join(detailBuildDir, "nginx.conf"), installBuildDir); err != nil {
785+
return err
786+
}
787+
if err := fileOp.CopyFile(path.Join(detailBuildDir, "nginx.vh.default.conf"), installBuildDir); err != nil {
788+
return err
789+
}
790+
}
767791
sourceScripts := path.Join(detailDir, "scripts")
768792
if fileOp.Stat(sourceScripts) {
769793
dstScripts := path.Join(install.GetPath(), "scripts")

0 commit comments

Comments
 (0)