pact-go icon indicating copy to clipboard operation
pact-go copied to clipboard

how to publish pact contract to broker with version v2 of pact-go

Open robertzhangwenjie opened this issue 2 years ago • 2 comments

Software versions

  • OS: e.g. Mac OSX 10.11.5
  • Consumer Pact library: e.g. Pact go v0.0.8
  • Provider Pact library: e.g. pact-jvm-provider-maven_2.11 v 3.3.8
  • Golang Version: go version
  • Golang environment: Provide output of go env

Expected behaviour

TBC

Actual behaviour

TBC

Steps to reproduce

Provide a repository, gist or reproducable code snippet so that we can test the problem.

Consider forking the project and modifying the E2E test

Relevent log files

Please ensure you set logging to DEBUG and attach any relevant log files here (or link from a gist).

robertzhangwenjie avatar Sep 17 '22 10:09 robertzhangwenjie

You should use our CLI tools: https://docs.pact.io/implementation_guides/cli#pact-broker-cli

I'll update the migration guide if it's not there.

On Sat, 17 Sept 2022, 18:02 wenjie zhang, @.***> wrote:

Software versions

  • OS: e.g. Mac OSX 10.11.5
  • Consumer Pact library: e.g. Pact go v0.0.8
  • Provider Pact library: e.g. pact-jvm-provider-maven_2.11 v 3.3.8
  • Golang Version: go version
  • Golang environment: Provide output of go env

Expected behaviour

TBC Actual behaviour

TBC Steps to reproduce

Provide a repository, gist or reproducable code snippet so that we can test the problem.

Consider forking the project and modifying the E2E test https://github.com/pact-foundation/pact-go/blob/master/dsl/pact_integration_test.go Relevent log files

Please ensure you set logging to DEBUG and attach any relevant log files here (or link from a gist).

— Reply to this email directly, view it on GitHub https://github.com/pact-foundation/pact-go/issues/241, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAANFDF3W4LZVT2SOHAFN53V6WJL5ANCNFSM6AAAAAAQO6DZSY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

mefellows avatar Sep 17 '22 10:09 mefellows

failed to load command error occurred after running fllowing command in pact-broker-cli docker

docker run --rm -v `pwd`:`pwd` -w `pwd`/examples pactfoundation/pact-cli publish ./pacts --auto-detect-version-properties --broker-base-url=localhost -u pact_workshop -p pact_workshop -a `git describe`

output:

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
bundler: failed to load command: /pact/bin/pact (/pact/bin/pact)
/usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.65.0/lib/pact_broker/client/hal/http_client.rb:49:in `create_request': undefined method `request_uri' for #<URI::Generic localhost?> (NoMethodError)
        from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.65.0/lib/pact_broker/client/hal/http_client.rb:25:in `get'
        from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.65.0/lib/pact_broker/client/hal/link.rb:41:in `get'
        from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.65.0/lib/pact_broker/client/hal/link.rb:45:in `get!'
        from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.65.0/lib/pact_broker/client/hal_client_methods.rb:24:in `index_resource'
        from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.65.0/lib/pact_broker/client/publish_pacts.rb:32:in `call'
        from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.65.0/lib/pact_broker/client/publish_pacts.rb:15:in `call'
        from /usr/lib/ruby/gems/3.0.0/gems/pact_broker-client-1.65.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.65.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.65.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>'

robertzhangwenjie avatar Sep 17 '22 15:09 robertzhangwenjie

try adding --platform linux/amd64.

docker run --platform linux/amd64 --rm -v `pwd`:`pwd` -w `pwd`/examples pactfoundation/pact-cli publish ./pacts --auto-detect-version-properties --broker-base-url=localhost -u pact_workshop -p pact_workshop -a `git describe`

hborham avatar Nov 01 '22 23:11 hborham