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

feat: add support for contract_requiring_verification_published webhook #476

Merged

Conversation

bethesque
Copy link
Member

@bethesque bethesque commented Aug 3, 2021

Implements the feature discussed in #434

When a pact is published, a webhook with the new event contract_requiring_verification_published is triggered for:

  • The latest version of the main branch of the provider IF there is no existing verification for this provider version and the pact content
  • Each currently deployed/released version of the provider WHERE there is no existing verification for the provider version and the pact content

The provider versions are de-duplicated (eg. if the same version is the latest from the main branch, and a deployed/released version, only one triggered webhook is created).


Provider Head Provider Test Provider Prod
Consumer Head * % $ $ $
Consumer Test *
Consumer Prod *

* When the provider changes, these combinations are tested in the provider's release pipeline via the consumer version selectors

% When the consumer (pact) changes, this combination is tested via the provider verification triggered by the contract_content_changed webhook. Note that it is missing the test and prod combinations.

$ When the consumer (pact) changes, these combinations are tested via the provider verifications triggered by the new contract_requiring_verification_published webhook. Note that it is the exact inverse of the combinations tested by in the provider's release pipeline.


The addition of the contract_requiring_verification_published event means use of the contract_content_changed webhook will no longer be recommend (but it will continue to be supported). It solves the following problems:

  • The event contract_content_changed does not map 100% to "we need to trigger a verification build". Sometimes we unnecessarily trigger a build, and sometimes there are builds that we should trigger that we don't.
  • Webhooks for contract_content_changed are unnecessarily triggered when tags are applied to existing content.
  • Advanced knowledge of the broker API is currently required to get verification results from test/prod versions of the providers, resulting in a higher number of "no" responses for can-i-deploy for consumers than is necessary.

@@ -89,7 +90,16 @@ def delete_all_verifications_between(consumer_name, options)
verification_repository.delete_all_verifications_between(consumer_name, options)
end

private
def calculate_required_verifications_for_pact(pact)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the crux of the feature.

@bethesque bethesque merged commit b4699df into master Aug 5, 2021
@bethesque bethesque deleted the feat/contract-published-requiring-verification-webhook branch August 5, 2021 04:44
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

Successfully merging this pull request may close these issues.

None yet

1 participant