pact-foundation/pact-provider-verifier

Error returned from tagging request when trying to publish results

CynanX opened this issue · 1 comments

CynanX commented

I'm using the pact standalone executor in a GitLab CI runner, using DinD, targeting an app running inside a Docker Compose file.

I'm using the Linux x86 standalone version 2.0.7.

When I verify the results this works fine but as soon as I try to publish these I get an error, and no results are shown on the broker.

Verification works:

./bin/pact-provider-verifier --broker-username=${PACT_BROKER_USERNAME} --broker-password=${PACT_BROKER_PASSWORD} --provider-base-url=http://docker:3000/ --pact-broker-base-url=https://pact.broker.software:443 --provider=myTestServer --consumer-version-selector='{"latest":true}'

Publishing fails:

./pact/bin/pact-provider-verifier --broker-username=${PACT_BROKER_USERNAME} --broker-password=${PACT_BROKER_PASSWORD} --provider-base-url=http://docker:3000/ --pact-broker-base-url=https://pact.broker.software:443 --provider=myTestServer --consumer-version-selector='{"latest":true}' --publish-verification-results --provider-app-version=${CI_COMMIT_SHORT_SHA} --tag-with-git-branch=${CI_COMMIT_BRANCH}

The error I see is:

INFO: Fetching pacts for myTestServer from https://pact.broker.software:443 with the selection criteria: {:latest=>true}
INFO: Reading pact at https://:*****@pact.broker.software/pacts/provider/myTestServer/consumer/myTestUi/pact-version/1418fa1e0e18ee899cb62ceb14e8b215e8b67ecf/metadata/c1tdW2xdPXRydWUmc1tdW2N2XT03Mzc0
DEBUG: The pact at https://pact.broker.software/pacts/provider/myTestServer/consumer/myTestUi/pact-version/1418fa1e0e18ee899cb62ceb14e8b215e8b67ecf is being verified because the pact content belongs to the consumer version matching the following criterion:
    * latest version of a consumer that has a pact with myTestServer (a7151a02)
Verifying a pact between myTestUi and myTestServer
  Given test table exist
    a request to GET hello
      with GET /api/hello
        returns a response which
WARN: Skipping set up for provider state 'test table exist' for consumer 'myTestUi' as there is no --provider-states-setup-url specified.
          has status code 200
          has a matching body
          includes headers
            "Content-Type" which equals "application/json"
1 interaction, 0 failures
/builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/pact-1.63.0/lib/pact/provider/verification_results/publish.rb:106:in `block in tag_versions': Error returned from tagging request: status=401 body= (Pact::Provider::VerificationResults::PublicationError)
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/pact-1.63.0/lib/pact/provider/verification_results/publish.rb:102:in `each'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/pact-1.63.0/lib/pact/provider/verification_results/publish.rb:102:in `tag_versions'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/pact-1.63.0/lib/pact/provider/verification_results/publish.rb:70:in `tag_versions_if_configured'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/pact-1.63.0/lib/pact/provider/verification_results/publish.rb:36:in `call'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/pact-1.63.0/lib/pact/provider/verification_results/publish.rb:22:in `call'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/pact-1.63.0/lib/pact/provider/verification_results/publish_all.rb:23:in `block in call'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/pact-1.63.0/lib/pact/provider/verification_results/publish_all.rb:20:in `collect'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/pact-1.63.0/lib/pact/provider/verification_results/publish_all.rb:20:in `call'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/pact-1.63.0/lib/pact/provider/verification_results/publish_all.rb:10:in `call'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/pact-1.63.0/lib/pact/provider/rspec/pact_broker_formatter.rb:28:in `close'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/reporter.rb:209:in `block in notify'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/reporter.rb:208:in `each'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/reporter.rb:208:in `notify'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/reporter.rb:243:in `close'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/reporter.rb:196:in `close_after'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/reporter.rb:174:in `finish'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/reporter.rb:76:in `report'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:115:in `run_specs'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:89:in `run'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:71:in `run'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/pact-1.63.0/lib/pact/provider/pact_spec_runner.rb:92:in `run_specs'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/pact-1.63.0/lib/pact/provider/pact_spec_runner.rb:36:in `run'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/pact-1.63.0/lib/pact/cli/run_pact_verification.rb:70:in `run_with_pact_uri_object'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/pact-1.63.0/lib/pact/cli/run_pact_verification.rb:51:in `run_specs'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/pact-1.63.0/lib/pact/cli/run_pact_verification.rb:21:in `call'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/pact-1.63.0/lib/pact/cli/run_pact_verification.rb:13:in `call'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/pact-provider-verifier-1.38.0/lib/pact/provider_verifier/app.rb:181:in `verify_pact'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/pact-provider-verifier-1.38.0/lib/pact/provider_verifier/app.rb:50:in `block in pacts_pass_verification?'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/pact-provider-verifier-1.38.0/lib/pact/provider_verifier/app.rb:49:in `collect'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/pact-provider-verifier-1.38.0/lib/pact/provider_verifier/app.rb:49:in `pacts_pass_verification?'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/pact-provider-verifier-1.38.0/lib/pact/provider_verifier/app.rb:41:in `call'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/pact-provider-verifier-1.38.0/lib/pact/provider_verifier/app.rb:34:in `call'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/pact-provider-verifier-1.38.0/lib/pact/provider_verifier/cli/verify.rb:49:in `verify'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/thor-1.2.2/lib/thor/base.rb:485:in `start'
	from /builds/test-app/pact/lib/vendor/ruby/3.2.0/gems/pact-provider-verifier-1.38.0/lib/pact/provider_verifier/cli/custom_thor.rb:17:in `start'
	from /builds/test-app/pact/lib/app/pact-provider-verifier.rb:33:in `<main>'
INFO: Tagging version 6035ddbc of myTestServer as "test_branch"

Any clues?

Thank you.

CynanX commented

Suddenly noticed "status=401". Looking this up shows this means the request is unauthorised. Double checked my username and password variables and one was not set. Guess these are not required for retrieving pacts.. only publishing the results.