Hi, I am trying to publish the consumer contract ...
# pactflow
p
Hi, I am trying to publish the consumer contract to pactflow instance, here's the code I use. First time with the same token it is successful but subsequent attempts to publish results in this error.
Copy code
-> "Forbidden. Either you are using a read only token for a request that requires a write token (the most likely cause), or you do not have the required permissions.\n"
read 162 bytes
Conn keep-alive
Forbidden. Either you are using a read only token for a request that requires a write token (the most likely cause), or you do not have the required permissions.
Copy code
publish-pact:
  stage: publish_pact
  image: pactfoundation/pact-cli:latest
  needs:
    - build-and-test
  script:
    - echo "Publishing consumer pacts to Pact Broker"
    - >-
      pact-broker publish target/pacts
      --broker-base-url="${PACTFLOW_HOST_URL}"
      --broker-token="${PACTFLOW_IAM_READ_WRITE_TOKEN}"
      --consumer-app-version="${CI_COMMIT_SHA}"
      --branch="${CI_COMMIT_BRANCH}"
      --merge
      --verbose
  artifacts:
    when: always
  rules:
    - if: $CI_COMMIT_BRANCH
m
What roles / permissions does it have?
p
CI/CD role
And as I said, it was able to publish once and subsequent publish are failing
m
And chance you could please share logs of both calls with
--verbose
enabled?
It might be the --merge call. What are you trying to do there?
p
merge was something I added to test if it fixes, it’s the same issue without. I have sent you the log of publish in non working case. For working case I have it without since I couldn’t make it work without.