Do not send branch information as http header.
This commit is contained in:
parent
9ecc67fb3a
commit
1eb223e2cc
|
|
@ -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 {
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,10 @@ 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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue