pact-foundation / pact-js

JS version of Pact. Pact is a contract testing framework for HTTP APIs and non-HTTP asynchronous messaging systems.
https://pact.io
Other
1.59k stars 343 forks source link

build: Improve logging in install-plugins script #1034

Closed TimothyJones closed 1 year ago

TimothyJones commented 1 year ago

This PR:

It exposes the problem with install-plugins, which is that it is being rate limited by github. You could fiddle about with a token to fix this, but probably it would be better to do one of:

TimothyJones commented 1 year ago

I've also got a branch that pushes the GITHUB_TOKEN down to that curl script. You can find it here:

https://github.com/TimothyJones/pact-js/tree/use-token-in-install-plugins

the relevant commit is https://github.com/TimothyJones/pact-js/commit/7654bc50e43ffc8a7fc0038b1ea844e7aab937b8

I didn't include it in this PR because it seems unnecessary to pass the token around just to download a dependency. But it appears to fix this brittle build problem.

YOU54F commented 1 year ago

Thanks for this Tim

I think pinning the version would be nice, we could have a json file that stores the name of the plugin and the version.

On release of a new plugin, it could trigger a script to update the json metadata triggering a build.

Would allow for us to create and test beta versions of particular plugins easily, e2e

YOU54F commented 1 year ago

I'm tempted to hard-code/pin the tag for now to 0.0.4 for the time being, so we can yak shave through the rest of these PR's, no-one likes a flaky build!

mefellows commented 1 year ago

Thanks Tim!

Replace the API call with https://github.com/marketplace/actions/github-api-request

That's a good idea, I wasn't aware of that!

Remove the need for a plugin cli step entirely by using a package manager (imo, best)

We created initial support for Plugins this way which gives us a lot of flexibility as we evolve. This (native language packaging) would possibly be the best developer experience, but it would then mean every plugin author has to distribute via npm, rubygems, Maven, Nuget etc. etc.

There's nothing stopping us, say, creating a plugin config file or extending package.json with defined plugins, and having the framework discover and download them. We looked at several plugin models at the time, and decided this was a good starting point. As we collect feedback from the community we can adjust and improve (or pivot, as the case may be) our approach.

mefellows commented 1 year ago

I'll merge, and then pin for now. We can improve the solution as the need arises.