Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebHook Trigger Events Regardless Of Whether Contract Changed #248

Closed
sthomas1978 opened this issue Oct 26, 2018 · 4 comments
Closed

WebHook Trigger Events Regardless Of Whether Contract Changed #248

sthomas1978 opened this issue Oct 26, 2018 · 4 comments

Comments

@sthomas1978
Copy link

Pre issue-raising checklist

I have already (please mark the applicable with an x):

  • [x ] Upgraded to the latest Pact Broker OR
  • [x ] Checked the CHANGELOG to see if the issue I am about to raise has been fixed

Software versions

Docker Pact Broker Version : 2.27.2

I currently have the following setup

1 x Consumer
2 x Providers

The consumer has pacts for both providers.

I have a build process setup whereby

We run the consumer to generate all the pact files and upload them to pact-broker regardless of whether these have changed or not.

If the pact between the consumer and providers change then the pact-broker will trigger the contract_content_changed webhook to run the pact tests between the consumer and the specific provider and publish the results back to the pactbroker on the CI build server.

I then have the pact-broker use the provider_verification_published webhook to publish a commit status to git saying whether test worked.

The issue I have is that I want to make these github commit status's mandatory BUT if one of the contracts does not change, the web hook for contract_content_changed will not trigger, this will not trigger a CI Provider to run the tests and publish the results back to the pact broker, which in turn will not trigger the provider_verification_published to send a github status in repo so say it passed or failed.

Is there a way to trigger a webhook regardless of whether the contract changed or not?

If the way I have configured the build process is incorrect then let me know

Thanks

Simon

@sthomas1978
Copy link
Author

I dont think I need this now based on the way I have configured the integration process on Team City.

@kuangp
Copy link

kuangp commented Dec 6, 2018

I have this same issue described here for where the git status is not updated/reported when a PR is made but the contracts have not changed. Is there a workaround for this to trigger a webhook whenever contracts are published regardless of whether they have changed or not? perhaps a new web hook event for contract_published that can be used to trigger off of?

@bethesque
Copy link
Member

This would be quite easy to do. It's just a matter of having the free time to do it, which I don't have a lot of right now. If you're keen enough to do a PR, I can show you where the code would need to change.

https://github.com/pact-foundation/pact_broker/blob/master/lib/pact_broker/pacts/service.rb#L138
lib/pact_broker/pacts/service.rb:138

I remember I deliberately made the event "CONTRACT_CONTENT_CHANGED" instead of PUBLISHED so that we could add one for PUBLISHED later.

Adding the event to this list should allow the API to accept the new value: https://github.com/pact-foundation/pact_broker/blob/master/lib/pact_broker/webhooks/webhook_event.rb#L14

@kuangp
Copy link

kuangp commented Feb 19, 2019

Hi @bethesque,

I'm not very familiar with developing in ruby but I attempted to make the change here: #258

Please let me know what you think. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants