Do not send branch information as http header.

This commit is contained in:
Michael Peick 2019-10-26 13:34:16 +02:00
parent 9ecc67fb3a
commit 1eb223e2cc
2 changed files with 4 additions and 8 deletions

View File

@ -302,7 +302,7 @@ func main() {
time.Sleep(waitTime(*flWait)) time.Sleep(waitTime(*flWait))
continue continue
} else if changed { } else if changed {
err := triggerWebhook(ctx, webhookTriggerChan, *flBranch, *flRev, *flRoot) err := triggerWebhook(ctx, webhookTriggerChan, *flRev, *flRoot)
if err != nil { if err != nil {
log.Error(err, "triggering webhook failed") log.Error(err, "triggering webhook failed")
} }
@ -692,10 +692,8 @@ func setupGitCookieFile() error {
return nil return nil
} }
func triggerWebhook(ctx context.Context, ch chan webhookRepoInfo, branch, rev, gitRoot string) error { func triggerWebhook(ctx context.Context, ch chan webhookRepoInfo, rev, gitRoot string) error {
info := webhookRepoInfo{ info := webhookRepoInfo{}
Branch: branch,
}
hash, err := hashForRev(ctx, rev, gitRoot) hash, err := hashForRev(ctx, rev, gitRoot)
if err != nil { if err != nil {

View File

@ -23,13 +23,11 @@ type Webhook struct {
} }
type webhookRepoInfo struct { type webhookRepoInfo struct {
Hash string Hash string
Branch string
} }
func (w *Webhook) Do(info webhookRepoInfo) error { func (w *Webhook) Do(info webhookRepoInfo) error {
req, err := http.NewRequest(w.Method, w.URL, nil) req, err := http.NewRequest(w.Method, w.URL, nil)
req.Header.Set("Git-Sync-Branch", info.Branch)
req.Header.Set("Git-Sync-Hash", info.Hash) req.Header.Set("Git-Sync-Hash", info.Hash)
if err != nil { if err != nil {
return err return err