Good afternoon. This is Chandra. I am working on a...
# pact-broker
c
Good afternoon. This is Chandra. I am working on a POC to implement the http based pact tests using pactnet 4.x. I am using Teamcity for CI pipelines and pactflow pact broker (trial version) to implement 'Contract published that requires verification' webhook event. The webhook event is getting fired when a changed contract file is published and in turn triggering the provider build on Teamcity. I want to pass the '${pactbroker.pactUrl}' in pactflow pact broker to provider build pipeline on Teamcity. As we need this in provider verification tests to verify the specific changed contract file and publish the results back to pact broker. Can someone please help me with this ? Screenshots for the webhook event and the provider builds:
👋 1
Not sure if I need to post this question in #CLS16AVEE or #C9UTHV2AD channel
I am following the steps Yousaf Nabi has prepared for pact CICD workshop for pactnet. I could not understand how pactUrl variable has '${pactbroker.pactUrl}' value. Below are the screenshots I am trying to understand.
m
hello!
You’ll need to add
${pactbroker.pactUrl}
to the body of the webhook. This will make the value available to teamcity when the build triggers. You then need to extract that value out of the payload from Team city (it looks like you’ve copied this already: https://docs.pact.io/pact_broker/webhooks/template_library#teamcity---trigger-build). So my guess is that
env.<blah>
will generate environment variables for team city. So, something like this should do it:
Copy code
{
  "name": "env.pactUrl",
  "value": "${pactbroker.pactUrl}"
}
And then from your .NET code, it won’t be
PACT_URL
it will be
pactUrl
if you want fully uppercase, I’d update the
name
properties to suit
e.g.
Copy code
{
  "name": "env.PACT_URL",
  "value": "${pactbroker.pactUrl}"
}
Not sure if I need to post this question in #CLS16AVEE or #C9UTHV2AD channel (edited)
it’s a tricky question - it cuts all of these channels. Here is fine, I think
c
Thanks Matt, will give it a try and update the outcome.
👍 1
Quick question, how to extract the value out of the payload from Team city ? I am from QA background (not good with the technology 😊)
m
As per above, each property passed through in the body will appear as an environment variable to the teamcity build - nothing to do in teamcity, you just need to map the env vars here to the verification code in Pact .NET
c
okay 👍 thanks Matt. Appreciate it.
👍 1
Thanks Matt, it works fine if I create a parameter (env variable) in teamcity with empty value..