Armen Chuljyan
02/10/2023, 4:11 PMpact-broker can-i-deploy --pacticipant=myservice --broker-base-url=<https://my.cool-pact-broker.com> --version=f7a284be9046416fad7a577bb52737af571dd6d1 --to-environment=prod
Computer says no ¯_(?)_/¯
No pacts or verifications have been published for version f7a284be9046416fad7a577bb52737af571dd6d1 of myservice
Then I'm running pact-broker create-or-update-version by providing that version:
pact-broker create-or-update-version --pacticipant=myservice --broker-base-url=<https://my.cool-pact-broker.com> --version=f7a284be9046416fad7a577bb52737af571dd6d1
And after that I'm running pact-broker can-i-deploy again
pact-broker can-i-deploy --pacticipant=myservice --broker-base-url<https://my.cool-pact-broker.com> --version=f7a284be9046416fad7a577bb52737af571dd6d1 --to-environment=prod
Computer says yes \o/
There are no missing dependencies
And it returns "*yes*" for all the environments for that particular version.
Is this behavior expected?Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Armen Chuljyan
02/13/2023, 9:00 AMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
we don’t allow the pipeline to fail during the pact test stage and let can-i-deploy to control (to pass/fail) the pipelinewhy? That’s like saying “if my unit tests fail, i’ll still deploy if my end-to-end tests pass”
Armen Chuljyan
02/13/2023, 11:57 AMArmen Chuljyan
02/13/2023, 12:00 PMwhy?Reason to do it this way: Our release engineering team is currently not using webbooks for some reason and is triggering a pact verification pipeline based on GitLab dependencies on pact publishing stage. This approach avoids the failure of the pipeline at this stage for this type of contract testing pipeline configuration in case the downstream pact verification pipeline fails for any reason not related to the contract, but the published pact is not changed and previously successfully verified.
Armen Chuljyan
02/13/2023, 12:23 PMI think that’s probably the problem. That version doesn’t have any dependencies - other versions might and they aren’t deployable.my understanding is that dependencies are more about the Pacticipant and not the specific version. If a version exists in Pact Broker but has not been verified, "can-I-deploy" should answer "NO" with the reason "not verified for that version".
Beth (pactflow.io/Pact Broker/pact-ruby)
my understanding is that dependencies are more about the Pacticipant and not the specific version
Beth (pactflow.io/Pact Broker/pact-ruby)
Beth (pactflow.io/Pact Broker/pact-ruby)
Beth (pactflow.io/Pact Broker/pact-ruby)
Beth (pactflow.io/Pact Broker/pact-ruby)
Beth (pactflow.io/Pact Broker/pact-ruby)
Beth (pactflow.io/Pact Broker/pact-ruby)
Matt (pactflow.io / pact-js / pact-go)
The dependencies are on that particular version.If you think about it, it has to be this way. One minute the application has 0 dependencies, and the next minute it has 1. When it has 0 it is always safe to release (as far as Pact is concerned). Once it has a dependency, we then have more information to check (is the dependency relationship satisfied) before we let it through
Matt (pactflow.io / pact-js / pact-go)
don’t quite agree, deployment shouldn’t happen due to a failure in the “can-I-deploy” stageIn case I wasn’t clear, I see a pipeline as a serious of stages that must be passed before moving on to the next. If your unit tests fail, usually in a “pipeline” you wouldn’t proceed to the next step (you might, to get additional feedback) but at th every least, the pipeline would still fail because an important check failed. Pact tests should be thought of as (something like) a unit test that checks you can effectively collaborate with other applications. If these tests fail, it should be a clear warning sign that something is wrong.
Armen Chuljyan
02/14/2023, 5:24 PMArmen Chuljyan
02/14/2023, 5:25 PMArmen Chuljyan
02/14/2023, 5:25 PMMatt (pactflow.io / pact-js / pact-go)
record-deployment doesn’t care about the result of the contract test, it is stating a fact - version X of application Y has been deployed to environment Z. So you can still call that.
I think what will happen eventually is that you’ll get stuck in some loop, where can-i-deploy won’t let you deploy to a certain environment because you’ve brute forced your way around the checks. This will then lead to a serious of guards in your scripts to ignore checks for certain applications under certain conditions, which I think will be a mess to maintain.Armen Chuljyan
02/15/2023, 2:02 PMservice-X, version Z not found (error requesting <https://pact-broker>... status=404)
So, to record a consumer version deployment that has not published a pact file, you must call create-or-update-version on that version of the consumer.Beth (pactflow.io/Pact Broker/pact-ruby)
Beth (pactflow.io/Pact Broker/pact-ruby)