Hello again, one last question on `can-i-deploy` p...
# general
t
Hello again, one last question on
can-i-deploy
please… We have one consumer app
Foo
that consumes let’s say 2 different providers We have all our provider verification tests etc in place for only one of those providers. For the other provider, those verification tests have not been added yet and we only have the consumer side expectations/tests done. This thus fails in
can-i-deploy
step because one of the providers hasnt got any verification tests/results, and we are using the same consumer name pacticipant
Foo
in all cases, as its all the same single consumer app. I can see a way around this would be to use different consumer pacticipant names for our contracts between provider
A
and our contracts between provider
B
, but is this the correct approach? Shouldn’t we just have one consumer pacticipant? But then what do we do in the situation where we are still waiting on provider tests to be added for a provider? Thanks.
t
As a workaround, you can ask can-i-deploy about the specific consumer and provider, rather than the environment
That way you don't have to use different consumer names, but you do have to remember to change it back when the other provider has tests
t
Sorry do u have an example please?
t
I don’t, but I think you can give can-I-deploy the consumer and provider names (it allows you to specify multiple)
t
Hmm I’ll check the docs again in the morning but I’m currently unsure how I could provide two pacticipants in one command
t
just specify twice
it supports repeat parameters
t
Right but I wouldn’t want to check can I deploy for provider from consumer pipeline ?
t
pact-broker can-i-deploy --pacticipant Foo  --pacticipant Bar
t
Bit confused now
t
Yes, usually you wouldn’t. This is a workaround for the problem of wanting to exclude the provider that has no tests
t
Hm thanks so u would recommend this over different consumer participant names ?
t
From the docs:
Can I deploy the latest version of Foo with tag “master” and the latest version of Bar with tag “master” together?
Copy code
$ pact-broker can-i-deploy --pacticipant Foo --latest master \
                           --pacticipant Bar --latest master
yes
different consumer participant names ?
This will live for a long time
it will be hard to undo
changing the can-I-deploy check will be easy
t
That makes sense ye
Thanks
t
you’re welcome! Let us know how you go
t
Ah wait using —latest is for the legacy tagging way, I don’t use tags would I have to now for this workaround?
t
I think it works with other methods
t
Ok
hello, sorry to revive this thread but this has proven to be a bigger problem for us… as we use environments and not the legacy tagging, i don’t know a way that we can get the specific provider pacticipant versions within a given environment, and using
--to
or
--to-environment
still checks against all provider services (even ones not ready for can-i-deploy) the only command ive gotten working as a temp workaround, but is still less than ideal is
Copy code
pact-broker can-i-deploy --pacticipant ConsumerApp \
--version "$GIT_COMMIT" \
--pacticipant ProviderService \
--branch main
which checks against the latest version on that
main
branch but not the versions in the environments. I don’t really want to have to refactor and add in legacy tagging just to be able to get the specific versions within environments either. Any ideas here please? 🙏
To follow up on this, I have decided to go the route of creating a version tag right after we record deployment/release, this allows us to then do something like
pact-broker describe-version -a ProviderService -l $TAG -o json | jq '.number'
to get the needed provider version number, something i cant do without the legacy tagging currently, would be good if we could get provider version based on the new
environment
instead (maybe a feature request for future 🙂 )
t
I would put feature requests here https://pact.canny.io/feature-requests or directly in #C5F4KFKR8 to ensure that a maintainer sees it. Maybe ask in #C9VPNUJR2, too, if you haven’t already
t
thanks will add it to canny 🙂