Adam Rodger (pact-net)
02/25/2022, 2:53 PMAdam Rodger (pact-net)
02/25/2022, 2:56 PMfunction delete_existing_hooks() {
echo "Deleting all existing webhooks"
curl --silent "$pact_broker_base_url/webhooks" | jq -c -r '._links."pb:webhooks"[].href' | while read url; do
url=$(trim_control_chars "$url")
echo -n -e " Deleting webhook ${cyan}${url}${reset}... "
curl --silent -f -X DELETE "$url" \
&& echo -e "${green}Success${reset}" \
|| echo -e "${red}Failed${reset}"
done
}
function create_new_hooks() {
pushd webhooks/ > /dev/null
for webhook_file in $(ls *.json); do
echo -e "Processing webhook ${cyan}${webhook_file}${reset}"
provider="$(jq -r .provider.name $webhook_file)"
escaped_provider=$(escape "$provider")
consumers_url="$pact_broker_base_url/pacts/provider/$escaped_provider/latest"
curl --silent "$consumers_url" | jq -c -r '._links."pb:pacts"[].name' | while read consumer; do
consumer=$(trim_control_chars "$consumer")
echo -n -e " Creating hook for provider ${cyan}${provider}${reset} from consumer ${cyan}${consumer}${reset}... "
hook_body=$(jq --arg name "$consumer" '{consumer:{name:$name}} + .' "$webhook_file")
curl -f --silent -X POST -H "Content-Type: application/json" -d "$hook_body" -o /dev/null "$pact_broker_base_url/webhooks" \
&& echo -e "${green}Success${reset}" \
|| echo -e "${red}Failed${reset}"
done
done
}
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Adam Rodger (pact-net)
02/26/2022, 9:43 PMMatt (pactflow.io / pact-js / pact-go)
Adam Rodger (pact-net)
02/26/2022, 9:46 PMBeth (pactflow.io/Pact Broker/pact-ruby)
Beth (pactflow.io/Pact Broker/pact-ruby)
Adam Rodger (pact-net)
02/28/2022, 1:42 PMBeth (pactflow.io/Pact Broker/pact-ruby)
Adam Rodger (pact-net)
02/28/2022, 9:29 PMBeth (pactflow.io/Pact Broker/pact-ruby)
Adam Rodger (pact-net)
02/28/2022, 9:31 PM