ITV/scala-pact

Is it possible to publish pacts to broker with tag(s)?

Closed this issue · 2 comments

Here comes another question from me.
Couldn't find it in the documentation but i was wondering if is there was a way to publish pacts with tags?
I want to tag my published pacts with my branch name. (Also recommended by pact-foundation wiki: https://github.com/pact-foundation/pact_broker/wiki/Set-up-checklist#consumer-team)

Is there a way to do this with scala-pact or would i need to create some script?

Doesn't seem like this is possible right now, would you like me to submit a pull request?

I could see it being implemented like this:

Publishing:

Publishing could be done doing a PUT /pacticipants/<consumer>/versions/<pact_version>/tags/<tagname> for every tag before publishing the pact itself here (This is how pact-broker cli does it).

Verification:

Adding a pactBrokerWithTags class which is simply a copy of pactBroker with pactTags: List[String]:

and also add a similar field to PactVerifySettings:
case class PactVerifySettings(providerStates: SetupProviderState,

This would be handled in Verifier around here, by making a copy of each unversioned consumer with version /latest/<tag> for each tag. (If tags is not empty)
pactVerifySettings.consumerNames.map(c => VersionedConsumer(c, "/latest")) ++

Feedback is appreciated. I'm no expert so i might be doing something stupid :)

@davesmith00000 I figured this was so small I just went ahead and did it.
The PR is here: #111, feedback is appreciated :)