Skip to main content

Pact Open Source Update — July 2023

· 12 min read

👋 Hello, its July, it's scorching so I hope you've got an ice cream to accompany you this episode or maybe a brolly if you are stuck in a rain-shower!

For the keener of our readers, you may note we missed our June episode. I was on holiday ( a rare treat! ) which was spent mainly away from the keyboard, with the exception of a little flurry in pact-python.

Never fear, a double-dose of Pact Open Source updates are here!

OSS Updates

It has been a busy two months in the world of Pact, read on for updates on

  • Pact Docs
  • Pact Reference
  • Pact Net
  • Pact Go
  • Pact JS
  • Jest Pact
  • NestJS Pact
  • Pact Broker
  • Pact Python
  • Pact PHP
  • Pact in the community

Pact Docs

The path to Pact Nirvana guide is now updated to cover

  • Branches
  • Recording Deployments
  • can-i-deploy --to-environment
  • contract_requiring_verification_published webhook
  • New diagrams courtesy of MermaidJS

Want to see can-i-merge functionality incorporated into the broker? Vote on this feature request

Pact-Reference

A raft of bug-fixes and features have been applied across the pact-reference project.

Features

Fixes

Latest Releases

Pact-Net

The PactNet 5.0 RFC is complete with PactNet 5.0.0.beta.1 now released.

This bring in the ability to generate V4 Specification Pact's using the same API as V3 sync and async pacts and utilise combined pact files for both http and message based interactions. This removes the limitation requiring services which comprise of both http and message-based interactions to be named differently.

See the migration guide for upgrading to PactNet 5.x

Pact-Go

Pact-Go V2 has officially been released, following an extended beta period. We are very grateful to our many early users who provided invaluable feedback.

You can check out the full release notes here

and for those migrating from v1, you can check out the migration guide here

This update replaces the pact-ruby core, with the pact-rust core, utilized through the pact_ffi library, bringing support for V3 and V4 Pact specifications and the ability to load pact-plugins to extend the capabilities of pact-go.

  • Supported platforms.
    • Linux x86_64 / arm64
    • MacOS x86_64 / arm64
    • Windows x86_64

Please note that Alpine Linux is not supported at this time.

New Features

Pact-JS

JavaScripters/TypeScripters/Nodemads

We listened to our community, who struggled with requiring python to install pact-js in order to get at that lovely rust pact-core functionality in pact-js v10 & v11 and pact-js-core v13

You can now find they both come fully charged with batteries included, meaning that supported platforms can use pact js v12 and pact-js-core v14 with --ignore-scripts true and no additional install time build requirements

In addition, the new releases now support versions of Node 16 and greater, CI testing has been dropped for earlier versions, and we explicitly set the engines value in the package.json of both pact-js and pact-js-core to honour this restriction. We would advise updating your projects to an in support LTS version, (Node 18 LTS is probably most sensible at this point and node 16 is due to EOL on 11th Sept 2023)

New Features

  • Support for eachKey and eachValue matchers has been added to pact-js via pull #1303 which closes issue #952

Jest-Pact

Updated to reference peer-dep of pact-js 12.x

NestJs-Pact

Updated to reference peer-dep of pact-js 11.x and nest-js 10.x

Pact-Broker

Pagination support was added via pull #622

You can find the current documentation and supported endpoints here

A few performance enhancements were made at the same time.

Pact-Python

Pact-Python 2.0.0 has been released

  • What does it contain?
    • ARM64 for both Linux & MacOS is now natively supported by Pact Python
    • Linux Support for x86 platforms (32-bit) has been dropped
    • The ruby standalone now runs the latest ruby 3.2.2 (big bump - from a deprecated Ruby 2.4)
    • Plus a few other fixes and enhancements from the community and maintainers.
  • Release notes
  • PyPi Release

Whats next for Pact-Python?

Pact-PHP

Pact-PHP 9.0.0 has been released

  • What does it contain?
    • ARM64 for both Linux & MacOS is now natively supported by Pact PHP
    • Linux Support for x86 platforms (32-bit) has been dropped
    • The ruby standalone now runs the latest ruby 3.2.2 (big bump from a deprecated Ruby 2.4)
    • Plus a few other fixes and enhancements from the community and maintainers.
    • The CI Pipeline has dependabot hooked up, to ensure our dependencies stay up to date
    • Release documentation has been added to aid future maintainers
    • Support for PHP 7.4 has been dropped. You should be on 8 by now though, surely
  • Release Notes
  • Packagist Release

Whats next for Pact-PHP?

Oh Hi FFI :blobwave:

#326 Support for V3 / V4 + Plugins Via FFI

What is the current status

Pact-PHP does not currently support v3+ features of the rust core, in the mainline branch.

V3+ features are now available for beta testing in ffi branch, in a view to stabilise and release into the mainline.

We would <3 your support

How can I test this today

Anyone can start testing pact-php with pact_ffi code by updating their composer.json

"pact-foundation/pact-php": "dev-ffi as 10.0.0"

How can I submit feedback

All feedback is gratefully received, positive feedback is great, as it allows us to ascertain how well the package is doing for users. Constructive criticism is okay too, but see the next section

  • Reply in this issue
  • Raise a new issue, clearly stating you are using the ffi branch

How can I contribute

If you want to help improve Pact-PHP, read the DEVELOPING.md documentation, fork the repo and have a play!

Pact in the community

Pact-graph-network

We mentioned Guillaume Camus's pact-graph-network tool back in December. It's just been updated to support multiple target architectures, and now supports authentication mechanisms whether you have a basic auth protected Pact Broker, or a Bearer token protected PactFlow Broker.

So what are waiting for? Go forth and generate some broker charts, and why not share us your graphs via https://twitter.com/@pact_up or pact-slack.

Hello Jo

I imagine you've heard of Cucumber, the testing tool, not the veggie, If not, Cucumber is a tool for running automated acceptance tests guided by a technique called BDD (Behaviour-Driven Development), written in plain language called Gherkin. It has strong overlaps with our principles of contract testing and the Pact DSL, and is often part of a development teams tool-set alongside Pact for developing robust, quality systems. The similarities don't end there, it also has a thriving community which has been spearheaded by Jo Laing, across Slack and in many events across the globe.

That leads us nicely into what has Jo been up to this week!

Jo volunteered at AgileConf Scotland, where she was tasked with speaker support duties for a workshop.

A principles-based approach to create test automation strategies that work at scale, hosted by none other than Antonello Caboni (a Pact community speaker) & Nicola Sedgwick (a former CukenFest speaker). It's a smöl ol' world.

The penny dropped as slides for contact testing appeared and Jo had to declare her new role in the Pact community.

jo_anton_agilescotland


So that leads me to announce to you, that I have the pleasure of inviting her to join me in my role as community shepherd, and know she will be helping to bring some organisation to the fold, including things like maintainer sessions and training, she has worked on the Cucumber school which is an incredible free resource to help those learn about BDD, I would ❤️ a Pact School - if such a thing would float users boats.

Community Corner - Olivier Picaud

Autonomy within development teams is really valuable, tied with standardisation and goverance in an organisation, it can empower your teams. However it isn't all roses, it can also lead to fragmented tooling across the landscape, especially when developing microservice-based architectures in the dream of multiple protocols and languages all working in harmony. The landscape is always moving quickly but we are going to shine the spotlight on how open-source, both in terms of its tools, its users and contributors are helping to push things forward.

gRPC makes it easier to build high-performance microservices by providing generated service entrypoints in a variety of different languages. Bazel complements these efforts with a capable and fast polyglot build environment. Pact now offers the ability to test gRPC services via its extensible plugin mechanism, and it complements both gRPC and Bazel well, affording engineers the confidence to build applications in a stable repeatable manner, all whilst gaining that rich feedback from contract-testing.

We caught up with Olivier Picaud, who felt the draw, and utilised the power of open-source not only to power his journey of learning, but to share his progress, so that others can follow along. You can find his pull request showcasing his work here

Olivier Picaud

To learn monorepos, i put in place some grpc microservices using pact to validate interactions. Also, to facilitate the monorepo building, i am using Bazel and so i "bazelify" protobuf-plugin and pact-reference to get a >pact_verifier_cli and protobuf-plugin compiled from source --> Today, local consumer/provider testing is working well.

From Docker (and then from Kubernetes) i am trying to use the image you provide https://hub.docker.com/r/you54f/pact_verifier_cli, with the addition of protobuf-plugin from Bazel :) (still currently in dev)

EDIT1: Docker is not used anymore, it has been replaced by OCI images

EDIT2: Tests are not running from Docker images anymore, but directly from the build via pact_verifier_cli and pact-protobuf-plugins. To ensure a deterministic build, pact_verifier_cli and pact-protobuf-plugin are compiled "just in time" during build process (or use cache if already built).

EDIT3: Idea for the community : providing a "rules_pact" Bazel rule --> to use directly Pact from Bazel projects with pact_verifier_cli and other Pact tools as embedded toolchains ?

See here:

What I learned and still learning is :

  • improving cohesion of teams by pulling them in a monorepo structure
  • improving local development and determinism by providing one tool and the necessary toolchains for different platforms coming with the monorepo --> pact-reference and pact-protobuf-plugin was "bazelifed" for this purpose
  • optimizing test strategy (and notably with pact-grpc) to provide enough confidence to just run health checks when products are deployed. providing an unique pipeline to build / test / release and deploy using gitops magic monorepo's components in less than 10 minutes to accelerate feedback (incremental builds are amazed for this purpose)
  • I am currently migrating to bazel 6.0 because they use a new way of dealing with dependencies and then i will need to realign my fork to your master to pull out few updates that you made guys :) and then continuing to provide an end-to-end flow (i do not have an cli for instance to "play" with the entire product)

It's also very nice to participate to the community, i've participate to few others bazel-project by testing PR, providing feedback and red tests :)

Thanks Olivier for taking the time to share with us. It's exciting to hear about pull requests dropping in other areas outside of Pact as part of this effort. I hope this empowers others to take on journeys of discovery through code, through collaboration, as that is how our open source ecosystem is enriched.

Are you using Bazel in your organisation? Are you building tooling on top of pact-reference? Why not let us know! We could bring it into the codebase as part of an external builds directory as suggested by Ron so don't by shy!

Pactober

Celebrating Pact's 10 Year Milestone

2023 marks 10 years of Pact Open Source. To celebrate, during the month of October – which we’ve coined Pactober – we’re facilitating community events across the globe to celebrate and acknowledge the journey and look forward to the future of Pact.

Be sure to bookmark our Pactober event page where you can register to keep up to date, or to join us in hosting an event. We want to bring you all in to the celebrations, and help bring more contributors to the Pact family and help it live for another 10 years and beyond

Thats a wrap

That’s it for this month. Stay safe and carry on coding!

  • Yousaf Nabi — Developer Advocate at PactFlow and Community Shepherd at Pact.