Hi Pact gurus, Currently we are working on BDCT a...
# pactflow
m
Hi Pact gurus, Currently we are working on BDCT and trying to publish our contract to Pactflow. I am using Docker commands but a bit confused with the doc examples and the command helper. What I am trying to do is to manually upload the contract to test the integrations on the CI pipeline, with the minimum command arguments and configurations. But I am getting the errors
Error making request to https://{PACTFLOW_HOST} status=400 {"errors":{"verificationResults.success":["success is missing"],"verificationResults.content":["content is missing"],"verificationResults.contentType":["contentType is missing"]}}
. So obviously, some of the params are mandatory that I missed, but the doc didn't clearly say which ones are and I am trying to figure it out. The followings are the references and the examples I am following, with my scripts
m
I’m not sure why it doesn’t complain about all of the fields that are required when not given. i.e.
Copy code
✗ pactflow publish-provider-contract
No value provided for required options '--provider', '--provider-app-version'
Should presumably list a bunch more items. There might be a good reason why the CLI doesn’t do that, I know it works within the framework of thor (the gem).
So one of these two is required:
Copy code
[--verification-success], [--no-verification-success]                    # Whether or not the self verification passed successfully.
      [--verification-exit-code=N]                                             # The exit code of the verification process. Can be used instead of --verification-success|--no-verification-success for a simpler build script.
👍 1
You should provide at least the following also:
Copy code
[--verification-results=VERIFICATION_RESULTS]                            # The path to the file containing the output from the verification process
      [--verification-results-content-type=VERIFICATION_RESULTS_CONTENT_TYPE]  # The content type of the verification output eg. text/plain, application/yaml
      [--verification-results-format=VERIFICATION_RESULTS_FORMAT]              # The format of the verification output eg. junit, text
      [--verifier=VERIFIER]                                                    # The tool used to verify the provider contract
m
Thanks Matt!
🙌 1
Just followed the above suggestions and I can see most of the errors are gone. But it still has one required field
verification-results-content
that I can't find from the doc. What's the expected value?
y
--verfication-results
which is the path to the file, that contains the content. The CLI tool will read in the file, and send that as the
content
you can see in the 2nd screenshot it is pointing to a verification results file, and then specifies the content type of the verification results file beneath it
m
Thanks @Yousaf Nabi (pactflow.io)
m
It’s just the mime type of the verification results. e.g.
text/plain
or
application/html
m
Is there a example of the
--verification-results
file? I'd like to see if I can skip it and just put some dummy text to pass my pipeline test
m
I think I sent you an example yesterday, let me check
Yep, here you go….
Copy code
echo 'generated by <program/process>' > results.txt
The set the flags:
Copy code
--verification-results=results.txt \
 --verification-results-content-type=text/plain \
 --verification-success \
 --verifier=<program/process>
[3:07 PM] The point of the verification results is to provide traceability to future team members to understand what level of confidence they should have in the contract itself. Given you’re just testing for now, anything is fine. There is no format for the results, it’s the output file from the process that does the verifying, and what makes sense to a user later on. I believe we render various content types in the PactFlow UI (e.g. Markdown) also.
🙌 1
y
you can just send the openapi spec as the verification results and a nice easy way (or just a text file with anything in it)
👍 1
m
Thanks both, really glad I've got the provider contract published via the CI pipeline now 😄
🎉 2
@Tom Dickman FYI
👋 1