mirror of
https://gitee.com/goploy/goploy.git
synced 2024-11-30 03:07:59 +08:00
U link btn
This commit is contained in:
parent
9187d4004c
commit
475cdb0125
@ -23,6 +23,7 @@ import (
|
||||
"github.com/zhenorzz/goploy/service"
|
||||
"github.com/zhenorzz/goploy/service/cmd"
|
||||
"github.com/zhenorzz/goploy/task"
|
||||
"github.com/zhenorzz/goploy/utils"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
@ -468,11 +469,17 @@ func (Deploy) Rebuild(gp *core.Goploy) core.Response {
|
||||
ch := make(chan bool, len(projectServers))
|
||||
for _, projectServer := range projectServers {
|
||||
go func(projectServer model.ProjectServer) {
|
||||
scriptName := fmt.Sprintf("GAD%d", projectServer.ServerID)
|
||||
destDir := path.Join(project.SymlinkPath, project.LastPublishToken)
|
||||
cmdEntity := cmd.New(projectServer.ServerOS)
|
||||
afterDeployCommands := []string{cmdEntity.Symlink(destDir, project.Path), cmdEntity.ChangeDirTime(destDir)}
|
||||
if len(project.AfterDeployScript) != 0 {
|
||||
scriptName := fmt.Sprintf("goploy-after-deploy-%d.%s", projectServer.ServerID, utils.GetScriptExt(project.AfterPullScriptMode))
|
||||
scriptContent := service.ReplaceProjectVars(project.AfterDeployScript, project)
|
||||
scriptContent = service.ReplaceProjectServerVars(scriptContent, projectServer)
|
||||
ioutil.WriteFile(path.Join(core.GetProjectPath(project.ID), scriptName), []byte(service.ReplaceProjectVars(project.AfterDeployScript, project)), 0755)
|
||||
afterDeployScriptPath := path.Join(project.Path, scriptName)
|
||||
afterDeployCommands = append(afterDeployCommands, cmdEntity.Script(project.AfterDeployScriptMode, afterDeployScriptPath))
|
||||
afterDeployCommands = append(afterDeployCommands, cmdEntity.Remove(afterDeployScriptPath))
|
||||
}
|
||||
client, err := projectServer.ToSSHConfig().Dial()
|
||||
if err != nil {
|
||||
@ -488,7 +495,6 @@ func (Deploy) Rebuild(gp *core.Goploy) core.Response {
|
||||
return
|
||||
}
|
||||
|
||||
destDir := path.Join(project.SymlinkPath, project.LastPublishToken)
|
||||
// check if the path is existed or not
|
||||
if output, err := session.CombinedOutput("cd " + destDir); err != nil {
|
||||
core.Log(core.ERROR, "projectID:"+strconv.FormatInt(project.ID, 10)+" check symlink path err: "+err.Error()+", detail: "+string(output))
|
||||
@ -501,15 +507,7 @@ func (Deploy) Rebuild(gp *core.Goploy) core.Response {
|
||||
ch <- false
|
||||
return
|
||||
}
|
||||
var afterDeployCommands []string
|
||||
cmdEntity := cmd.New(projectServer.ServerOS)
|
||||
afterDeployCommands = append(afterDeployCommands, cmdEntity.Symlink(destDir, project.Path))
|
||||
afterDeployCommands = append(afterDeployCommands, cmdEntity.ChangeDirTime(destDir))
|
||||
if len(project.AfterDeployScript) != 0 {
|
||||
afterDeployScriptPath := path.Join(project.Path, scriptName)
|
||||
afterDeployCommands = append(afterDeployCommands, cmdEntity.Script(project.AfterDeployScriptMode, afterDeployScriptPath))
|
||||
afterDeployCommands = append(afterDeployCommands, cmdEntity.Remove(afterDeployScriptPath))
|
||||
}
|
||||
|
||||
// redirect to project path
|
||||
if output, err := session.CombinedOutput(strings.Join(afterDeployCommands, "&&")); err != nil {
|
||||
core.Log(core.ERROR, "projectID:"+strconv.FormatInt(project.ID, 10)+" symlink err: "+err.Error()+", detail: "+string(output))
|
||||
|
@ -225,7 +225,7 @@ func (gsync Gsync) remoteSync(msgChIn chan<- syncMessage) {
|
||||
Type: model.Deploy,
|
||||
}
|
||||
// write after deploy script for rsync
|
||||
scriptName := fmt.Sprintf("GAD%d", projectServer.ServerID)
|
||||
scriptName := fmt.Sprintf("goploy-after-deploy-%d.%s", projectServer.ServerID, utils.GetScriptExt(project.AfterPullScriptMode))
|
||||
if len(project.AfterDeployScript) != 0 {
|
||||
scriptContent := ReplaceProjectVars(project.AfterDeployScript, project)
|
||||
scriptContent = ReplaceProjectServerVars(scriptContent, projectServer)
|
||||
|
@ -38,7 +38,7 @@ func (rt rsyncTransmitter) args() []string {
|
||||
rsyncOption, _ := utils.ParseCommandLine(project.TransferOption)
|
||||
rsyncOption = append([]string{
|
||||
"--include",
|
||||
fmt.Sprintf("GAD%d", projectServer.ServerID),
|
||||
fmt.Sprintf("goploy-after-deploy-%d.%s", projectServer.ServerID, utils.GetScriptExt(project.AfterPullScriptMode)),
|
||||
}, rsyncOption...)
|
||||
rsyncOption = append(rsyncOption, "-e", projectServer.ToSSHOption())
|
||||
|
||||
|
@ -95,7 +95,7 @@ func (st sftpTransmitter) Exec() (string, error) {
|
||||
}
|
||||
nextItem = ""
|
||||
}
|
||||
includes = append(includes, fmt.Sprintf("GAD%d", st.ProjectServer.ServerID))
|
||||
includes = append(includes, fmt.Sprintf("goploy-after-deploy-%d.%s", st.ProjectServer.ServerID, utils.GetScriptExt(project.AfterPullScriptMode)))
|
||||
|
||||
srcPath := core.GetProjectPath(project.ID) + "/"
|
||||
destPath := project.Path
|
||||
|
@ -18,7 +18,8 @@
|
||||
<el-row type="flex" justify="space-between" align="middle">
|
||||
<span style="font-size: 16px">Filter</span>
|
||||
<el-button
|
||||
type="text"
|
||||
type="primary"
|
||||
link
|
||||
:icon="Close"
|
||||
style="color: #999; font-size: 16px; margin-bottom: 10px"
|
||||
@click="filterInpurtVisible = false"
|
||||
@ -294,7 +295,8 @@
|
||||
<span>[goploy ~]#</span>
|
||||
<el-button
|
||||
v-if="item.state === 1 && !(item.id in traceDetail)"
|
||||
type="text"
|
||||
type="primary"
|
||||
link
|
||||
@click="getPublishTraceDetail(item)"
|
||||
>
|
||||
{{ $t('deployPage.showDetail') }}
|
||||
@ -330,7 +332,8 @@
|
||||
<span style="padding: 5px 0">[goploy ~]#</span>
|
||||
<el-button
|
||||
v-if="trace.state === 1 && !(trace.id in traceDetail)"
|
||||
type="text"
|
||||
type="primary"
|
||||
link
|
||||
@click="getPublishTraceDetail(trace)"
|
||||
>
|
||||
{{ $t('deployPage.showDetail') }}
|
||||
@ -356,7 +359,8 @@
|
||||
<span style="padding: 5px 0">[goploy ~]#</span>
|
||||
<el-button
|
||||
v-if="trace.state === 1 && !(trace.id in traceDetail)"
|
||||
type="text"
|
||||
type="primary"
|
||||
link
|
||||
@click="getPublishTraceDetail(trace)"
|
||||
>
|
||||
{{ $t('deployPage.showDetail') }}
|
||||
@ -383,7 +387,8 @@
|
||||
<span>[goploy ~]#</span>
|
||||
<el-button
|
||||
v-if="trace.state === 1 && !(trace.id in traceDetail)"
|
||||
type="text"
|
||||
type="primary"
|
||||
link
|
||||
@click="getPublishTraceDetail(trace)"
|
||||
>
|
||||
{{ $t('deployPage.showDetail') }}
|
||||
|
Loading…
Reference in New Issue
Block a user