Skip to content

Commit 4b97b7d

Browse files
arschlesAaron Schlesinger
authored andcommitted
feat(git.go,run.go): add debug logging
1 parent 1df06cc commit 4b97b7d

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

pkg/git/git.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717

1818
"github.com/Masterminds/cookoo"
1919
"github.com/Masterminds/cookoo/log"
20+
pkglog "github.com/deis/builder/pkg/log"
2021
"golang.org/x/crypto/ssh"
2122
)
2223

@@ -122,6 +123,10 @@ func Receive(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt)
122123

123124
done := plumbCommand(cmd, channel, &errbuff)
124125

126+
pkglog.Debug("Running %s", strings.Join(cmd.Args, " "))
127+
pkglog.Debug("Working Dir: %s", cmd.Dir)
128+
pkglog.Debug("Environment: %s", strings.Join(cmd.Env, ","))
129+
125130
if err := cmd.Start(); err != nil {
126131
log.Warnf(c, "Failed git receive immediately: %s %s", err, errbuff.Bytes())
127132
return nil, err
@@ -212,7 +217,9 @@ func createRepo(c cookoo.Context, repoPath, gitHome string) (bool, error) {
212217
return true, err
213218
}
214219

215-
ioutil.WriteFile(filepath.Join(repoPath, "hooks", "pre-receive"), hookByteBuf.Bytes(), 0755)
220+
writePath := filepath.Join(repoPath, "hooks", "pre-receive")
221+
pkglog.Debug("Writing pre-receive hook to %s", writePath)
222+
ioutil.WriteFile(writePath, hookByteBuf.Bytes(), 0755)
216223

217224
return true, nil
218225
} else if err == nil {

pkg/gitreceive/run.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"strings"
88

99
"github.com/deis/builder/pkg/gitreceive/etcd"
10+
"github.com/deis/builder/pkg/log"
1011
)
1112

1213
// #!/bin/bash
@@ -51,6 +52,8 @@ func readLine(line string) (string, string, string, error) {
5152
}
5253

5354
func Run(conf *Config) error {
55+
log.Debug("Running git hook")
56+
5457
etcdClient, err := etcd.CreateClientFromEnv()
5558
if err != nil {
5659
return err

0 commit comments

Comments
 (0)