Hi, did you encounter such error when you try to r...
# pactflow
t
Hi, did you encounter such error when you try to record deployment in PactFlow?
Copy code
This version of Pactflow does not support recording deployments, or you do not have the required permission to read environments. Please upgrade to the latest version if using Pactflow On-Premises, and ensure the user has the environment read permission.
Record deployment works perfectly fine for my other repos but for one repo I have this error.
Tried to record deployment manually on my local machine, and it worked fine. But fails in ci/cd
I reproduced the error and this behaviour looks weird to me. For example, I have the following ci/cd set up in GitLab where I specify
PROVIDER_VERSION
in variables and then I pass this variable to the record deployment job:
Copy code
verify contracts:
  stage: validate
  extends: .pact-aws-cli-v1
  variables:
    PROVIDER_VERSION: $CI_COMMIT_SHA
  script:
    - >-
      pact-verifier
      --hostname="app"
      --broker-url="$PACT_FLOW_BASE_URL"
      --token="$PACT_FLOW_KEY"
      --loglevel="info"
      --provider-branch="$CI_COMMIT_REF_SLUG"
      --provider-version="$PROVIDER_VERSION"
      --provider-tags="$CI_COMMIT_REF_NAME"
      --consumer-version-tags="main"
      --provider-name=dummy-microservice-provider
      --publish



record deployment in pact:
  stage: record deployment
  extends: .pact-aws-cli-v1
  variables:
    ENVIRONMENT: $ENVIRONMENT
  script:
    - >-
      pact-broker record-deployment
      --pacticipant=dummy-microservice-provider
      --version="$PROVIDER_VERSION"
      --environment="$ENVIRONMENT"
      --broker-base-url="$PACT_FLOW_BASE_URL"
      --broker-token="$PACT_FLOW_KEY"
      --verbose
and in this case record deployment fails with the error above. If I provide
--version=$CI_COMMIT_SHA
in the
record deployment
job everything works. Why I can’t use
PROVIDER_VERSION
defined in variables? And an interesting thing, it works for
can-i-deploy
well, specifying PROVIDER_VERSION in global variables helped:
Copy code
variables:
  PROVIDER_VERSION: $CI_COMMIT_SHA
m
Is it solved now? Looks like it was a variable in your pipeline that was causing the issue? My guess is that error is showing up because that value was blank and the CLI couldn't find the right resource to call
t
Yes, the variable was causing the issue. I was confused because everything worked for can-I-deploy job. 🤷🏻‍♀️ And yes, it looks like it’s fixed now. I’ll be 100% sure in several hours 😄
😆 1
👍 1
m
haha thanks for confirming