Closed olivzz closed 3 years ago
So there is a 1.3.2 that had some small fixes around broker and pact paths. However, it is hard to know if this is your problem from this issue report. Can you provide more specific details about how it is not working
We expect to see something indicating publishing of verification results back to broker but it is not happening now because of which the consumer which is looking for the provider in the broker is failing. In short, the provider is not publishing the provider version to the broker.
It would be helpful if you could point out which parameter can help me out in publishing the provider/version to the broker? As of now I have set provider_app_version and publish_version. both are pointing to my build_version.
In verifier, where is the parameter pact_verification_results being used or given? As per my understanding , when pact is verified through CLI, pact_verification_results parameter is specified but not through python API. Could that be the source of my issue as I am using python API to verify pacts. please check https://github.com/pact-foundation/pact-python/blob/v1.3.1/pact/verifier.py
You may be right. This might not be there. If you close this and raise a separate targetted issue around the provider publishing provider verification results I'll try and make some time this weekend to add that to the api.
It looks to be missing this flag --publish-verification-results
, which is responsible for enabling it or not.
@olivzz in the meantime, you can use the environment variable PACT_BROKER_PUBLISH_VERIFICATION_RESULTS
to control that behaviour.
e.g. in CI, if you set the following it should publish
export PACT_BROKER_PUBLISH_VERIFICATION_RESULTS=true
This way, locally it won't publish (which is usually what you want)
I believe I have fixed this in 1.3.4
Actually 1.3.5. I realized I'd probably over complicated some bits. In the verifier btw you don't need to specify the publish verifications flag. Currently if you give it a publish version number it will do this for you. I'm not totally sure that's correct behaviour but it's what it does today.
There is a danger that the version will be set locally, and a developer will accidentally publish from their own machine, as it's not explicit. They shouldn't be using write creds, but we know people will!
Good point. They'll likely also get errors, so that could be a cause of confusion too.
I believe I have fixed this in 1.3.4
I tried publishing pact using 1.3.4 pact python, still the pact provider version is not visible in pact broker.I had follpowing set up for verifier: verifier = Verifier(provider="provider", provider_base_url=PROVIDER_URL, broker_url=os.environ.get("PACT_BROKER_URL"), broker_username=os.environ.get("PACT_BROKER_USERNAME"), broker_password=os.environ.get("PACT_BROKER_PASSWORD"), provider_tags=os.environ.get("PACT_BROKER_PUBLISH_TAGS"), publish_verification_results=True, publish_version=os.environ.get("BUILD_VERSION"), provider_app_version=provider_app_version )
Hi, I am writing a provider test over REST. It looks like I am unable to publish the provider to broker, I have set up the verifier as following, verifier = Verifier(provider="provider", provider_base_url=PROVIDER_URL, broker_url="PACT_BROKER_URL", broker_username="PACT_BROKER_USERNAME", broker_password="PACT_BROKER_PASSWORD", provider_tags="PACT_BROKER_PUBLISH_TAGS", publish_verification_results="PACT_BROKER_PUBLISH_VERIFY_RESULTS", publish_version="BUILD_VERSION", provider_app_version="BUILD_VERSION" ) consumer_selector_data = {"latest": True, "tag": "PACT_BROKER_VERIFY_TAGS", "consumer": "PACT_FILTERCONSUMERS" } output, = verifier.verify_with_broker(broker_url="PACT_BROKER_URL", verbose=True, provider_states_setup_url=provider_state_url, consumer_version_selector=consumer_selector_data) I assume I have used all the necessary parameters in verifier object creation. If so, why is this set up not publishing verifier to the pact broker? Just not sure if the publish functionality is working. Please help me out with this. NOTE: I am using pact-python version 1.3.1