any ideeas pretty please?
# general
b
any ideeas pretty please?
y
you probably aren't loading a git repo, try removing
--tag-with-git-branch
into the volume mount in docker.
is
${PWD}
your directory with a
.git
folder in it?
-v ${PWD}:${PWD}
b
removing the --tag-with-git-branch made it work
y
did you clone the pact-ruby-cli repo?
b
yes
y
and cd into it,
b
just cloned it and ran the command
y
checking now buddy 🙂 on my mac
👍 1
b
yes, cd-ed in it and ran it
Copy code
myuser@myuser-laptop:~/workspace/pact-ruby-cli(master)$ pwd
/home/myuser/workspace/pact-ruby-cli
y
Hmm so that worked for me, the only thing that I changed was to use the PACT_BROKER_TOKEN, rather than username and password as using a Pactflow broker
b
I am using pact broker (stored on a company machine) and using user\pass
y
do you have the latest version of the cli?
docker pull pactfoundation/pact-cli:latest
user/pass shouldn't make a diff at all
b
hah - that did the trick
y
I saw the issue as part of our GitHub actions runs https://github.com/pact-foundation/pact-ruby-cli/pull/79 and put a change out for this
b
grabbed the latest and ran it
y
Sweet, my fix above sorted it then, I was worried I had caused it 😅
b
thanks so much for the help Yousaf
I would dare to go for a second question then... close to the case above
running the same command but for a local project (that is the pact POC) to publish in the broker, throws a timeout after ~2 min
Copy code
bundler: failed to load command: /pact/bin/pact (/pact/bin/pact)
/usr/lib/ruby/3.0.0/net/http.rb:987:in `initialize': execution expired (Net::OpenTimeout)
	from /usr/lib/ruby/3.0.0/net/http.rb:987:in `open'
	from /usr/lib/ruby/3.0.0/net/http.rb:987:in `block in connect'
	from /usr/lib/ruby/3.0.0/timeout.rb:107:in `timeout'
	from /usr/lib/ruby/3.0.0/net/http.rb:985:in `connect'
	from /usr/lib/ruby/3.0.0/net/http.rb:970:in `do_start'
	from /usr/lib/ruby/3.0.0/net/http.rb:959:in `start'
	from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/hal/http_client.rb:79:in `block in perform_request'
	from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/hal/http_client.rb:93:in `until_truthy_or_max_times'
	from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/hal/http_client.rb:64:in `perform_request'
	from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/hal/http_client.rb:35:in `post'
	from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/hal/link.rb:57:in `post'
	from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/publish_pacts.rb:61:in `block in publish_pacts'
	from /usr/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/file_list.rb:70:in `collect'
	from /usr/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/file_list.rb:70:in `collect'
	from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/publish_pacts.rb:60:in `publish_pacts'
	from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/publish_pacts.rb:33:in `call'
	from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/publish_pacts.rb:15:in `call'
	from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/cli/pact_commands.rb:66:in `publish_pacts'
	from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/cli/pact_commands.rb:29:in `publish'
	from /usr/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /usr/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /usr/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
	from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/cli/custom_thor.rb:23:in `start'
	from /pact/lib/pact/cli.rb:71:in `publish'
	from /usr/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /usr/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /usr/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
	from /pact/bin/pact:15:in `<top (required)>'
	from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.3.13/lib/bundler/cli/exec.rb:58:in `load'
	from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.3.13/lib/bundler/cli/exec.rb:58:in `kernel_load'
	from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.3.13/lib/bundler/cli/exec.rb:23:in `run'
	from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.3.13/lib/bundler/cli.rb:483:in `exec'
	from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.3.13/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.3.13/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.3.13/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.3.13/lib/bundler/cli.rb:31:in `dispatch'
	from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.3.13/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.3.13/lib/bundler/cli.rb:25:in `start'
	from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.3.13/exe/bundle:48:in `block in <top (required)>'
	from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.3.13/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
	from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.3.13/exe/bundle:36:in `<top (required)>'
	from /usr/bin/bundle:25:in `load'
	from /usr/bin/bundle:25:in `<main>'
y
Could be any number of reasons, including your broker setup, I would probably try and create a minimal reproducible example or a set of reproduction steps including commands run, and where you pacts are located, and run in.
y
Did the first command publish Okay to your broker?
just your own pacts in your project aren't?
b
the one in the recently cloned project that you provide as example worked well
my pacts won't go in my broker using the CLI
y
that pact is baked into the image, you will need to ensure the path to the pacts directory is correct in the volume mount
if you can't publish to your broker with either the issue is with your connection to the broker
if the issue is just with publishing from your own project, you probably haven't loaded a volume with the pacts in, and provided a path for the pacts directory/file
b
connectivity shouldn't be an issue as
docker run --rm -e PACT_BROKER_BASE_URL -e PACT_BROKER_USERNAME=pactuser -e PACT_BROKER_PASSWORD pactfoundation/pact-cli:latest pact-broker can-i-deploy --pacticipant ......
works well
thanks for the hint, I will play a bit with the paths
@Yousaf Nabi (pactflow.io) hoping to not become too annoying... I tried to go down to the safest case, which was to publish the same contract (that was successfully published to your broker) to our broker (by replacing the 3 params - url\user\pass). Essentially I ran the exact same command again. The result is the same error. Any suggestion on what else can I check pretty please? running the
can-i-deploy
works fine against the same broker.
In terms of logs, nothing is recorded in pact-broker container's logs
P.S.: sh-ing in the local pactfoundation/pact-cli:latest container (that is stopped after running the publish command), I see that the pact is successfully copied inside - found it under
/home/myuser/workspace/pact-ruby-cli # cat example/pacts/pact.json
so the problem is somhow... sending it from the cli to the broker
one difference between the brokers is that yours is https while ours is http - should it matter?
y
The file is pre loaded into the docker image anyway. You can use the pact cli tool directory by downloading it as a standalone, or installing it as a ruby gem and that might save you some issues. It isn’t clear if you’ve ever published a pact to your broker. ( nor how your broker is set up ) You can spin up a pact broker with docker composer easily to test. I would strongly advise making a concise list of steps and ideally a reproducible example or share as much code as you can. It is very difficult to hypothesise at what the problem may be. You may wish to raise it in a GitHub issue if it is easier to format. If I am getting the gist, the example pact in the repo will load into your broker, your own pact won’t? Have you check the contents of your pact to see if it is valid. Can you share it. Is your broker on the latest version, if not can you share which version.
https://docs.pactflow.io/docs/bi-directional-contract-testing/contracts/oas#installation Although this is from the Pactflow docs it offers the various ways you can download and use the CLI tools. Just in case using docker is adding an extra layer of complexity here
b
• pact broker is dockerized and is started with a docker compose. • pact broker is the latest version (docker pull pactfoundation/pact-broker:latest) • it also has a contract that is published with a mvn test command in the consumer from the already existing project - so publishing works, but not with the CLI.
"Have you check the contents of your pact to see if it is valid." I tried to publish in our broker the same contract that I published in your broker, without changing it (it's the pact.json that's present in the
pact-ruby-cli
project that I cloned a bit earlier) . The only change I did was to replace the following variables • export PACT_BROKER_BASE_URL=... • export PACT_BROKER_USERNAME=... • export PACT_BROKER_PASSWORD=... with the values that point to our broker. When I run the publish command, I get the error. If I set the variables PACT_BROKER_BASE_URL etc. back to your broker's values, the command will be successful again and the contract will be published in your broker
So the issue I need to fix, is to publish your contract to our broker, by using the docker run. Fixing this will also fix the publishing of our contracts as the error is the same. The only thing I can change is basically the docker-compose file. Would it help if I share it?
m
have you tried adding the
--verbose
flag to the command? That should print out additional HTTP level logs, so we can see what is trying to be sent and to where
b
thanks for answering @Matt (pactflow.io / pact-js / pact-go). After adding the
--verbose
I do get some extra info:
Copy code
.................
	from /usr/bin/bundle:25:in `<main>'
opening connection to 10.34.133.12:9292...

opened
<- "GET /? HTTP/1.1\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: application/hal+json\r\nUser-Agent: Ruby\r\nAuthorization: [redacted]\r\n"
-> "HTTP/1.1 200 OK\r\n"
-> "Vary: Accept\r\n"
-> "Content-Type: application/hal+json;charset=utf-8\r\n"
-> "Date: Wed, 07 Dec 2022 10:33:42 GMT\r\n"
-> "Server: Webmachine-Ruby/1.6.0 Rack/1.3\r\n"
-> "X-Pact-Broker-Version: 2.105.0\r\n"
-> "X-Content-Type-Options: nosniff\r\n"
-> "Content-Length: 4384\r\n"
-> "\r\n"
reading 4384 bytes...
-> "{\"_links\":{\"self\":{\"href\":\"<http://10.33.132.13:9292>\",\"title\":\"Index\",\"templated\":false},\"pb:publish-pact\":{\"href\":\"<http://10.33.132.13:9292/pacts/provider/{provider}/consumer/{consumer}/version/{consumerApplicationVersion}>\",\"title\":\"Publish a pact\",\"templated\":true},\"pb:publish-contracts\":{\"href\":\"<http://10.33.132.13:9292/contracts/publish>\",\"title\":\"Publish contracts\",\"templated\":false},\"pb:latest-pact-versions\":{\"href\":\"<http://10.33.132.13:9292/pacts/latest>\",\"title\":\"Latest pact versions\",\"templated\":false},\"pb:tagged-pact-versions\":{\"href\":\"<http://10.33.132.13:9292/pacts/provider/{provider}/consumer/{consumer}/tag/{tag}>\",\"title\":\"All versions of a pact for a given consumer, provider and consumer version tag\",\"templated\":false},\"pb:pacticipants\":{\"href\":\"<http://10.33.132.13:9292/pacticipants>\",\"title\":\"Pacticipants\",\"templated\":false},\"pb:pacticipant\":{\"href\":\"<http://10.33.132.13:9292/pacticipants/{pacticipant}>\",\"title\":\"Fetch pacticipant by name\",\"templated\":true},\"pb:latest-provider-pacts\":{\"href\":\"<http://10.33.132.13:9292/pacts/provider/{provider}/latest>\",\"title\":\"Latest pacts by provider\",\"templated\":true},\"pb:latest-provider-pacts-with-tag\":{\"href\":\"<http://10.33.132.13:9292/pacts/provider/{provider}/latest/{tag}>\",\"title\":\"Latest pacts for provider with the specified tag\",\"templated\":true},\"pb:provider-pacts-with-tag\":{\"href\":\"<http://10.33.132.13:9292/pacts/provider/{provider}/tag/{tag}>\",\"title\":\"All pact versions for the provider with the specified consumer version tag\",\"templated\":true},\"pb:provider-pacts\":{\"href\":\"<http://10.33.132.13:9292/pacts/provider/{provider}>\",\"title\":\"All pact versions for the specified provider\",\"templated\":true},\"pb:latest-version\":{\"href\":\"<http://10.33.132.13:9292/pacticipants/{pacticipant}/latest-version>\",\"title\":\"Latest pacticipant version\",\"templated\":true},\"pb:latest-tagged-version\":{\"href\":\"<http://10.33.132.13:9292/pacticipants/{pacticipant}/latest-version/{tag}>\",\"title\":\"Latest pacticipant version with the specified tag\",\"templated\":true},\"pb:webhooks\":{\"href\":\"<http://10.33.132.13:9292/webhooks>\",\"title\":\"Webhooks\",\"templated\":false},\"pb:webhook\":{\"href\":\"<http://10.33.132.13:9292/webhooks/{uuid}>\",\"title\":\"Webhook\",\"templated\":true},\"pb:integrations\":{\"href\":\"<http://10.33.132.13:9292/integrations>\",\"title\":\"Integrations\",\"templated\":false},\"pb:pacticipant-version-tag\":{\"href\":\"<http://10.33.132.13:9292/pacticipants/{pacticipant}/versions/{version}/tags>"
-> "/{tag}\",\"title\":\"Get, create or delete a tag for a pacticipant version\",\"templated\":true},\"pb:pacticipant-branch-version\":{\"href\":\"<http://10.33.132.13:9292/pacticipants/{pacticipant}/branches/{branch}/versions/{version}>\",\"title\":\"Get or add/create a pacticipant version for a branch\",\"templated\":true},\"pb:pacticipant-version\":{\"href\":\"<http://10.33.132.13:9292/pacticipants/{pacticipant}/versions/{version}>\",\"title\":\"Get, create or delete a pacticipant version\",\"templated\":true},\"pb:metrics\":{\"href\":\"<http://10.33.132.13:9292/metrics>\",\"title\":\"Get Pact Broker metrics\"},\"pb:can-i-deploy-pacticipant-version-to-tag\":{\"href\":\"<http://10.33.132.13:9292/can-i-deploy?pacticipant={pacticipant}&version={version}&to={tag}>\",\"title\":\"Determine if an application version can be safely deployed to an environment identified by the given tag\",\"templated\":true},\"pb:can-i-deploy-pacticipant-version-to-environment\":{\"href\":\"<http://10.33.132.13:9292/can-i-deploy?pacticipant={pacticipant}&version={version}&environment={environment}>\",\"title\":\"Determine if an application version can be safely deployed to an environment\",\"templated\":true},\"pb:provider-pacts-for-verification\":{\"href\":\"<http://10.33.132.13:9292/pacts/provider/{provider}/for-verification>\",\"title\":\"Pact versions to be verified for the specified provider\",\"templated\":true},\"beta:provider-pacts-for-verification\":{\"name\":\"beta\",\"href\":\"<http://10.33.132.13:9292/pacts/provider/{provider}/for-verification>\",\"title\":\"DEPRECATED - please use pb:provider-pacts-for-verification\",\"templated\":true},\"curies\":[{\"name\":\"pb\",\"href\":\"<http://10.33.132.13:9292/doc/{rel}?context=index>\",\"templated\":true},{\"name\":\"beta\",\"href\":\"<http://10.33.132.13:9292/doc/{rel}?context=index>\",\"templated\":true}],\"pb:environments\":{\"title\":\"Environments\",\"href\":\"<http://10.33.132.13:9292/environments>\",\"templated\":false},\"pb:environment\":{\"title\":\"Environment\",\"href\":\"<http://10.33.132.13:9292/environments/{uuid}>\",\"templated\":true}}}"
read 4384 bytes
Conn keep-alive
opening connection to 10.33.132.13:9292...
m
The IP address in the second request looks different.
Note the 2nd octet
b
typo - merged the new part to some of the previous one
😆 1
wanted it to make sense 🙂
I played a bit with the ec2
👍 1
Copy code
docker run --rm -w ${PWD} -v ${PWD}:${PWD} -e PACT_BROKER_BASE_URL -e PACT_BROKER_USERNAME -e PACT_BROKER_PASSWORD pactfoundation/pact-cli:latest publish ${PWD}/example/pacts --consumer-app-version fake-git-sha-for-demo-$(date +%s) --tag-with-git-branch --verbose
bundler: failed to load command: /pact/bin/pact (/pact/bin/pact)
/usr/lib/ruby/3.0.0/net/http.rb:987:in `initialize': execution expired (Net::OpenTimeout)
	from /usr/lib/ruby/3.0.0/net/http.rb:987:in `open'
	from /usr/lib/ruby/3.0.0/net/http.rb:987:in `block in connect'
	from /usr/lib/ruby/3.0.0/timeout.rb:107:in `timeout'
	from /usr/lib/ruby/3.0.0/net/http.rb:985:in `connect'
	from /usr/lib/ruby/3.0.0/net/http.rb:970:in `do_start'
	from /usr/lib/ruby/3.0.0/net/http.rb:959:in `start'
	from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/hal/http_client.rb:79:in `block in perform_request'
	from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/hal/http_client.rb:93:in `until_truthy_or_max_times'
	from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/hal/http_client.rb:64:in `perform_request'
	from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/hal/http_client.rb:35:in `post'
	from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/hal/link.rb:57:in `post'
	from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/publish_pacts.rb:61:in `block in publish_pacts'
	from /usr/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/file_list.rb:70:in `collect'
	from /usr/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/file_list.rb:70:in `collect'
	from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/publish_pacts.rb:60:in `publish_pacts'
	from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/publish_pacts.rb:33:in `call'
	from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/publish_pacts.rb:15:in `call'
	from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/cli/pact_commands.rb:66:in `publish_pacts'
	from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/cli/pact_commands.rb:29:in `publish'
	from /usr/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /usr/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /usr/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
	from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/cli/custom_thor.rb:23:in `start'
	from /pact/lib/pact/cli.rb:71:in `publish'
	from /usr/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /usr/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /usr/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
	from /pact/bin/pact:15:in `<top (required)>'
	from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.3.13/lib/bundler/cli/exec.rb:58:in `load'
	from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.3.13/lib/bundler/cli/exec.rb:58:in `kernel_load'
	from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.3.13/lib/bundler/cli/exec.rb:23:in `run'
	from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.3.13/lib/bundler/cli.rb:483:in `exec'
	from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.3.13/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.3.13/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.3.13/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.3.13/lib/bundler/cli.rb:31:in `dispatch'
	from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.3.13/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.3.13/lib/bundler/cli.rb:25:in `start'
	from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.3.13/exe/bundle:48:in `block in <top (required)>'
	from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.3.13/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
	from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.3.13/exe/bundle:36:in `<top (required)>'
	from /usr/bin/bundle:25:in `load'
	from /usr/bin/bundle:25:in `<main>'
opening connection to 10.34.133.12:9292...
opened
<- "GET /? HTTP/1.1\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: application/hal+json\r\nUser-Agent: Ruby\r\nAuthorization: [redacted]\r\n"
-> "HTTP/1.1 200 OK\r\n"
-> "Vary: Accept\r\n"
-> "Content-Type: application/hal+json;charset=utf-8\r\n"
-> "Date: Wed, 07 Dec 2022 10:33:42 GMT\r\n"
-> "Server: Webmachine-Ruby/1.6.0 Rack/1.3\r\n"
-> "X-Pact-Broker-Version: 2.105.0\r\n"
-> "X-Content-Type-Options: nosniff\r\n"
-> "Content-Length: 4384\r\n"
-> "\r\n"
reading 4384 bytes...
-> "{\"_links\":{\"self\":{\"href\":\"<http://10.34.133.12:9292>\",\"title\":\"Index\",\"templated\":false},\"pb:publish-pact\":{\"href\":\"<http://10.34.133.12:9292/pacts/provider/{provider}/consumer/{consumer}/version/{consumerApplicationVersion}>\",\"title\":\"Publish a pact\",\"templated\":true},\"pb:publish-contracts\":{\"href\":\"<http://10.34.133.12:9292/contracts/publish>\",\"title\":\"Publish contracts\",\"templated\":false},\"pb:latest-pact-versions\":{\"href\":\"<http://10.34.133.12:9292/pacts/latest>\",\"title\":\"Latest pact versions\",\"templated\":false},\"pb:tagged-pact-versions\":{\"href\":\"<http://10.34.133.12:9292/pacts/provider/{provider}/consumer/{consumer}/tag/{tag}>\",\"title\":\"All versions of a pact for a given consumer, provider and consumer version tag\",\"templated\":false},\"pb:pacticipants\":{\"href\":\"<http://10.34.133.12:9292/pacticipants>\",\"title\":\"Pacticipants\",\"templated\":false},\"pb:pacticipant\":{\"href\":\"<http://10.34.133.12:9292/pacticipants/{pacticipant}>\",\"title\":\"Fetch pacticipant by name\",\"templated\":true},\"pb:latest-provider-pacts\":{\"href\":\"<http://10.34.133.12:9292/pacts/provider/{provider}/latest>\",\"title\":\"Latest pacts by provider\",\"templated\":true},\"pb:latest-provider-pacts-with-tag\":{\"href\":\"<http://10.34.133.12:9292/pacts/provider/{provider}/latest/{tag}>\",\"title\":\"Latest pacts for provider with the specified tag\",\"templated\":true},\"pb:provider-pacts-with-tag\":{\"href\":\"<http://10.34.133.12:9292/pacts/provider/{provider}/tag/{tag}>\",\"title\":\"All pact versions for the provider with the specified consumer version tag\",\"templated\":true},\"pb:provider-pacts\":{\"href\":\"<http://10.34.133.12:9292/pacts/provider/{provider}>\",\"title\":\"All pact versions for the specified provider\",\"templated\":true},\"pb:latest-version\":{\"href\":\"<http://10.34.133.12:9292/pacticipants/{pacticipant}/latest-version>\",\"title\":\"Latest pacticipant version\",\"templated\":true},\"pb:latest-tagged-version\":{\"href\":\"<http://10.34.133.12:9292/pacticipants/{pacticipant}/latest-version/{tag}>\",\"title\":\"Latest pacticipant version with the specified tag\",\"templated\":true},\"pb:webhooks\":{\"href\":\"<http://10.34.133.12:9292/webhooks>\",\"title\":\"Webhooks\",\"templated\":false},\"pb:webhook\":{\"href\":\"<http://10.34.133.12:9292/webhooks/{uuid}>\",\"title\":\"Webhook\",\"templated\":true},\"pb:integrations\":{\"href\":\"<http://10.34.133.12:9292/integrations>\",\"title\":\"Integrations\",\"templated\":false},\"pb:pacticipant-version-tag\":{\"href\":\"<http://10.34.133.12:9292/pacticipants/{pacticipant}/versions/{version}/tags>"
-> "/{tag}\",\"title\":\"Get, create or delete a tag for a pacticipant version\",\"templated\":true},\"pb:pacticipant-branch-version\":{\"href\":\"<http://10.34.133.12:9292/pacticipants/{pacticipant}/branches/{branch}/versions/{version}>\",\"title\":\"Get or add/create a pacticipant version for a branch\",\"templated\":true},\"pb:pacticipant-version\":{\"href\":\"<http://10.34.133.12:9292/pacticipants/{pacticipant}/versions/{version}>\",\"title\":\"Get, create or delete a pacticipant version\",\"templated\":true},\"pb:metrics\":{\"href\":\"<http://10.34.133.12:9292/metrics>\",\"title\":\"Get Pact Broker metrics\"},\"pb:can-i-deploy-pacticipant-version-to-tag\":{\"href\":\"<http://10.34.133.12:9292/can-i-deploy?pacticipant={pacticipant}&version={version}&to={tag}>\",\"title\":\"Determine if an application version can be safely deployed to an environment identified by the given tag\",\"templated\":true},\"pb:can-i-deploy-pacticipant-version-to-environment\":{\"href\":\"<http://10.34.133.12:9292/can-i-deploy?pacticipant={pacticipant}&version={version}&environment={environment}>\",\"title\":\"Determine if an application version can be safely deployed to an environment\",\"templated\":true},\"pb:provider-pacts-for-verification\":{\"href\":\"<http://10.34.133.12:9292/pacts/provider/{provider}/for-verification>\",\"title\":\"Pact versions to be verified for the specified provider\",\"templated\":true},\"beta:provider-pacts-for-verification\":{\"name\":\"beta\",\"href\":\"<http://10.34.133.12:9292/pacts/provider/{provider}/for-verification>\",\"title\":\"DEPRECATED - please use pb:provider-pacts-for-verification\",\"templated\":true},\"curies\":[{\"name\":\"pb\",\"href\":\"<http://10.34.133.12:9292/doc/{rel}?context=index>\",\"templated\":true},{\"name\":\"beta\",\"href\":\"<http://10.34.133.12:9292/doc/{rel}?context=index>\",\"templated\":true}],\"pb:environments\":{\"title\":\"Environments\",\"href\":\"<http://10.34.133.12:9292/environments>\",\"templated\":false},\"pb:environment\":{\"title\":\"Environment\",\"href\":\"<http://10.34.133.12:9292/environments/{uuid}>\",\"templated\":true}}}"
read 4384 bytes
Conn keep-alive
opening connection to 10.34.133.12:9292...
this is the complete current log
m
Interesting. What do the server logs say?
It's weird the first request goes through but not the subsequent
b
I need to check with someone who has rights... will be back as soon as I have the server logs
👍 1
Hi @Matt (pactflow.io / pact-js / pact-go) Nothing gets populated in the logs when I run the command. I checked
docker logs -f pact-broker
and also looked at EC2's system log.
Interesting fact is that I deployed locally the same pact-broker, by using the same docker-compose, and it works. But not when the broker is in AWS...
Knowing that the first request goes through, can you please tell me how can I trace the exact URI and Port at which the second request is being done?
Managed to check the requests @Matt (pactflow.io / pact-js / pact-go) by running Wireshark on the docker0 interface, and saw that the 2nd request is sent from the same ip (obviously) but on a different port. I think that our Firewall has some protection so it's definitely not a broker issue - even more, the publish command works from a different EC2
Hi @Yousaf Nabi (pactflow.io), @Matt (pactflow.io / pact-js / pact-go). I tried to publish with the mechanism you provided here: https://pact-foundation.slack.com/archives/C5F4KFKR8/p1670360300858079?thread_ts=1670333074.636179&amp;cid=C5F4KFKR8 So after downloading the latest version from here: https://github.com/pact-foundation/pact-ruby-standalone/releases I could publish the contract by running:
~/Downloads/pact-1.91.0-linux-x86_64/pact/bin/pact-broker publish /home/user/workspace/pact-ruby-cli/example/pacts/ -b <http://10.34.133.12:9292> -u myPactUser -p 'myPassword' -a fake-git-sha-for-demo-$(date +%s) -g -v
Any chance you can make the docker command work as well? - as it will be quite hard to get all the members in all the teams to download the standalone plus keeping it updated to the latest version whenever a new version comes out. To have all in one place, the docker command that fails (for which only the first request goes through):
docker run -w ${PWD} -v ${PWD}:${PWD} -e PACT_BROKER_BASE_URL -e PACT_BROKER_USERNAME -e PACT_BROKER_PASSWORD pactfoundation/pact-cli:latest publish ${PWD}/example/pacts/ --consumer-app-version fake-git-sha-for-demo-$(date +%s) --tag-with-git-branch --verbose
Thank you,
m
It should be executing the same code (i.e. what is in Docker is the same code, packaged as a Docker container)
My guess is that there is some networking configuration / combination using Docker causing the issue
b
@Matt (pactflow.io / pact-js / pact-go) should I understand that the issue is in our network or ...?
m
Yes, it certainly appears that way.
b
thanks Matt.
👍 1
m
Sorry, I wish I could help you more!
My suggestion from here is to try and create a simple HA setup (sans VPN etc.) and see if the client works there, and then layer in the other networking components until it stops working. Then at least we’ll have a target to debug
👍 1
b
hi @Matt (pactflow.io / pact-js / pact-go) and Happy New Year. I did the same implementation on a public AWS network and it works. It will only NOT work in a private one.
But
: it works if the docker command (same command / same docker version / same VPN etc.) runs from a Mac. Tested on 3 Ubuntu's in different corners of the world, and on 3 Macs also in different countries. So from Ubuntu 20.04.5 LTS it doesn't work but from macOS Monterey v 12.6. it works. Could it be something specific to Ubuntu ?