Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add option to publish verification result to pact broker #53

Closed

Conversation

AndreKlang
Copy link

Sorry for not opening an issue with discussion first, the company I work for needed to know if this was a viable option so we decided to spend an afternoon on it before exploring other avenues.

This is basically the bare minimum to be able to publish the results to the pact broker according to: https://docs.pact.io/pact_broker/advanced_topics/api_docs/publish_verification_result

I'm open to implement any changes you see fit.

@YOU54F
Copy link
Member

YOU54F commented May 7, 2024

That's okay!

Very cool. How has it been going for you in your POC?

Would you be happy to expand on your use case a little bit? I'm always curious :)

@mefellows
Copy link
Contributor

One thing I should also mention, is that the broker fetching options currently in this project are the old way (via tags) which we don't recommend. If you want to go this route, I'd also suggest updating the process to fetch by consumer version selectors. This would allow the richer selection options for things like branches and environments - the recommended way to publish pacts.

I'm open to this PR though and would love to get your feedback on how you use it also.

@AndreKlang
Copy link
Author

Well the POC went quite well, we're currently using this in our pipelines.

The reasoning why we want this is quite simple, given a few things:

  • The openapi-spec are generated from the implementation, so we know it is correct.
  • Each service are responsible for testing it's own functionality, and mock other services as pact providers.
  • Services only interact with each other via clients generated from the openapi-specs.

So the only thing we really need is to verify that the new version of provider satisfies all current versions of consumers. And using swagger-mock-validator satisfies this, and it's basically a one-liner in the pipeline, which removes the need to implement any provider tests manually.

Regarding the "old broker fetching", that's probably something we'll have to look into, I didn't personally set that up in our case so I'm not really sure about the implications there..

@mefellows
Copy link
Contributor

Thanks for sharing! Moving away from tags has a number of benefits, as linked. Another benefit is that tags are not as performant.

Are you using can-i-deploy as well?

@AndreKlang
Copy link
Author

I've looked into the version-selectors a little bit, it looks pretty simple to implement support for it if we find that we need to. So it is possible that there'll be a PR for that as well in the future (no promises though 😄)

We're not yet, but that is absolutely a goal. We're sort of pre-production still, and setting up piece by piece in our infrastructure.

@YOU54F
Copy link
Member

YOU54F commented Oct 8, 2024

Merged as part of

#66

Thanks for the change 👍🏾

@YOU54F YOU54F closed this Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants