Ruth
05/30/2024, 9:32 AMtasks {
withType(Test::class) {
useJUnitPlatform()
systemProperty("pact_do_not_track", true)
systemProperty("pactbroker.url", System.getenv()["PACTFLOW_URL"] ?: findProperty("pactflow.broker.url") as String)
systemProperty("pactbroker.auth.token", System.getenv()["PACTFLOW_TOKEN_READWRITE"] ?: findProperty("pactflow.broker.token") as String)
systemProperty("pact.verifier.publishResults", System.getenv()["PACTFLOW_VERIFIER_PUBLISH_RESULTS"] ?: findProperty("pact.verifier.publishResults") as String)
systemProperty("pact.provider.version", project.version)
}
named("pactPublish").configure {
dependsOn(check)
}
named("publish").configure {
dependsOn("pactPublish")
}
}
pact {
broker {
pactBrokerUrl = System.getenv()["PACTFLOW_URL"] ?: findProperty("pactflow.broker.url") as String
pactBrokerToken = System.getenv()["PACTFLOW_TOKEN_READWRITE"] ?: findProperty("pactflow.broker.token") as String
}
publish {
// pactDirectory = '/pact/dir' // defaults to $buildDir/pacts
}
}
We use pactPublish also in feature branches:
./gradlew clean pactPublish -Dpact.publish.consumer.version=${{ github.sha }} -D=pact.publish.consumer.branchName=${{ github.head_ref }} --no-daemon --info --stacktrace
To then verify new pacts we currently just run the normal build of the provider with pact.verifier.publishResults=true
We now ran into the problem several times that the feature branch published a pact which never got verified.
We think it is because between publish and verify the main branch also published a pact, which the provider then verifies.
I looked a bit into it and we found something like a selector where you can put your feature branches in the configuration, but we would just like to verify ALL pact version from all the branches we have in the system.
any idea how we can configure our build so it asks the broker for more pacts?Matt (pactflow.io / pact-js / pact-go)
Slackbot
05/30/2024, 11:12 AM