SSh
01/26/2023, 10:35 AMError making request to <http://127.0.0.1:9292/contracts/provider/KAPI/version/5015> status=404
But when I’m trying to upload to my own pact broker on pactflow.io all work as expected (using token)
Pact broker docker-compose config
version: "3"
services:
postgres:
image: postgres
healthcheck:
test: psql postgres --command "select 1" -U postgres
volumes:
- postgres-volume:/var/lib/postgresql/data
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: postgres
pact-broker:
image: pactfoundation/pact-broker:2.105.0.1
ports:
- "9292:9292"
depends_on:
- postgres
environment:
PACT_BROKER_BASIC_AUTH_ENABLED: "true"
PACT_BROKER_BASIC_AUTH_USERNAME: "un"
PACT_BROKER_BASIC_AUTH_PASSWORD: "pwd"
PACT_BROKER_ALLOW_PUBLIC_READ: "false"
PACT_BROKER_BASIC_AUTH_READ_ONLY_USERNAME": "unr"
PACT_BROKER_BASIC_AUTH_READ_ONLY_PASSWORD: "pwdr"
PACT_BROKER_DATABASE_URL: "<postgres://postgres:password@postgres/postgres>"
PACT_BROKER_DATABASE_CONNECT_MAX_RETRIES: "2"
PACT_BROKER_BASE_URL: "<http://localhost>"
PACT_BROKER_BASE_URLS: "<http://localhost:9292> <http://127.0.0.1:9292> <https://localhost> <https://127.0.0.1>"
PACT_BROKER_PORT: "9292"
PACT_BROKER_USE_HAL_BROWSER": "true"
volumes:
postgres-volume:
uploading script
for file in "$PWD"/*.yaml
do
PROVIDER_NAME=$(yq eval .info.x-pact-name "$file" )
if [[ "$PROVIDER_NAME" != null ]]
then
echo "Publish '$PROVIDER_NAME' from $file"
pactflow publish-provider-contract \
"${file}" \
--content-type=application/yaml \
--provider="$PROVIDER_NAME" \
--provider-app-version="$RANDOM" \
--broker-base-url="<http://127.0.0.1:9292>" \
--broker-username="un" \
--broker-password="pwd"
fi
done
yaml file
openapi: 3.0.3
info:
title: k API
version: "0.1"
description: k API
x-pact-name: KAPI
paths:
/users/{userId}:
get:
summary: Returns user
parameters:
- in: path
name: userId
description: User ID
schema:
type: string
required: true
responses:
'200':
description: OK
'401':
description: Unauthorized
Yousaf Nabi (pactflow.io)
Dmitry Munda
01/26/2023, 10:57 AMYousaf Nabi (pactflow.io)
Dmitry Munda
01/26/2023, 11:08 AMYousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)