Hello :wave: I am trying to do a `pact-broker desc...
# general
t
Hello πŸ‘‹ I am trying to do a
pact-broker describe-version
command for a latest pacticipant in environment
prod
, but am having trouble as it looks like you can only use a
--tag
in the command, but we instead use branches and environments so when i do something like
Copy code
pact-broker describe-version -a ProviderService --l prod
I get
Pacticipant version not found
any ideas please?? πŸ™
Context: We want to
record-support-ended
for previous release on provider side when we
record-release
for new version, but getting the previous image tag (previous provider version in prod) is proving difficult due to our setup. Is it possible we could just do
record-deployment
for prod environment here instead as that would auto
undeploy
the previous version? would that work ok once we get to the next steps of
can-i-deploy
etc ??
y
oh interesting question, I haven't tried if
record-deployment
also unmarks
released
versions. You could try in the Broker UI and filter by environment and pacticipant name in the matrix view. It should be listed in the matrix, as to which version is in the environment πŸ™‚
I don't think its available via the CLI but should be available via the Broker API, you can view the HAL client in the broker UI to check all the link relations for particular pacts, and make auth calls. The Aus team should be able to help out later when they are up πŸ™‚
t
thanks, so I’m looking at parsing this previous version in a CI job that records provider release in prod, ideally in something like a bash script step in our CI workflow or similar so I can then
record-support-ended
for it. Currently we only have access to
.Values.image.tag
and not the previous one unless we do some refactoring. Our consumer side is fine as we support all releases basically forever. Provider service is backend though and we only ever support one version at a time, whatever the latest release in prod is. Was thinking a potential easy solution/workaround is if we just
record-deployment
to prod for provider instead of
record-release
, then the previous version will get automatically undeployed by Pact and it saves us the hassle of figuring out how to retrieve and parse the previous image tag/provider version in prod, unless like u mention there is a relatively easy way via Broker API or similar.
looking at HAL browser now struggling a bit to see how i can easily get latest provider version on branch
main
and environment
prod
πŸ€”
y
You could run a local provider verification with consumer version selectors set to released, and the providers name, set publish results to false and it will pull back the versions matching that selector, might be quicker than navigating the APi
t
hmm, is the only difference between
record-release
and
record-deployment
that
record-release
doesnt automatically unrelease previous version? Are there any other differences that might affect
can-i-deploy
for example?
y
is your provider using
record-release
although it only ever has one live?
t
yes
y
if you run
can-i-deploy
for consumer, it should list the all provider application versions deployed or released in the environment
t
and were thinking of changing it to record-deployment
πŸ‘ 1
y
so there should only be one provider version returned, if only one is released
I believe they are separate, as there are seperate consumer version selectors, deployed, released, and deployedOrReleased. Sounds like you want
record-deployment
on provider for sure and
record-release
on consumer side if the consumers are indefinitely supported πŸ™‚
t
right, i guess the issue I’m actually having is i added a
contract_requiring_verification_published
webhook and when it kicks off the provider side verification, its verifying against versions I don’t need to due to not doing
record-support-ended
on previous provider releases to prod
ah yeah ok great, thats what i was thinking, if i can leave
record-release
on consumer side which we have already and then change to
record-deployment
on provider side that might work
y
contract_requiring_verification_published webhook should trigger once for each build (head of main branch) and any deployed or released versions. and provide a seperate SHA for the provider to checkout, and the pact url that has changed. you can add into the webhook template, the provider version number, so when the webhook is kicked off, you have the data of the version number, but can i deploy consumer into env, will list back the version number of the provider that is recorded in prod (as a release) If you want a way to cross over, once you find out the version number of the current prod that was marked as released, you can mark that application version as deployed. unrecord the release, and then you are happy to move on forward.
t
If you want a way to cross over, once you find out the version number of the current prod that was marked as released, you can mark that application version as deployed.
unrecord the release, and then you are happy to move on forward.
sorry im a bit confused, i still need to record the provider version in prod as a release, and then mark it as deployed? i cant just do
record-deployment
in prod for provider release?
y
I would need to test it out, but I don't believe. 1. recording a deployment, will do anything to the released version
so if you do record-deployment you will have a released version as well. (which I assume you want to unrecord) but you don't want to do it before you have a provider version
deployed
to production, You can test it out easily with a fresh pact broker on your local machine you get yourself in the same state πŸ‘
t
i guess im wondering why i need a release too then, cant i just simply only do
record-deployment
for prod provider?
y
Only because you said you have already recorded a release for the provider but you don't know the version number
t
i know the current version, just not the previous
y
if you have never marked a provider version as deployed or released, then there is no issue, or nothing to test. What is your current state on both sides exactly
t
as when we
record-release
we would want to stop supporting previous
earlier i manually unsupported older releases when cleaning things up
y
record-deployment will undeploy deployed versions only, not released versions is my assumption
t
ooh i see so id need to move current recorded release to recorded deployment
but then going forwards, simply
record-deployment
should suffice ?
y
yes if you only have one current recorded release for the provider. to get parity now, I would record-deployment of provider, with the current released application version. then you can unrecord-release and just stick with record-deployment on the provider side, to support only 1 live application version in an environment
t
thank you so much that makes sense now πŸ˜„
πŸ™ 1
y
consumer side will want every version that goes into an environment marking with record-release. πŸ‘ sounds good matey! Good luck. You should test out my assumptions before you proceed if you want to be doubley sure. Quick broker you can spin up here to test πŸ™‚ https://github.com/pact-foundation/pact-broker-docker/blob/master/docker-compose.yml
πŸ‘ 1