https://prefect.io logo
a

Anurag Bajpai

01/20/2022, 9:15 AM
Hi, we're running into some issues using Bitbucket cloud storage with a branch ref (as opposed to a specific commit ref). It looks like the
client.get(f"repositories/{self.workspace}/{self.repo}/refs/branches")
call to get the list of branches actually returns a paginated list, and the method is not able to find the hash corresponding to the branch if the branch is not included in the first page. Additionally, the error raised in case the branch is not found is not formatted properly (it's a string instead of an f-string).
a

Anna Geller

01/20/2022, 10:45 AM
Hi, thanks for raising this. Would you be willing to open a GitHub issue and discuss this in more detail? What error is raised? Can you share the output of the "prefect diagnostics" command? It could be some API change bound to a specific bitbucket version, it would be great if you could share your bitbucket version to reproduce Can you also share how you defined storage in your flow when you saw that error? This can also be helpful to reproduce
a

Anurag Bajpai

01/20/2022, 11:23 AM
• The error raised is:
Copy code
Failed to load and execute Flow's environment: ValueError("ref {ref!r} not found in '{self.workspace}/{self.repo}'",)
• Output of
prefect diagnostics
:
Copy code
{
  "config_overrides": {},
  "env_vars": [
    "PREFECT__SERVER__HOST",
    "PREFECT__SERVER__PORT",
    "PREFECT__BACKEND"
  ],
  "system_information": {
    "platform": "Linux-4.14.248-189.473.amzn2.x86_64-x86_64-with-Ubuntu-18.04-bionic",
    "prefect_backend": "server",
    "prefect_version": "0.15.4",
    "python_version": "3.6.8"
  }
}
• Bitbucket cloud should always be the latest version I think? The
atlassian-python-api
module is v 3.12.1 • The flow storage is defined as:
Copy code
Bitbucket(workspace=workspace, project=project, repo=repo, ref='master', path=path, cloud_username_secret='BITBUCKET_USERNAME', cloud_app_password_secret='BITBUCKET_PASSWORD')
a

Anna Geller

01/20/2022, 11:41 AM
Thanks for providing more info! If you want to refer to the master branch, you can actually skip the definition of “ref” since it’s the default. Can you try without providing the ref explicitly (it should then default to the main branch of the repo)? Are you sure your repo has a branch called “master”? perhaps its name is “main”? The error entails that this workspace/repo doesn’t have a branch with that name.
@Anurag Bajpai for now I created an issue about the formatting of the error message, if the ref or pagination turns out to be a bug, we can create a linked issue as well https://github.com/PrefectHQ/prefect/issues/5339
a

Anurag Bajpai

01/20/2022, 12:01 PM
At first we were using this without providing the 'ref' parameter. We only added
ref='master'
once it started failing. In both cases, sometimes it works, sometimes not, depending on whether the master branch is included in the first page or not.
a

Anna Geller

01/20/2022, 12:15 PM
ok, I created a separate issue. Thanks for raising this!
👍 1
3 Views