Hello, after doing an upgrade of the broker, on th...
# pact-broker
é
Hello, after doing an upgrade of the broker, on the pacticipant page we got a
details
tab. But I would like to know how to populate the fields? •
Main branch
Repository URL
b
é
I'm having the following issue:
Copy code
make publish-contract
docker run \
	--rm \
	--workdir=${PWD} \
	--volume=${PWD}:${PWD} \
	--env=PACT_BROKER_BASE_URL \
	pactfoundation/pact-cli:latest \
		publish \
		${PWD}/contracts \
		--consumer-app-version da970bb \
		--tag-with-git-branch \
		--repository-url="<https://git.foo.tech/qraft/contract-testing/pact-consumer-example-for-go>" \
		--main-branch=main
ERROR: pact-broker publish was called with invalid arguments ["--repository-url"]
make: *** [Makefile:133: publish-contract] Error 1
Having some trouble pusing the
--repository-url
with the CLI https://github.com/pact-foundation/pact_broker-client/issues/106
m
you’re calling the
publish
command, I think you meant to use
create-or-update-pacticipant
🙏 1
é
Manage to make it work with the docker image, but not
curl
despite a
200
Copy code
curl \
--verbose \
	--location \
	--request PUT \
	--header "Content-Type:application/json" \
	--data '{"name": "ms.pact-consumer-example-for-go.b2b", "repositoryUrl": "<https://git.manomano.tech/qraft/contract-testing/pact-consumer-example-for-gofoo>", "mainBranch": "main"}' \
	${PACT_BROKER_BASE_URL}/pacticipants/ms.pact-consumer-example-for-go.b2b
*   Trying 10.192.103.176:80...
* TCP_NODELAY set
* Connected to <http://infra-pact-broker-web.support.manomano.com|infra-pact-broker-web.support.manomano.com> (10.192.103.176) port 80 (#0)
> PUT /pacticipants/ms.pact-consumer-example-for-go.b2b HTTP/1.1
> Host: <http://infra-pact-broker-web.support.manomano.com|infra-pact-broker-web.support.manomano.com>
> User-Agent: curl/7.68.0
> Accept: */*
> Content-Type:application/json
> Content-Length: 170
> 
* upload completely sent off: 170 out of 170 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Date: Wed, 27 Apr 2022 11:32:35 GMT
< Content-Type: application/hal+json;charset=utf-8
< Content-Length: 1588
< Connection: keep-alive
< Vary: Accept
< X-Pact-Broker-Version: 2.93.2
< X-Content-Type-Options: nosniff
<
Response:
Copy code
{
  "repositoryUrl": "<https://git.manomano.tech/qraft/contract-testing/pact-consumer-example-for-gofoo>",
  "mainBranch": "main",
  "createdAt": "2022-04-27T11:32:35+00:00",
  "_embedded": {
    "labels": []
  },
  "_links": {
    "self": {
      "href": "<http://infra-pact-broker-web.support.manomano.com/pacticipants/>"
    },
    "pb:versions": {
      "href": "<http://infra-pact-broker-web.support.manomano.com/pacticipants//versions>"
    },
    "pb:version": {
      "title": "Get, create or delete a pacticipant version",
      "href": "<http://infra-pact-broker-web.support.manomano.com/pacticipants//versions/{version}>",
      "templated": true
    },
    "pb:version-tag": {
      "title": "Get, create or delete a tag for a version of ",
      "href": "<http://infra-pact-broker-web.support.manomano.com/pacticipants//versions/{version}/tags/{tag}>",
      "templated": true
    },
    "pb:branch-version": {
      "title": "Get or add/create a version for a branch of ",
      "href": "<http://infra-pact-broker-web.support.manomano.com/pacticipants//branches/{branch}/versions/{version}>",
      "templated": true
    },
    "pb:label": {
      "title": "Get, create or delete a label for ",
      "href": "http:/* Connection #0 to host <http://infra-pact-broker-web.support.manomano.com|infra-pact-broker-web.support.manomano.com> left intact /infra-pact-broker-web.support.manomano.com/pacticipants//labels/{label}",
      "templated": true
    },
    "versions": {
      "title": "Deprecated - use pb:versions",
      "href": "<http://infra-pact-broker-web.support.manomano.com/pacticipants//versions>"
    },
    "pb:can-i-deploy-badge": {
      "title": "Can I Deploy  badge",
      "href": "<http://infra-pact-broker-web.support.manomano.com/pacticipants//latest-version/{tag}/can-i-deploy/to/{environmentTag}/badge>",
      "templated": true
    },
    "curies": [
      {
        "name": "pb",
        "href": "<http://infra-pact-broker-web.support.manomano.com/doc/{rel}?context=pacticipant>",
        "templated": true
      }
    ]
  }
}
m
wow! It ignored the name property and now you have an empty pacticipant
if you add
--verbose
to the CLI, you can see what it actually sent over the wire to compare
(try a
PATCH
, it looks like that resource is a bit quirky with
PUT
)
looking at the code, it might also support a
POST
and will do the smarts to update if it exists
é
Thanks,
PATCH
is working ✌️ (
POST
and
PUT
don't)
👍 1
b
POST does. Please see the issue.
m
For the update operation as well?
b
no, for creation.
were we trying to update?
m
I think I mixed that up when I saw the
PUT
But I think
PATCH
worked for him, because the pacticipant was created and then he needed to update it
1
It also looks like
PATCH
would ultimately create the pacticipant anyway from my memory of looking at the code last night. There was a comment there to the effect of “this was a bad idea / I wish I hadn’t supported this” 😆
b
yeah, i just came across that too
I initially supported POST for create and PATCH for create/update, and that's what the CLI has to use because I never make a breaking change to the CLI.
PUT came later.
If there is a pacticipant with an empty name, there's definitely a bug in one of them, but the CLI works fine as far as I can tell.
☝️ 1
Just need to call the right command name 😛