https://pact.io logo
r

Rubén Pérez

07/26/2022, 6:57 AM
Hi Pact team 🙂 We have recently integrated our CI/CD flows with Pact, and we are seeing a behaviour that is being challenging to explain 😅 What we see is that the webhook (
contract_content_changed
event) gets executed way too many times from what we would expect. I was trying to debug what is going on looking at this, and what we see is that this is the message that I see constantly:
"Scheduling job for webhook with uuid ap7c1tk-AdEYyphWBVieIg"
. But it looks like the contract should have not changed, so I'm clearly missing something. Is there any way to actually see what are the 2 versions of the contract the Broker is comparing to understand what is going on? Also, as far as I've seen in the documentation, this could also explain what is happening:
If the relevant consumer version has any tags, then for each tag, check if the content is different from the previous latest version for that tag. It is 'changed' if any of the checks are true. One side effect of this is that brand new tags will trigger a pact changed event, even if the content is the same as a previous version.
But all the versions published are tagging with
master
, so I'm not sure if there is anything else I should be looking at...
Extra information: We are using branches and environments, but we are still also creating tags even though we are trying to avoid the use of tags for all CI/CD flows
t

Timothy Jones

07/27/2022, 5:18 AM
There is a diff endpoint on the broker you can use to check what has changed
Usually this happens when changing data is included in the contract every time.
r

Rubén Pérez

07/27/2022, 9:53 AM
Thank you Timothy! Could you help me find that endpoint? Can I get there using the HAL Browser? Or can I find it somewhere in the documentation?e
m

Matt (pactflow.io / pact-js / pact-go)

07/27/2022, 10:14 AM
If you navigate to the pact in the HAL browser, there should be a relation to discover previous versions of the integration
r

Rubén Pérez

07/27/2022, 10:21 AM
I think I have seen it now, but is there a way to get that content in a "plain json" format? What I'm getting is the Pact itself but visualized using the Pact Broker browser, which is good, but not very diff-friendly 😅
For anyone interested:
<http://my-pact-broker.com/pacts/provider/myProvider/consumer/myConsumer/versions>
r

Rubén Pérez

07/27/2022, 10:30 AM
ohhh, now I see that 🤘 🤘 🤘 🤘 🤘
I tried to search for previous questions/answers here in slack, but clearly my searching skills in slack are not as good as yours 😆 Thank you very much to both of you Timothy and Matt!!
t

Timothy Jones

07/27/2022, 10:32 AM
You're welcome. If it helps, I didn't actually find what I was looking for either.
b

Beth (pactflow.io/Pact Broker/pact-ruby)

07/28/2022, 11:18 PM
@Rubén Pérez you should be seeing output during the publishing step that tells you why the webhook has been triggered.
Are you not seeing that?
@Rubén Pérez also, you would be better to use the new webhook “contract requiring verification published” https://docs.pact.io/blog/2021/10/11/contract-requiring-verification-published-webhook-event
r

Rubén Pérez

07/29/2022, 7:30 AM
Thank you Beth 🙂 I saw in the logs that the webhook was triggered, but I didn't see why. I saw one of the options in the logs:
Scheduling job for webhook with uuid ap7c1tk-AdEYyphWBVieIg
Which looks like just a "contract change" to me. But the consumer team told me that they didn't change anything for some time, but still the provider tests got triggered between 10 and 20 times per day. I just needed some help to try to see how the contract was actually changing... And you all helped me. For the record, I was able to see the changes and understand what was happening. In this case, the consumer tests were using
form-data
, which uses a
boundary
field internally. That field was created randomly for every test execution, and that was the "change" introduced in every single CI consumer build.
m

Matt (pactflow.io / pact-js / pact-go)

07/29/2022, 7:31 AM
And you all helped me. For the record, I was able to see the changes and understand what was happening. In this case, the consumer tests were using
form-data
, which uses a
boundary
field internally. That field was created randomly for every test execution, and that was the “change” introduced in every single CI consumer build.
good pickup! That’ll do it
r

Rubén Pérez

07/29/2022, 7:31 AM
also, you would be better to use the new webhook “contract requiring verification published”
I know, but I have not been able to get into it yet 😅
Thank you for all the help folks, you are awesome 🙂