Closed bheemreddy181-zz closed 3 years ago
I think this issue might be related to this: https://github.com/pact-foundation/pact_broker/issues/362
@bethesque but this was broken in the initial commit where the contract was changed , there is only one commit in this PR
I think I've reproduced the issue, but maybe there is another one.
Can you follow these instructions for me: https://github.com/pact-foundation/pact_broker/blob/issue/pact-broker-377/ISSUES.md
You will need Docker and Docker Compose
git clone git@github.com:pact-foundation/pact_broker.git
cd pact_broker
git checkout issue/pact-broker-377
docker-compose -f docker-compose-issue-repro-with-pact-broker-docker-image.yml up pact-broker
# new window
docker-compose -f docker-compose-issue-repro-with-pact-broker-docker-image.yml up webhook-server
# new window
docker-compose -f docker-compose-issue-repro-with-pact-broker-docker-image.yml run repro-issue
If you go to the webhook-server window, you'll see that while there were two webhook executions for the publishing, there was only one for the verification, as they both had the same content, and the verifications are now de-duplicated.
webhook-server_1 | [2021-01-29 00:22:55] INFO WEBrick::HTTPServer#start: pid=1 port=9393
webhook-server_1 | {"eventName":"${pactbroker.eventName}","consumerVersionNumber":"1","consumerVersionTags":"main","githubVerificationStatus":"pending","providerVersionNumber":"","providerVersionTags":""}
webhook-server_1 | 172.28.0.2 - - [29/Jan/2021:00:23:03 +0000] "POST / HTTP/1.1" 200 18 0.0016
webhook-server_1 | {"eventName":"${pactbroker.eventName}","consumerVersionNumber":"2","consumerVersionTags":"feat/x, feat/y","githubVerificationStatus":"pending","providerVersionNumber":"","providerVersionTags":""}
webhook-server_1 | 172.28.0.2 - - [29/Jan/2021:00:23:03 +0000] "POST / HTTP/1.1" 200 18 0.0007
webhook-server_1 | {"eventName":"${pactbroker.eventName}","consumerVersionNumber":"2","consumerVersionTags":"feat/x, feat/y","githubVerificationStatus":"success","providerVersionNumber":"1","providerVersionTags":"main"}
webhook-server_1 | 172.28.0.2 - - [29/Jan/2021:00:23:13 +0000] "POST / HTTP/1.1" 200 18 0.0006
If the scenario in the script/reproduce-issue.rb
file doesn't match yours, then please fork the repo and modify it so that it does, and then let me know.
Are you using the new "pacts for verification" api for verifying? ie. using consumer version selectors, not just just a list of tags?
we are not using any API specifically all we are using is tags for verification like here as implemented in the workshop
So you're using the Pact Go client? What version are you using?
this is happening for both ruby and go lang - and coming to go package it is v1.5.1
Looking at that code, it's just using the standard tags, not the consumer version selectors (supported).
Would it make sense to start mapping the legacy Tags
to consumer version selectors behind the scenes do you think? (or does the CLI already do that anyway?)
Can you turn on the verbose logging so we can see which API it's using @bheemreddy181? See the verbose
option documentation that I've just added to https://github.com/pact-foundation/docs.pact.io/blob/master/website/docs/implementation_guides/ruby/verifying_pacts.md#fetching-pacts-from-a-pact-broker
There will be a way to do it with the Go library as well - check the docs.
hmmm that flag is currently a noop in Pact Go, because it broke the way the verification worked. I think it's been fixed in Ruby at least, but previously the verbose logging was interspersed with the JSON output which broke the parsing.
@bheemreddy181 you could hack the Pact go lib locally to re-connect the Verbose
flag to the CLI, just note that the test will return an error
. It should print out the inner workings we're after though.
If the standalone is new enough, you can just set the environment variable VERBOSE=true
and it will pick it up. Or is it using the new rust code?
The pact-provider-verifier turns tags into selectors and uses the new API https://github.com/pact-foundation/pact-provider-verifier/blob/master/lib/pact/provider_verifier/aggregate_pact_configs.rb#L56
👏
If it's what I think it is, this PR will fix it https://github.com/pact-foundation/pact_broker/pull/378
I think I've reproduced the issue, but maybe there is another one.
Can you follow these instructions for me: https://github.com/pact-foundation/pact_broker/blob/issue/pact-broker-377/ISSUES.md
You will need Docker and Docker Compose
git clone git@github.com:pact-foundation/pact_broker.git cd pact_broker git checkout issue/pact-broker-377 docker-compose -f docker-compose-issue-repro-with-pact-broker-docker-image.yml up pact-broker # new window docker-compose -f docker-compose-issue-repro-with-pact-broker-docker-image.yml up webhook-server # new window docker-compose -f docker-compose-issue-repro-with-pact-broker-docker-image.yml run repro-issue
If you go to the webhook-server window, you'll see that while there were two webhook executions for the publishing, there was only one for the verification, as they both had the same content, and the verifications are now de-duplicated.
webhook-server_1 | [2021-01-29 00:22:55] INFO WEBrick::HTTPServer#start: pid=1 port=9393 webhook-server_1 | {"eventName":"${pactbroker.eventName}","consumerVersionNumber":"1","consumerVersionTags":"main","githubVerificationStatus":"pending","providerVersionNumber":"","providerVersionTags":""} webhook-server_1 | 172.28.0.2 - - [29/Jan/2021:00:23:03 +0000] "POST / HTTP/1.1" 200 18 0.0016 webhook-server_1 | {"eventName":"${pactbroker.eventName}","consumerVersionNumber":"2","consumerVersionTags":"feat/x, feat/y","githubVerificationStatus":"pending","providerVersionNumber":"","providerVersionTags":""} webhook-server_1 | 172.28.0.2 - - [29/Jan/2021:00:23:03 +0000] "POST / HTTP/1.1" 200 18 0.0007 webhook-server_1 | {"eventName":"${pactbroker.eventName}","consumerVersionNumber":"2","consumerVersionTags":"feat/x, feat/y","githubVerificationStatus":"success","providerVersionNumber":"1","providerVersionTags":"main"} webhook-server_1 | 172.28.0.2 - - [29/Jan/2021:00:23:13 +0000] "POST / HTTP/1.1" 200 18 0.0006
If the scenario in the
script/reproduce-issue.rb
file doesn't match yours, then please fork the repo and modify it so that it does, and then let me know.
I will try to replicate my issue using this , do you guys still want me to do ther verbose logging ?
The newer version still didn't fix it
Here is my use-case more in detail.
Consumer-A and Provider-B
I tried digging through GIT API's to see what all statuses i can see on this commit
I could see the context different for both the statues - As per the documentation the context should be same I feel https://docs.github.com/en/rest/reference/repos#create-a-commit-status , do we need to send a default context when we set pending
status. Typically the provider_version tags variable we use.
Git documentation here
I got this fixed by hardcoding the ${pactbroker.providerVersionTags}
to master
on the webhook , I don't think It has anything to do with pact broker upgrade this has been an issue on all the versions
Now on the git commit statuses, I could see both status checks having the same context
Learned something new here , curious how do we need to handle these cases ?
Ah - that will be because when the pending status is sent, we don't know which provider branch is going to verify it. The contexts can never match. Take the provider tags out of the context and put it in the description.
I've updated the template here https://docs.pact.io/pact_broker/webhooks/template_library#github---publish-commit-status
Pre issue-raising checklist
I have already (please mark the applicable with an
x
):Software versions
Expected behaviour
Github pending status checks need to be overwritten by success/failure on github pull requests
Actual behaviour
Github status checking both pending and success/failure status check for the pull requests
Steps to reproduce
Relevant log files
We are not seeing any logs in the pact broker open-source on-premise hosted version