Hi team, I have 4 services, and a few contracts a...
# pact-broker
t
Hi team, I have 4 services, and a few contracts among them (diagram in attachment) Now I am going to deploy them to the first environment: staging. The first service I tried is
admin
. When I run Github actions's
can-i-deploy
tool I got:
Copy code
Computer says no ¯\_(ツ)_/¯

CONSUMER | C.VERSION  | PROVIDER     | P.VERSION | SUCCESS? | RESULT#
---------|------------|--------------|-----------|----------|--------
admin    | 955fd80... | fund         | ???       | ???      |        
admin    | 955fd80... | relationship | ???       | ???      |        
admin    | 955fd80... | user         | ???       | ???      |        

There is no verified pact between version 955fd80d59646bbb7adaff4b2c19ed3e90aa1b36 of admin and a version of fund currently in staging (no version is currently recorded as deployed/released in this environment)
There is no verified pact between version 955fd80d59646bbb7adaff4b2c19ed3e90aa1b36 of admin and a version of relationship currently in staging (no version is currently recorded as deployed/released in this environment)
There is no verified pact between version 955fd80d59646bbb7adaff4b2c19ed3e90aa1b36 of admin and a version of user currently in staging (no version is currently recorded as deployed/released in this environment)
and I have no question about it. Then I tried
fund
. Here is the result:
Copy code
Computer says no ¯\_(ツ)_/¯

No pacts or verifications have been published for version 78d67b96544fd831c62715c78c11f20597afef77 of fund
I think I got the
chicken & egg
problem exactly like https://github.com/pact-foundation/pact_broker-client/issues/25#issue-287038484 I saw that Beth mentioned it was fixed in https://github.com/pact-foundation/pact_broker-client/issues/25#issuecomment-519790354, but I still got this issue. • Pact Broker version: PactFlow 6bd3f8b41 • Pact Specification version: 4.0 • FFI library: 0.4.x So my question is: is the fix is just for
tag
(deprecated) and not for the combination of
branch + environment
?
I also create a "custom" github action to work around like this https://github.com/tienvx/can-i-deploy/blob/main/canideployTo.sh#L17 But is it a correct solution?
m
I think maybe you need this: https://docs.pact.io/pact_nirvana/notes_1
If you provider has no consumers, it should be safe to deploy (you just need the above)
the opposite is not true, you can’t deploy a consumer for which its provider is not also deployed (and satisfies the contract of the to-be-deployed consumer)
t
Even though I do not fully understand, it (the
create-or-update-version
command) work great for me. I saw the official Github's pactflow actions didn't have that command, so I created it here https://github.com/tienvx/create-or-update-version
🙌 2
m
The broker is saying “I have never seen $version before, so I don’t know what to do with it”
💯 1
basically, the error is a
404
. The version you are trying to release doesn’t exist, so it can’t tell you what to do with it. By creating a version, the broker knows what you’re asking - that application (and version) has no dependencies, and so it’s safe to release
think of it as a sanity check - imagine if you accidentally spelled the provider name wrong, what might go wrong
y
Thanks for the PR @Tien Vo it is merged and released now https://github.com/pactflow/actions/releases/tag/v1.1.0
🎉 2