Hey, are there any known issues with the webhook h...
# pact-broker
j
Hey, are there any known issues with the webhook hitting jenkins? My webhook is triggering my jenkins job, but the values I have in the "body" are not populating the parameters in my job. I'm not sure what I'm doing wrong
Copy code
[2022-07-29T17:36:59Z] DEBUG: Webhook context {"base_url":"<http://pact-broker-url.com>","consumer_version_branch":null,"build_url":null,"consumer_version_tags":[],"event_name":"contract_requiring_verification_published","provider_version_number":"9d89cb0","provider_version_branch":null,"provider_version_descriptions":["deployed in master"]}
[2022-07-29T17:36:59Z] INFO: HTTP/1.1 POST <http://jenkins-base-url.com/job/pact_verify_provider/buildWithParameters>
[2022-07-29T17:36:59Z] INFO: accept: */*
[2022-07-29T17:36:59Z] INFO: user-agent: Pact Broker v2.98.0
[2022-07-29T17:36:59Z] INFO: content-type: application/json
[2022-07-29T17:36:59Z] INFO: authorization: **********
[2022-07-29T17:36:59Z] INFO: host: <http://jenkins-base-url.com|jenkins-base-url.com>
[2022-07-29T17:36:59Z] INFO: content-length: 251
[2022-07-29T17:36:59Z] INFO: {"project":"rating-service","version":"9d89cb0","pactfile_url":"<http://pact-broker-url.com/pacts/provider/rating-service/consumer/rating-gateway/pact-version/2b4d7a5857da9e1f41ff3c5c259086e63f608663/metadata/Y3ZuPTk3MDUxMjUmdz10cnVl>"}
[2022-07-29T17:36:59Z] INFO: HTTP/1.1 201 Created
[2022-07-29T17:36:59Z] INFO: date: Fri, 29 Jul 2022 17:36:59 GMT
[2022-07-29T17:36:59Z] INFO: content-length: 0
[2022-07-29T17:36:59Z] INFO: connection: keep-alive
[2022-07-29T17:36:59Z] INFO: x-content-type-options: nosniff
[2022-07-29T17:36:59Z] INFO: location: <http://jenkins-base-url.com/queue/item/9154391/>
[2022-07-29T17:36:59Z] INFO: server: Jetty(9.4.27.v20200227)
[2022-07-29T17:36:59Z] INFO: 
[2022-07-29T17:36:59Z] INFO: Successfully executed webhook
message has been deleted
I'm trying to compare to this template for triggering a jenkins job with parameters, but this example doesn't look like it actually has any parameters? 😬 https://docs.pact.io/pact_broker/webhooks/template_library#jenkins---trigger-build
m
Can you do it with just query string params? The other examples have e.g.
"url": "https://<DRONE_HOST>/api/repos/<NAMESPACE>/<REPO_NAME>/builds?branch=${pactbroker.providerVersionBranch}&commit=${pactbroker.providerVersionNumber}&PACT_URL=${pactbroker.pactUrl}"
So can just add on following the
buildWithParameters?os_authType=basic
b
These API docs indicate that the body is a form post, not a JSON post https://www.jenkins.io/doc/book/using/remote-access-api/#RemoteaccessAPI-Submittingjobs
You’ll need to put the parameters in the body in the format that you usually use for query parameters. https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST