Hey. Hopefully a quick question. When implementing...
# general
j
Hey. Hopefully a quick question. When implementing bi-directional contract testing for the provider side, I have an OpenAPI spec that is generated by/based on the API code. According to this video I can skip the verify provider contract step:

https://youtu.be/9qZN7wHEQ1U?list=PLwy9Bnco-IpfddOl7vk7xfmGSjMMCiSbi&t=347

and just publish the OpenAPI spec to PactFlow. I wanted to do this using the GitHub action but the verification-results input is mandatory: https://github.com/pactflow/actions/blob/main/publish-provider-contract/action.yml Is that input supposed to be mandatory? Is the video incorrect and we always need to perform provider verification tests when publishing (via any route, cli/github action/etc.)?
y
you always have to provide verification results but it can be an empty text file. i tend to just supply the OAD twice, as the spec and the verification results, if I am working that flow
j
Ah OK. Yeah, I will try sending the spec twice then and leave a comment in the pipeline with reasoning. Thanks mate!
y
the intention is for it to be mandatory, and a provider contract in our terminology is two part. ( spec + evidence ) and a verification result denotes whether that spec was correctly validated ideally backed up by the evidence ( verification results ) the veri results themselves ( the file ) is used for informative purposes only in the pactflow broker
pleasure Jack
j
Excellent, thanks for the explanation!
Hey, I have another question about the github action - are you expecting the branch input to work? I have the following step in my pipeline that sets the branch name as both the
branch
and the
tag
Copy code
- name: Publish OpenAPI spec to PactFlow
      uses: pactflow/actions/publish-provider-contract@v2
      with:
        broker_url: ${{ env.PACT_BROKER_BASE_URL }}
        token: ${{ secrets.PACT_BROKER_TOKEN }}
        application_name: ${{ env.PACTICIPANT_NAME }}
        version: ${{ env.VERSION }}
        branch: ${{ env.BRANCH_NAME }}
        contract: ./contract.yaml
        verification_results: ./contract.yaml
        verifier: "Verification not necessary when the OpenAPI spec is generated by the API code"
        tag: ${{ env.VERSION }}, ${{ env.BRANCH_NAME }}
The result in PactFlow is in the screenshot. The tag is set, but the branch is not.
y
Oooh good spot. can you change the tag from
v2
to
fix/provider_contract_branch
https://github.com/pactflow/actions/pull/51/files looks like I was setting
env.branch
but using
env.BRANCH
in the command
j
Nice! Thanks for that, Yousaf!