<#588 Can I deploy json output should return provi...
# pact-broker
g
#588 Can I deploy json output should return provider version in the matrix when verification did not happen yet Issue created by uittorio Pre issue-raising checklist I have already ☑︎ Upgraded to the latest Pact Broker OR ☑︎ Checked the CHANGELOG to see if the issue I am about to raise has been fixed ☐ Created an executable example that demonstrates the issue using either a: • Dockerfile • Git repository with a Travis or Appveyor (or similar) build Software versions • OS: e.g. Any • pact broker client details:** pact-ruby-standalone CLI v 1.91.0 • pact gem 1.62.0 • pact-mock_service gem 3.9.0 • pact-support gem 1.18.1 • pact-provider-verifier gem 1.36.1 • pact_broker-client gem 1.65.0 • pact-message gem 0.11.1 Expected behaviour When checking if a Consumer with a specified version can be deployed in an environment for a specific Provider And the pact is not verified yet Then the JSON output includes the version of the Provider Actual behaviour When checking if a Consumer with a specified version can be deployed in an environment for a specific Provider And the pact is not verified yet Then the JSON output does not include the version of the Provider Step to reproduce • Publish a pact that changes the content (a new pact) • Do not verify the pact • run the pact broker can-i-deploy command I was expecting this command to return the version of the provider in prod but instead it returns null!
Copy code
pact-broker can-i-deploy --pacticipant {Consumer} --version {consumerVersion}  --pacticipant {Provider} -l --in_environment {environment} --broker-base-url {broker.base.url} -k {token} -o json
Actual Response. I've only included the relevant part in the json output example!
Copy code
{
  "summary": {
    "deployable": null,
    "reason": "There is no verified pact between version s712-consumerVersion-g1723 of AConsumer and the latest version of AProvider (b123-providerVersion-901)",
    "success": 0,
    "failed": 0,
    "unknown": 1
  },
  "notices": [
    {
      "type": "error",
      "text": "There is no verified pact between version s712-consumerVersion-g1723 of AConsumer and the latest version of AProvider (b123-providerVersion-901)"
    }
  ],
  "matrix": [
    {
      "consumer": {
        "name": "AConsumer",
        "version": {
          "number": "s712-consumerVersion-g1723"
        }
      },
      "provider": {
        "name": "AProvider",
        "version": null
      },
      "verificationResult": null
    }
  ]
}
Expected Response. I was hoping to receive a json that contains the provider version. Example
Copy code
{
  "summary": {
    "deployable": null,
    "reason": "There is no verified pact between version s712-consumerVersion-g1723 of AConsumer and the latest version of AProvider (b123-providerVersion-901)",
    "success": 0,
    "failed": 0,
    "unknown": 1
  },
  "notices": [
    {
      "type": "error",
      "text": "There is no verified pact between version s712-consumerVersion-g1723 of AConsumer and the latest version of AProvider (b123-providerVersion-901)"
    }
  ],
  "matrix": [
    {
      "consumer": {
        "name": "AConsumer",
        "version": {
          "number": "s712-consumerVersion-g1723"
        }
      },
      "provider": {
        "name": "AProvider",
        "version": "b123-providerVersion-901"
      },
      "verificationResult": null
    }
  ]
}
Why this would be useful We would like to use the ouput of this command to determine the version of the Provider in a specific environment. It's probably not the best place to look at but it feels correct to return the version of the provider deployed in that environment considering that is part of the error message. Let me know if you need anything else, I am happy to open a Pull request if this makes sense! pact-foundation/pact_broker
➕ 1