Commit b8379b3d authored by Kamil Trzciński's avatar Kamil Trzciński 🔴

Fixed problem allowing commands to consume build script making the build to...

Fixed problem allowing commands to consume build script making the build to succeed even if not all commands were executed
parent 07ff247a
......@@ -52,9 +52,12 @@ func (b *BashShell) GenerateScript(build *common.Build, shellType common.ShellTy
projectDir := build.FullProjectDir()
projectDir = helpers.ToSlash(projectDir)
projectScript := helpers.ShellEscape(build.FullProjectDir() + ".sh")
io.WriteString(w, "#!/usr/bin/env bash\n")
io.WriteString(w, "\n")
io.WriteString(w, ": | (") // close stdin
io.WriteString(w, "# save script that is read from to file and execute script file on remote server\n")
io.WriteString(w, fmt.Sprintf("cat > %s && exec $0 %s; exit 1\n", projectScript, projectScript))
io.WriteString(w, "\n")
if len(build.Hostname) != 0 {
io.WriteString(w, fmt.Sprintf("echo Running on $(hostname) via %s...\n", helpers.ShellEscape(build.Hostname)))
......@@ -74,15 +77,14 @@ func (b *BashShell) GenerateScript(build *common.Build, shellType common.ShellTy
b.writeCheckoutCmd(w, build)
io.WriteString(w, "\n")
if !helpers.BoolOrDefault(build.Runner.DisableVerbose, false) {
io.WriteString(w, "set -x\n")
io.WriteString(w, "set -v\n")
io.WriteString(w, "\n")
}
commands := build.Commands
commands = strings.Replace(commands, "\r\n", "\n", -1)
io.WriteString(w, commands)
io.WriteString(w, "")
io.WriteString(w, ")")
io.WriteString(w, "\n")
w.Flush()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment