Hi everyone, I'm working on adding pact to a CI/C...
# pact-broker
s
Hi everyone, I'm working on adding pact to a CI/CD pipeline that has
semantic-release
usage. Consumer pipeline steps: • yarn lint • yarn test • npx semantic-release (this step increments version and commits changes to package.json) • pact-broker publish (publish pacts with the actual version of the consumer from package.json) • pact-broker can-i-deploy Provider pipeline steps: • yarn lint • yarn test (runs unit tests, no pact verifications) • yarn test-integration (runs integration tests, no pact verification) • npx semantic-release (this step increments the version and commits changes to package.json) • yarn pact:verify (runs pact verification and publishes verification results to broker) • pact-broker can-i-deploy With the consumer pipeline, all seems fine because all tests are performed before the
semantic-release
invocation (as the official guide suggests). However, with the provider pipeline, I have to invoke the pact verification only after the
semantic-release
invocation to have the correct version assigned to verification results published to the broker. This bugs me because technically there might be a new version of the application that doesn't pass
pact:verify
command (in other words - it breaks the consumer). Ideally, I would like to increment versions only for stable application versions (even for dev builds like
1.2.3-dev.3
). There is an obvious workaround for this - invoke
pact:verify
with
publishVerificationResult=false
before
semantic-release
step, and then invoke with
publishVerificationResult=true
. But the disadvantage is also obvious - the step is executed twice in the pipeline which adds up to total time. Am I doing something wrong here? Are there any best practices available regarding the usage of pact together with
semantic-release
?