Closed jasondamour closed 1 year ago
@rholshausen I tried this again, it doesn't seem to be working. Here is the full command our CI server is running:
./gradlew --info --stacktrace --console=auto --no-daemon
pactVerify
-Ppact.verifier.publishResults=true
-Dpact.verifier.buildUrl=https://gitlab.[masked]/-/pipelines/626854602
-Dpact.provider.branch=[masked]
pactTests
pactPublish
-Dpact.publish.consumer.buildUrl=https://gitlab.[masked]/-/pipelines/626854602
-Dpact.publish.consumer.branchName=[masked]
-Dpact.publish.consumer.version=c3982fce0f665f4116ef9ab788efb720ea302b88
And here is the error:
> Task :pactPublish FAILED
Publishing 'CONSUMER-PROVIDER.json' ...
FAILED! 409 Conflict -
{"error":"Cannot change the content of the pact for CONSUMER version
0.0.1-SNAPSHOT and provider PROVIDER, as race conditions will cause unreliable
results for can-i-deploy. Each pact must be published with a unique consumer version
number. For more information see https://docs.pact.io/go/versioning"}
FAILURE: Build failed with an exception.
It seems to take the version from gradle.properties regardless of system property
What version of Pact-JVM Gradle plugin are you using?
Actually, looks like a bug. If the consumerVersion
property is not set, it will set it to the version from the build, and then won't get the value from the system property because it is set to the version from the build.
You can work around this by setting the consumerVersion
property in the publish block in your gradle build. I.e. something like
pact {
publish {
consumerVersion = System.getProperty('pact.publish.consumer.version')
}
}
Thanks @rholshausen for looking into this.
Hello,
Maybe I am misunderstanding something. In the pact foundation docs, one of the recommendations is to version the published pacts from the consumer with unique versions (https://docs.pact.io/getting_started/versioning_in_the_pact_broker#rules).
However, the gradle plugin does not have any documented support for setting consumer version via CLI, like project or system property. So how can I pass git commit info into the plugin.
I cannot add the git info plugin to my projects.
Thank you.