Hello Team I am using golang. Consumer has publish...
# general
r
Hello Team I am using golang. Consumer has published the contract and with branch name as master. However for provider verification, in consumer selector when I use MainBranch:true, it doesn't fetch any contract. Only when I change the parameter in selector as Branch: "master" it fetches the contract. I want to use MainBranch as true to fetch this for any consumer, where it is wrong?
m
Can you please confirm what the Pact Broker thinks the main branch is for that application?
curl -H"Authorization: [...]" [host]/pacticipants/:pacticipant jq .mainBranch
r
ok
m
Are you using PactFlow or the Pact Broker?
r
pactflow
m
cool, you can do it via the UI this way
r
Copy code
"mainBranch": "main"
So we need to configure this for consumer explicitly? I read in documentation that either main, master or develop anything will work by default
m
you can update the main branch using the CLI:
Copy code
pact-broker help create-or-update-pacticipant                                                                                                                                                                     <aws:pactflow-dev-admin>
Usage:
  pact-broker create-or-update-pacticipant --name=NAME -b, --broker-base-url=BROKER_BASE_URL

Options:
      --name=NAME                                    # Pacticipant name
      [--display-name=DISPLAY_NAME]                  # Display name
      [--main-branch=MAIN_BRANCH]                    # The main development branch of the pacticipant repository
      [--repository-url=REPOSITORY_URL]              # The repository URL of the pacticipant
  -o, [--output=OUTPUT]                              # json or text
                                                     # Default: text
  -b, --broker-base-url=BROKER_BASE_URL              # The base URL of the Pact Broker
  -u, [--broker-username=BROKER_USERNAME]            # Pact Broker basic auth username
  -p, [--broker-password=BROKER_PASSWORD]            # Pact Broker basic auth password
  -k, [--broker-token=BROKER_TOKEN]                  # Pact Broker bearer token
  -v, [--verbose], [--no-verbose], [--skip-verbose]  # Verbose output.
                                                     # Default: false

Create or update pacticipant by name
I believe it gets detected on first publish, and uses the branch associated with that
is it possible the first publish didn’t have a branch?
r
may be it didn't have. But for provider side, it should still fetch either main/master/develop? Is my understanding not correct here?
m
no, it only fetches the main branch - which is that property set on the application
if the main branch property changes on the application, the pacts that get fetched by the provider will adjust accordingly
r
ok