[Webhooks for Jenkins] Hi folks, I am trying to ...
# pact-broker
j
[Webhooks for Jenkins] Hi folks, I am trying to set up a Pactflow webhook to trigger a Jenkins job. I have filled the webhook data as instructed here: https://docs.pact.io/pact_broker/webhooks/template_library#jenkins---trigger-build (first image) But it's not clear how to call Pactflow with this input. Should I use a pact-broker command (from the Ruby standalone binary), an API at my Pactflow instance, or...?
j
Awesome, thanks Yousaf.
@Yousaf Nabi (pactflow.io), I am receiving a 401 from Pactflow. I am passing on the Authorization head my personal token taken from Pactflow. I didn't quite understand the different between URL and BROKER_BASE_URL. In my script, I am passing my Pactflow URL on both arguments. Is this correct? https://docs.pact.io/pact_broker/client_cli/readme#webhooks pact-broker create-webhook URL -X, --request=METHOD -b, --broker-base-url=BROKER_BASE_URL On the first image, I have my pact-broker call. The second shows the error. The third from where I am getting the Bearer token. The fourth I have the file for the --data argument, as instructed here: https://docs.pact.io/pact_broker/webhooks/template_library#jenkins---trigger-build
y
url should be the webhook target, not the broker base url. your data has too many params, alot of those values are set by the cli tool, check the makefile example. also there isnt any point in registering both event types. contract requiring veri published is sufficient are you passing your token in the command or have it set in your shell re the 401?
j
"webhook target," meaning my Jenkins job? So I place it on the pact-broker call itself (first image) and remove from the --data file (second image)?
"check the makefile example." The makefile --data (first image) has only the event_type field that matching the webhook template for Jenkins (second image), that's why I am unsure what to keep from the template https://docs.pact.io/pact_broker/webhooks/template_library#jenkins---trigger-build
"are you passing your token in the command or have it set in your shell re the 401?" Passing the Pactflow token directly on the script, on the red area
y
that is the header to send in the webhook request, you need the following to connect to your broker
Copy code
-k, [--broker-token=BROKER_TOKEN]
              # Pact Broker bearer token
what does your payload look like that does work for jenkins (via curl)?