Hi, how do we tag a contract with the PR branch fr...
# pact-jvm
f
Hi, how do we tag a contract with the PR branch from the mvn command when publishing it? Can’t find the right syntax for that. Not sure if something like this?
Copy code
./mvnw -Dpactbroker.auth.token=${pactBrokerToken} pact:publish -Dpact.consumer.version=Aversion -Dpactbroker.tags=ATag
u
Use
pact.consumer.tags
f
Copy code
sh "PACT_CONSUMER=$consumer BROKER_TOKEN=$pactBrokerToken yarn publish:pact:flow --consumer-app-version=`git rev-parse HEAD` --tag=master"
This is what we have for our javascript contract.
Okay, so
-Dpact.consumer.tags="myTag"
?
💯 1
Or do we need
{}
u
Use
pact.publish.consumer.version
to set the version, and
pact.consumer.tags
to set any tags
👍 1
f
Cool, let me try that.
Thank you
It worked for the tagging but I’m a bit unsure about the versioning.
message has been deleted
It’s showing here 3.1.3
But the value I tried to add was the hardcoded one
Copy code
./mvnw -Dpactbroker.auth.token=myToken pact:publish -Dpact.consumer.version=Aversion -Dpact.consumer.tags=ATag
Ah, sorry, I think I’m missing a word here, right?
Copy code
./mvnw -Dpactbroker.auth.token=myToken pact:publish -Dpact.publish.consumer.version=Aversion -Dpact.consumer.tags=ATag
Should it be like this instead?
Doesn’t seem to be it..
And we need the branch as well
f
Cool, but my command seems correct for the version parameter
But it’s still not there
Instead, it’s showing the old 3.1.3 value
u
Does it have the same Pact file?
f
Yes
Do I need to delete it and republish it?
No, I deleted the whole integration and tried again but still came up with the 3.1.3 value and no branch info.
Copy code
./mvnw -Dpactbroker.auth.token=myToken pact:publish -Dpact.publish.consumer.version=Aversion -Dpact.consumer.tags=ATag -Dpact.publish.consumer.branch=Abranch
u
What version are you using?
f
for pact?
u
Yes, that requires min versions 4.1.33/4.2.19/4.3.4
👍 1
f
Let me check it here.
Copy code
<pact.version>4.3.2</pact.version>
<pact.plugin.version>4.0.10</pact.plugin.version>
u
4.0.10
is too old
👍 1
f
Cool, I’ll find a newer one.
4.1.28 fine?
Nah, maven is complaining that doesn’t exist
u
Why not
4.3.17
?
That is the latest 4.3.x version
👍 1
f
Yes, I was looking for this but couldn’t find it.
I’ll try now.
Thank you.
Maven is not finding it
Copy code
<plugin>
                <groupId>au.com.dius</groupId>
                <artifactId>pact-jvm-provider-maven</artifactId>
                <version>4.3.17</version>
                <configuration>
                    <pactDirectory>target/pacts</pactDirectory>
                    <pactBrokerUrl><https://my.pactflow.io></pactBrokerUrl>
                    <!--suppress UnresolvedMavenProperty -->
                    <pactBrokerToken>${pactbroker.auth.token}</pactBrokerToken>
                    <projectVersion>${project.version}</projectVersion>
                    <trimSnapshot>true</trimSnapshot>
                </configuration>
            </plugin>
u
Copy code
<groupId>au.com.dius.pact.provider</groupId>
  <artifactId>maven</artifactId>
  <version>4.3.17</version>
👍 1
f
Unfortunately, this version didn’t even publish the contract.
😞
weird..
I get an ok on the terminal
but the contract is not there.
u
You'll need to provide debug logs.
f
how do I do that?
owh, no
wait, it’s here
maybe there was a bit of delaying, but I see it here now
All good, it seems
both version and branch name are here.
🙌 1
Thanks so, so much!!
👍 1
I’m just investigating now as the branch name got published with the tag instead.
Let me check a bit.
u
The broker does that, sets the branch to the tag if the branch is not set
f
But I’m setting it though?
./mvnw -Dpactbroker.auth.token=myToken pact:publish -Dpact.publish.consumer.version=Aversion -Dpact.consumer.tags=ATag -Dpact.publish.consumer.branch=Abranch
u
Try remove the tag
👍 1
f
None of them appear now
I mean, no branch and no tag info
I’ll need to step away for 1h30 to leave for the office, but I can get back here as soon as I’m with the computer again.
I’m a bit short on time as this is actually my last day with the company, so really prioritising getting this done so I can hand it over back to team in working condition.