pact-foundation / pact-ruby-cli

Amalgamated Pact Ruby CLI
https://pact.io
MIT License
12 stars 15 forks source link

Newer version do not compatible with `pact-broker` #90

Closed DKorytkin closed 1 year ago

DKorytkin commented 1 year ago

I experience error when running the command can I deploy

docker run --rm -w ${pwd} -v ${pwd}:${pwd} pactfoundation/pact-cli:latest \
  pact-broker can-i-deploy  --pacticipant=Client --version=0.2.8.dev15 

Client version is0.2.8.dev15

Error retrieving matrix. NoMethodError - undefined method `[]' for nil:NilClass
/usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/matrix/resource.rb:54:in `deployable?'
/usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/can_i_deploy.rb:44:in `create_result'
/usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/can_i_deploy.rb:34:in `call'
/usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/can_i_deploy.rb:23:in `call'
/usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/lib/pact_broker/client/cli/matrix_commands.rb:36:in `can_i_deploy'
/usr/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
/usr/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
/usr/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
/usr/lib/ruby/gems/3.0.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
/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'
/usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.66.0/bin/pact-broker:10:in `<top (required)>'
/usr/bin/pact-broker:25:in `load'
/usr/bin/pact-broker:25:in `<main>'

So problem reproduces on version:

Works fine on version: pactfoundation/pact-cli:0.50.0.32

I assume the root cause in pact_broker-client-1.66.0 where could made incompatible changes Odd thing is that the contract was published OK Pact successfully published for Client version 0.2.8.dev15 ...

bethesque commented 1 year ago

Can you check if your base URL has a trailing slash on it please.

github-actions[bot] commented 1 year ago

👋 Thanks, this ticket has been added to the PactFlow team's backlog as PACT-698

DKorytkin commented 1 year ago

Can you check if your base URL has a trailing slash on it please.

It has and looks like https://pact-broker.com/

bethesque commented 1 year ago

Please remove the trailing slash.

YOU54F commented 1 year ago

@DKorytkin please comment if this is still an issue and we can reopen

DKorytkin commented 1 year ago

removing / at the end of the URL helped. I mean, would be nice if the client handles cases like this. (it worked before pact-cli:0.51.0.0)

YOU54F commented 1 year ago

I believe this PR will solve it for all commands

https://github.com/pact-foundation/pact_broker-client/pull/132

Will keep you posted @DKorytkin

YOU54F commented 1 year ago

I mean, would be nice if the client handles cases like this.

I would agree :) anything we can do, to either aid the user, or at least give them hints on where things have gone wrong will only be beneficial

YOU54F commented 1 year ago

Also thank you for the root cause investigation back to a particular version, that is incredibly helpful

YOU54F commented 1 year ago

fixed now and released in 1.67 of the pact_broker-client and 0.51.0.3 of the docker image

see comment here in the related pull request (with thanks to a community contributor)