The can-i-deploy tool should take note of all versions of all collaborators released to a target environment. However, during my short evaluation of Pact, I've observed an issue where in one situation, it returns a false positives - advising it's safe to deploy when it isn't.
The following screenshot (taken from PactFlow.io) presents the Matrix for a consumer and provider:
I deliberately introduced a breaking change within the consumer at 0.0.3-SNAPSHOT when both participants where 'deployed to production' at 0.0.2-SNAPSHOT. At this stage, both can-i-deploy and the Matrix both agreed that this version was not safe to deploy.
I resolved the breakage with a resulting update to the provider in its 0.0.3-SNAPSHOT. At this stage, the Matrix correctly stated that the 0.0.3-SNAPSHOTs are compatible. can-i-deploy correctly stated that the consumer 0.0.3-SNAPSHOT was unsafe to release as the incompatible provider 0.0.2-SNAPSHOT was still deployed.
The screenshot demonstrates the state after releasing provider 0.0.3-SNAPSHOT. The second line within the Matrix correctly shows that consumer 0.0.3 is incompatible with provider 0.0.2 which is still released to production and therefore is unsafe to deploy. However, the output of can-i-deploy disagrees with the matrix:
will@host broker % podman run --rm \
-e PACT_BROKER_BASE_URL=https://xxx.pactflow.io \
-e PACT_BROKER_TOKEN=<token> \
pactfoundation/pact-cli:latest pact-broker can-i-deploy \
--pacticipant consumer \
--version 0.0.3-SNAPSHOT \
--to-environment production
Computer says yes \o/
CONSUMER | C.VERSION | PROVIDER | P.VERSION | SUCCESS? | RESULT#
---------|----------------|----------|----------------|----------|--------
consumer | 0.0.3-SNAPSHOT | provider | 0.0.3-SNAPSHOT | true | 1
VERIFICATION RESULTS
--------------------
1. https://xxx.pactflow.io/pacts/provider/provider/consumer/consumer/pact-version/4a9234eb022c262a1a3d960f70b64cf0f7c7dc73/metadata/Y3ZuPTAuMC4zLVNOQVBTSE9U/verification-results/221 (success)
All required verification results are published and successful
Whilst it correctly reports true for the provider 0.0.3 line, it fails to list the provider 0.0.2 line which should evaluate to false.
I've now replicated this with two separate codebases using Pact JVM consumer, provider and maven artefacts at 4.6.20. The first replication used the latest Docker based pact broker (2.118.0) and this latest attempt used PactFlow.io. Both used the latest Docker based CLI:
will@host broker % podman run --rm pactfoundation/pact-cli:latest version
1.5.0
These both failed on my local machine.
Steps to replicate:
- Create a compatible consumer and provider and publish verification of both to a broker
- Release both to 'production' in the broker
- Introduce a breaking change in the consumer.
can-i-deploy will agree with the Matrix and state that the breaking consumer is not safe to release to production.
- Introduce a fix to the breakage in the provider and verify again.
can-i-deploy will agree with the Matrix and state that the breaking consumer is not safe to release to production as non compatible providers are still in production.
- Release the provider fix to production within the broker. At this point,
can-i-deploy for the latest consumer will diverge from the Matrix. The Matrix will correctly hint that the consumer is not safe to deploy. However, the can-i-deploy tool will incorrectly state that release is safe and only include a line for the released provider with fix. It will not include the incompatible previous version of the provider that is still released as it has not been record-support-ended.
The
can-i-deploytool should take note of all versions of all collaborators released to a target environment. However, during my short evaluation of Pact, I've observed an issue where in one situation, it returns a false positives - advising it's safe to deploy when it isn't.The following screenshot (taken from PactFlow.io) presents the Matrix for a consumer and provider:
I deliberately introduced a breaking change within the consumer at 0.0.3-SNAPSHOT when both participants where 'deployed to production' at 0.0.2-SNAPSHOT. At this stage, both
can-i-deployand the Matrix both agreed that this version was not safe to deploy.I resolved the breakage with a resulting update to the provider in its 0.0.3-SNAPSHOT. At this stage, the Matrix correctly stated that the 0.0.3-SNAPSHOTs are compatible.
can-i-deploycorrectly stated that the consumer 0.0.3-SNAPSHOT was unsafe to release as the incompatible provider 0.0.2-SNAPSHOT was still deployed.The screenshot demonstrates the state after releasing provider 0.0.3-SNAPSHOT. The second line within the Matrix correctly shows that consumer 0.0.3 is incompatible with provider 0.0.2 which is still released to production and therefore is unsafe to deploy. However, the output of
can-i-deploydisagrees with the matrix:Whilst it correctly reports true for the provider 0.0.3 line, it fails to list the provider 0.0.2 line which should evaluate to false.
I've now replicated this with two separate codebases using Pact JVM consumer, provider and maven artefacts at
4.6.20. The first replication used the latest Docker based pact broker (2.118.0) and this latest attempt used PactFlow.io. Both used thelatestDocker based CLI:These both failed on my local machine.
Steps to replicate:
can-i-deploywill agree with the Matrix and state that the breaking consumer is not safe to release to production.can-i-deploywill agree with the Matrix and state that the breaking consumer is not safe to release to production as non compatible providers are still in production.can-i-deployfor the latest consumer will diverge from the Matrix. The Matrix will correctly hint that the consumer is not safe to deploy. However, thecan-i-deploytool will incorrectly state that release is safe and only include a line for the released provider with fix. It will not include the incompatible previous version of the provider that is still released as it has not beenrecord-support-ended.