Module: PactBroker::Webhooks::TriggerService
Instance Method Summary
collapse
label_repository, matrix_repository, pact_repository, pacticipant_repository, tag_repository, verification_repository, version_repository, webhook_repository
Methods included from Services
badge_service, certificate_service, group_service, index_service, integration_service, label_service, matrix_service, metrics_service, pact_service, pacticipant_service, tag_service, verification_service, version_service, webhook_service, webhook_trigger_service
Methods included from Logging
included, #log_error
Instance Method Details
#trigger_webhooks_for_new_pact(pact, webhook_options) ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'lib/pact_broker/webhooks/trigger_service.rb', line 12
def trigger_webhooks_for_new_pact(pact, webhook_options)
webhook_service.trigger_webhooks pact, nil, PactBroker::Webhooks::WebhookEvent::CONTRACT_PUBLISHED, webhook_options
if pact_is_new_or_newly_tagged_or_pact_has_changed_since_previous_version?(pact)
webhook_service.trigger_webhooks pact, nil, PactBroker::Webhooks::WebhookEvent::CONTRACT_CONTENT_CHANGED, webhook_options
else
logger.info "Pact content has not changed since previous version, not triggering webhooks for changed content"
end
end
|
#trigger_webhooks_for_updated_pact(existing_pact, updated_pact, webhook_options) ⇒ Object
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/pact_broker/webhooks/trigger_service.rb', line 21
def trigger_webhooks_for_updated_pact(existing_pact, updated_pact, webhook_options)
webhook_service.trigger_webhooks updated_pact, nil, PactBroker::Webhooks::WebhookEvent::CONTRACT_PUBLISHED, webhook_options
if existing_pact.pact_version_sha != updated_pact.pact_version_sha
logger.info "Existing pact for version #{existing_pact.consumer_version_number} has been updated with new content, triggering webhooks for changed content"
webhook_service.trigger_webhooks updated_pact, nil, PactBroker::Webhooks::WebhookEvent::CONTRACT_CONTENT_CHANGED, webhook_options
else
logger.info "Pact content has not changed since previous revision, not triggering webhooks for changed content"
end
end
|
#trigger_webhooks_for_verification_results_publication(pact, verification, webhook_options) ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/pact_broker/webhooks/trigger_service.rb', line 32
def trigger_webhooks_for_verification_results_publication(pact, verification, webhook_options)
if verification.success
webhook_service.trigger_webhooks(
pact,
verification,
PactBroker::Webhooks::WebhookEvent::VERIFICATION_SUCCEEDED,
webhook_options
)
else
webhook_service.trigger_webhooks(
pact,
verification,
PactBroker::Webhooks::WebhookEvent::VERIFICATION_FAILED,
webhook_options
)
end
webhook_service.trigger_webhooks(
pact,
verification,
PactBroker::Webhooks::WebhookEvent::VERIFICATION_PUBLISHED,
webhook_options
)
end
|