mirror of
https://gitee.com/goploy/goploy.git
synced 2024-12-02 12:10:05 +08:00
F symlink rollback
This commit is contained in:
parent
33112ef351
commit
b7fb187671
@ -249,10 +249,10 @@ func (Deploy) Rebuild(gp *core.Goploy) *core.Response {
|
||||
var sshOutbuf, sshErrbuf bytes.Buffer
|
||||
session.Stdout = &sshOutbuf
|
||||
session.Stderr = &sshErrbuf
|
||||
symlinkPath := path.Join(project.SymlinkPath, project.Name, reqData.Token)
|
||||
destDir := path.Join(project.SymlinkPath, project.LastPublishToken)
|
||||
|
||||
// check if the path is exist or not
|
||||
if err := session.Run("cd " + symlinkPath); err != nil {
|
||||
if err := session.Run("cd " + destDir); err != nil {
|
||||
core.Log(core.ERROR, "projectID:"+strconv.FormatInt(project.ID, 10)+" check symlink path err: "+err.Error()+", detail: "+sshErrbuf.String())
|
||||
ch <- false
|
||||
return
|
||||
@ -264,7 +264,10 @@ func (Deploy) Rebuild(gp *core.Goploy) *core.Response {
|
||||
ch <- false
|
||||
return
|
||||
}
|
||||
afterDeployCommands := []string{"ln -sfn " + symlinkPath + " " + project.Path}
|
||||
relativeDestDir := strings.Replace(destDir, path.Dir(project.Path), ".", 1)
|
||||
var afterDeployCommands []string
|
||||
afterDeployCommands = append(afterDeployCommands, "ln -sfn "+relativeDestDir+" "+project.Path)
|
||||
afterDeployCommands = append(afterDeployCommands, "touch -m "+destDir)
|
||||
if len(project.AfterDeployScript) != 0 {
|
||||
scriptMode := "bash"
|
||||
if len(project.AfterDeployScriptMode) != 0 {
|
||||
|
2
main.go
2
main.go
@ -218,7 +218,7 @@ func install() {
|
||||
envContent := "# when you edit its value, you need to restart\n"
|
||||
envContent += "DB_TYPE=mysql\n"
|
||||
envContent += fmt.Sprintf(
|
||||
"DB_CONN=%s%s@tcp(%s:%s)/goploy?charset=utf8mb4,utf8\n",
|
||||
"DB_CONN=%s%s@(%s:%s)/goploy?charset=utf8mb4,utf8\n",
|
||||
mysqlUser,
|
||||
mysqlPassword,
|
||||
mysqlHost,
|
||||
|
@ -132,7 +132,7 @@
|
||||
/>
|
||||
</el-radio>
|
||||
<el-button type="danger" plain @click="rebuild(item)">
|
||||
rebuild
|
||||
rollback
|
||||
</el-button>
|
||||
</el-row>
|
||||
</el-row>
|
||||
|
Loading…
Reference in New Issue
Block a user