Skip to content
This repository has been archived by the owner on Aug 5, 2020. It is now read-only.

Commit

Permalink
Merge pull request #115 from phylake/master
Browse files Browse the repository at this point in the history
another logging pass
  • Loading branch information
phylake authored Oct 8, 2016
2 parents 1632d34 + 13ef7af commit d55179c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
**v2.4.1**

- gather hook log output by hook since they run concurrently

**v2.4.0**

- added retries to instance autoregistration
Expand Down
40 changes: 19 additions & 21 deletions hook/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,6 @@ func (recv *regionHookRunner) buildAndRun(log log15.Logger,
if recv.runOutput != nil {
*recv.runOutput <- runOutput
}

runOutput.WriteTo(hookLogOutput)
}()

log.Info("You are now exiting porter and entering a porter deployment hook")
Expand All @@ -472,18 +470,18 @@ func (recv *regionHookRunner) buildAndRun(log log15.Logger,
dockerBuildCmd.Stdout = hookLogOutput
dockerBuildCmd.Stderr = hookLogOutput

log.Info("Building deployment hook START")
log.Info("==============================")
fmt.Fprintln(hookLogOutput, "Building deployment hook START")
fmt.Fprintln(hookLogOutput, "==============================")
err := dockerBuildCmd.Run()
log.Info("============================")
log.Info("Building deployment hook END")
fmt.Fprintln(hookLogOutput, "============================")
fmt.Fprintln(hookLogOutput, "Building deployment hook END")

if err != nil {
log.Error("docker build", "Error", err)
log.Info("This is not a problem with porter but with the Dockerfile porter tried to build")
log.Info("DO NOT contact Brandon Cook to help debug this issue")
log.Info("DO NOT file an issue against porter")
log.Info("DO contact the author of the Dockerfile or try to reproduce the problem by running docker build on this machine")
fmt.Fprintln(hookLogOutput, "This is not a problem with porter but with the Dockerfile porter tried to build")
fmt.Fprintln(hookLogOutput, "DO NOT contact Brandon Cook to help debug this issue")
fmt.Fprintln(hookLogOutput, "DO NOT file an issue against porter")
fmt.Fprintln(hookLogOutput, "DO contact the author of the Dockerfile or try to reproduce the problem by running docker build on this machine")
return
}

Expand All @@ -492,23 +490,23 @@ func (recv *regionHookRunner) buildAndRun(log log15.Logger,
log.Debug("docker run", "Args", runArgs)

runCmd := exec.Command("docker", runArgs...)
runCmd.Stdout = &runOutput
runCmd.Stdout = io.MultiWriter(hookLogOutput, &runOutput)
runCmd.Stderr = hookLogOutput

log.Info("Running deployment hook START")
log.Info("=============================")
fmt.Fprintln(hookLogOutput, "Running deployment hook START")
fmt.Fprintln(hookLogOutput, "=============================")
err = runCmd.Run()
log.Info("===========================")
log.Info("Running deployment hook END")
fmt.Fprintln(hookLogOutput, "===========================")
fmt.Fprintln(hookLogOutput, "Running deployment hook END")

if err != nil {
log.Error("docker run", "Error", err)
log.Info("This is not a problem with porter but with the Dockerfile porter tried to run")
log.Info("DO NOT contact Brandon Cook to help debug this issue")
log.Info("DO NOT file an issue against porter")
log.Info("DO contact the author of the Dockerfile")
log.Info("Run `porter help debug` to see how to enable debug logging which will show you the arguments used in docker run")
log.Info("Be aware that enabling debug logging will print sensitive data including, but not limited to, AWS credentials")
fmt.Fprintln(hookLogOutput, "This is not a problem with porter but with the Dockerfile porter tried to run")
fmt.Fprintln(hookLogOutput, "DO NOT contact Brandon Cook to help debug this issue")
fmt.Fprintln(hookLogOutput, "DO NOT file an issue against porter")
fmt.Fprintln(hookLogOutput, "DO contact the author of the Dockerfile")
fmt.Fprintln(hookLogOutput, "Run `porter help debug` to see how to enable debug logging which will show you the arguments used in docker run")
fmt.Fprintln(hookLogOutput, "Be aware that enabling debug logging will print sensitive data including, but not limited to, AWS credentials")
return
}

Expand Down

0 comments on commit d55179c

Please sign in to comment.