diff --git a/repo/handler.go b/repo/handler.go index c641521b7..1e5bac943 100644 --- a/repo/handler.go +++ b/repo/handler.go @@ -57,6 +57,12 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { h.Publish(otf.Event{ Type: otf.EventVCS, Payload: event, + // publish vcs events only to the local node; a "run spawner" and a + // "module publisher" subscribe to vcs events on each node, so it is + // only necessary to send event to local node; sending it to other + // nodes would lead to duplicate runs and modules being spawned and + // published. + Local: true, }) } } diff --git a/repo/handler_test.go b/repo/handler_test.go index 05d59ba49..0a2aeed62 100644 --- a/repo/handler_test.go +++ b/repo/handler_test.go @@ -14,7 +14,7 @@ import ( func TestWebhookHandler(t *testing.T) { publisher := &fakePublisher{} - want := otf.Event{Type: otf.EventVCS, Payload: cloud.VCSPushEvent{}} + want := otf.Event{Type: otf.EventVCS, Payload: cloud.VCSPushEvent{}, Local: true} f := newTestFactory(t, cloud.VCSPushEvent{}) hook := newTestHook(t, f, otf.String("123")) handler := handler{