Antonio Gámiz Delgado
02/15/2022, 11:20 AMThis version of the Pact Broker requires that both consumer and provider are specified for a webhook.
running this example: https://github.com/pactflow/example-consumer/blob/master/Makefile#L114Matt (pactflow.io / pact-js / pact-go)
Antonio Gámiz Delgado
02/15/2022, 12:05 PMAfter running PACT_BROKER_BASE_URL=<https://badger.pactflow.io/> PACT_BROKER_TOKEN=48XwmdOofoH_cxzqBawHnQ docker run --rm -v ${PWD}:${PWD} -e PACT_BROKER_BASE_URL -e PACT_BROKER_TOKEN pactfoundation/pact-cli version
Antonio Gámiz Delgado
02/15/2022, 12:05 PMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Antonio Gámiz Delgado
02/15/2022, 12:13 PMMatt (pactflow.io / pact-js / pact-go)
Antonio Gámiz Delgado
02/15/2022, 12:14 PMAntonio Gámiz Delgado
02/15/2022, 12:14 PMAntonio Gámiz Delgado
02/15/2022, 12:14 PMAntonio Gámiz Delgado
02/15/2022, 12:14 PM# This webhook will update the Github commit status for this commit
# so that any PRs will get a status that shows what the status of
# the pact is.
create_or_update_github_commit_status_webhook:
@"${PACT_CLI}" \
broker create-or-update-webhook \
'<https://api.github.com/repos/BadgerMaps/badger-docrouter/statuses/$${pactbroker.consumerVersionNumber}>' \
--header 'Content-Type: application/json' 'Accept: application/vnd.github.v3+json' 'Authorization: token $${user.githubCommitStatusToken}' \
--request POST \
--data @${PWD}/tests/contract/pact/github-commit-status-webhook.json \
--uuid ${GITHUB_WEBHOOK_UUID} \
--consumer ${PACTICIPANT} \
--provider ${PROVIDER} \
--contract-published \
--provider-verification-published \
--description "Github commit status webhook for ${PACTICIPANT}"
Matt (pactflow.io / pact-js / pact-go)
-pact-broker-version: 2.93.3
if you introspect the headers)Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Antonio Gámiz Delgado
02/15/2022, 12:20 PMBeth (pactflow.io/Pact Broker/pact-ruby)
Beth (pactflow.io/Pact Broker/pact-ruby)
Beth (pactflow.io/Pact Broker/pact-ruby)
Beth (pactflow.io/Pact Broker/pact-ruby)
VERBOSE=true
Antonio Gámiz Delgado
02/23/2022, 7:12 AMAntonio Gámiz Delgado
02/23/2022, 7:13 AMAntonio Gámiz Delgado
02/23/2022, 7:14 AMMatt (pactflow.io / pact-js / pact-go)
pact-broker help create-or-update-webhook
Usage:
pact-broker create-or-update-webhook URL --uuid=UUID -X, --request=METHOD -b, --broker-base-url=BROKER_BASE_URL
Options:
-X, --request=METHOD # Webhook HTTP method
-H, [--header=one two three] # Webhook Header
-d, [--data=DATA] # Webhook payload (file or string)
-u, [--user=USER] # Webhook basic auth username and password eg. username:password
[--consumer=CONSUMER] # Consumer name
[--consumer-label=CONSUMER_LABEL] # Consumer label, mutually exclusive with consumer name
[--provider=PROVIDER] # Provider name
[--provider-label=PROVIDER_LABEL] # Provider label, mutually exclusive with provider name
[--description=DESCRIPTION] # Webhook description
[--contract-content-changed], [--no-contract-content-changed] # Trigger this webhook when the pact content changes
[--contract-published], [--no-contract-published] # Trigger this webhook when a pact is published
[--provider-verification-published], [--no-provider-verification-published] # Trigger this webhook when a provider verification result is published
[--provider-verification-failed], [--no-provider-verification-failed] # Trigger this webhook when a failed provider verification result is published
[--provider-verification-succeeded], [--no-provider-verification-succeeded] # Trigger this webhook when a successful provider verification result is published
[--contract-requiring-verification-published], [--no-contract-requiring-verification-published] # Trigger this webhook when a contract is published that requires verification
[--team-uuid=UUID] # UUID of the Pactflow team to which the webhook should be assigned (Pactflow only)
-b, --broker-base-url=BROKER_BASE_URL # The base URL of the Pact Broker
-u, [--broker-username=BROKER_USERNAME] # Pact Broker basic auth username
-p, [--broker-password=BROKER_PASSWORD] # Pact Broker basic auth password
-k, [--broker-token=BROKER_TOKEN] # Pact Broker bearer token
-v, [--verbose], [--no-verbose] # Verbose output. Default: false
--uuid=UUID # Specify the uuid for the webhook
Description:
Create a curl command that executes the request that you want your webhook to execute, then replace "curl" with "pact-broker create-or-update-webhook" and add the consumer, provider, event types and broker details. Note that the URL must be the first parameter when executing create-or-update-webhook and a uuid
must also be provided. You can generate a valid UUID by using the `generate-uuid` command.
Note that the -u option from the curl command clashes with the -u option from the pact-broker CLI. When used in this command, the -u will be used as a curl option. Please use the --broker-username or environment variable for the Pact Broker username.