I can't understand why event `contract_requiring_v...
# general
g
I can't understand why event
contract_requiring_verification_published
is not firing on my pact broker. I have a consumer and a provider, both with the main branch defined. When I publish a contract for the consumer providing a version and the main branch as the branch, should that not fire? Instead the publish command outputs:
Events detected: contract_published, contract_content_changed (pact content has changed since previous untagged version)
Is this because the contract is untagged? Why is it untagged if I am provided a version and the branch?
This is the command I am using to publish:
Copy code
pact-broker publish pacts/BillingAPI-PlatformAssignmentService.json --consumer-app-version 0000000006 --branch=develop
y
Use of this webhook requires that:
• the exact commit of a provider version can be determined from the version number used to publish the verification results (ie. it either is the commit, or contains the commit as per the Pact Broker version number guidelines)
Try adding a git sha to your app version as per the versioning guidelines
Have the application version number include something that identifies the point in your version control repository that will build this application. For git, it is ideal if you either use the git commit sha (short or long), or include the git commit sha in your version number (for example 0.0.10+76a39e5). This has several advantages:
• The consumer version will definitely change whenever the pact contract changes (satisfying rule 1 above)
g
I understand the need to use a version number that allows you to recover a certain version of the code when you receive the webhook (I think that is what you are referring to). My problem is that the event
contract_requiring_verification_published
does not fire. BY the way, I am using git SHAs as version umber. The number you see in my example publish command is just me trying manual publishing in order to see what gets triggered. I don't think the pact broker cares about the format of the version number in order to trigger events, correct?
I think I can confirm that the format of the version does not matter. For a second integration the event
contract_requiring_verification_published
is fired even with a version like "003".
y
Is this a new integration with no existing provider versions?
if so this may be relevant https://github.com/pact-foundation/pact_broker/issues/574 if not, can you confirm the main branch property is set for both pacticipants?
g
ok. That looks like it. I think I am in the exact situation you were highlighting in that issue report. I hope you will have the time and patience to help me as I need to get bottom of this. This is what I have tried: • publish a contract (first contract of a new integration) indicating version and branch of the consumer: events
contract_published
and
contract_content_changed
are triggered but not
contract_requiring_verification_published
. According to your link this is to be expected. • Set a main branch for the provider using
pact-broker create-or-update-pacticipant --name=provider02 --main-branch=develop
• Publish new contract with new version and main branch from the consumer: still no
contract_requiring_verification_published
triggered. Is this because the provider has the branch but not the version set? • Set also the version for the provider with call:
Copy code
curl 'https://<pact broker domain>/pacticipants/provider02/branches/develop/versions/001' -X PUT
• Publish new contract with new version and main branch from the consumer: still no
contract_requiring_verification_published
triggered • Verified contract with call:
Copy code
curl 'https://<pact broker domain>/pacts/provider/provider02/consumer/consumer02/pact-version/fe43de69914431bcb03717d78de472870e934ef1/metadata/c1tdW2JdPWRldmVsb3Amc1tdW2xdPXRydWUmc1tdW2N2XT05NDAmcD10cnVl/verification-results' -X POST -H "Content-type: application/json" -d '{"success": true, "providerApplicationVersion": "001"}'
• Publish new contract with new version and main branch from the consumer: still no
contract_requiring_verification_published
triggered At this point I have a consumer with main branch and version, a provider with main branch and version, the pact has been verified already. I don't understand what I am missing to have the
contract_requiring_verification_published
triggered. Also the below point does not look not right: • After publishing I keep getting the message
pact content has changed since previous untagged version
related to the triggered events. Why is it saying
untagged
when I always provide branch and version of the consumer when publishing? Also, why the branch of the provider does not appear next to the version that verified the contract?