Support Publishing Results Using URI Sources
See original GitHub issueExisting State
Currently, PactNet only supports publishing verification results using the Broker source, like this:
string version = Environment.GetEnvironmentVariable("GIT_SHA");
string branch = Environment.GetEnvironmentVariable("GIT_BRANCH");
string username = Environment.GetEnvironmentVariable("BROKER_USERNAME");
string password = Environment.GetEnvironmentVariable("BROKER_PASSWORD");
verifier.ServiceProvider("My API", this.fixture.ServerUri)
.WithPactBrokerSource(new Uri("https://broker.example.org"), options =>
{
options.EnablePending()
.ConsumerVersionSelectors(new ConsumerVersionSelector { MainBranch = true })
.PublishResults(version, publish => publish.ProviderBranch(branch)); // 👈 enable publishing results
})
.Verify();
Proposed API
It should be possible to publish verification results to a Pact Broker when using a URI source, as recommended in some of the Pact CI/CD setup guides. In these flows, a verifier is triggered from a webhook with the URI of the pact that has changed (instead of all pacts). The verifier should then pull the pact from this URI, verify just this one pact, then publish results back to the broker.
The API would be something like:
Uri uri = new Uri(Environment.GetEnvironmentVariable("PACT_URI")); // 👈 from the webhook
verifier.ServiceProvider("My API", this.fixture.ServerUri)
.WithUriSource(uri, options =>
{
options.BasicAuthentication(username, password)
.PublishResults(version, publish => publish.ProviderBranch(branch)); // 👈 new
})
.Verify();
Open Questions
- How is the broker URI discovered?
- Is it inferred from the webhook URI itself?
- Is that even safe?
- What if you retrieve the pact from any old URI and then try to publish results as if it’s a broker?
- Should we force people to provide the broker URI instead? That seems the safest solution
- Answer: The pact file itself will contain a link to publish verification results if it was retrieved from a Pact Broker. Thus, if the link is missing then the publish option shouldn’t do anything, and if it is present then publshing can be safely achieved.
- What support is available in the FFI for this?
- Answer: None currently. See the tracking issue: https://github.com/pact-foundation/pact-reference/issues/199
- Should other types of sources be supported as well? e.g. could a CI job put the pact file somewhere, then a file source verifies it and publishes the verification results?
- Answer: No, at least not for now
Issue Analytics
- State:
- Created a year ago
- Comments:14 (10 by maintainers)
Top Results From Across the Web
Frequently Asked Questions - URI Open Access Fund
No. Authors are free to publish wherever they want. Their choice is only restricted if they wish to apply for funding from the...
Read more >Best Practices for Publishing Linked Data
STEP #5 GOOD URIs FOR LINKED DATA: The core of Linked Data is a well-considered URI naming strategy and implementation plan, based on...
Read more >Frequently Asked Questions - URI Open Access Policy
In practice, you have given the University permission to reproduce, display, and distribute your articles as long as the articles are not sold, ......
Read more >Government Publications – University Libraries
Most government publications and web resources are available through the URI Libraries Search platform. Many research guides to finding government publications ...
Read more >Wiley's Data Sharing Policies
“[Journal] encourages authors to share the data and other artefacts supporting the results in the paper by archiving it in an appropriate public...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s in 4.1.0
Added in c44c919