hello! A small question about `can-i-deploy`: I ha...
# pactflow
d
hello! A small question about `can-i-deploy`: I have a provider with 3 consumers, which regularly deploy new versions to an environment called "production". Since we are releasing a few times per hour, we just use as versions the commit sha, but this creates a problem with
can-i-deploy
for the provider. We would like to tell it to verify always with the latest version of the consumers on that environment, but based on the documentation it doesn't seem to be possible. The only thing I can thing of is to use a tag and tell the provider to always check with the latest of that tag, however, I don't want us to specify the consumers, in case others will appear and we will miss adding them there. So in short, is there a way to specify to
can-i-deploy
to check with the latest versions of the consumers from an environment?
đź‘‹ 2
m
Yes, you use the
record-deployment
tool for your consumers, and specify
--to-environment
in your
can-i-deploy
command calls (on both consumer and provider CI pipelines)
d
Yes, that's how we are doing the current verification, but it still checks with all of the releases ever recorded there rather than the latest one
m
no that’s not true
a deployment will override the previous deployment. If you use
record-release
that will verify all consumers currently “released” (e.g. multiple versions of a mobile app). When that version is decommissioned, you need to unrelease it
what makes you think it’s verifying all of the consumer versions ever?
Can you please share the command you are running and the can-i-deploy output? Perhaps you can redact / change the names
d
yes, the command for can-i-deploy is:
Copy code
pact pact-broker can-i-deploy
  --pacticipant xhr-api \
  --version ${CI_COMMIT_SHA} \
  --to-environment "production"
and the output looks like this:
I think we need to unrelease them indeed, but since the version is based on the commit sha, it's not easy to target them for unreleasing
m
Do you actually run multiple applications in production? Or are you inadvertently using
record-release
instead of
record-deployment
?
d
hmm yes, we used record-release instead of deployment. I mistakenly thought that record-release should be used as the final "release" step of a contract, but now I am re-reading and seeing my mistake
I will switch to record-deployment instead, since that one looks to be the one we actually need
👍 2
thanks!
m
You're welcome!