question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OPAL cannot clone non-base branch on private repo

See original GitHub issue

reported by Jake on slack: https://opal-access.slack.com/archives/C01RUUYV3TP/p1634067725023100

config:

      - OPAL_POLICY_REPO_MAIN_BRANCH=dev
      - OPAL_POLICY_REPO_MAIN_REMOTE=origin
      - OPAL_POLICY_REPO_SSH_KEY=${OPAL_POLICY_REPO_SSH_KEY}

stack trace:

opal_server_1        | 2021-10-12T19:40:53.555089+0000 |opal_common.git.branch_tracker          |ERROR  | did not find main branch: 'IterableList' object has no attribute 'dev', instead found: [{'name': 'main', 'path': 'refs/heads/main'}]
opal_server_1        | Traceback (most recent call last):
opal_server_1        | 
opal_server_1        |   File "/root/.local/bin/gunicorn", line 8, in <module>
opal_server_1        |     sys.exit(run())
opal_server_1        |     β”‚   β”‚    β”” <function run at 0x7f275202b3a0>
opal_server_1        |     β”‚   β”” <built-in function exit>
opal_server_1        |     β”” <module 'sys' (built-in)>
opal_server_1        |   File "/root/.local/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 67, in run
opal_server_1        |     WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
opal_server_1        |     β”” <class 'gunicorn.app.wsgiapp.WSGIApplication'>
opal_server_1        |   File "/root/.local/lib/python3.8/site-packages/gunicorn/app/base.py", line 231, in run
opal_server_1        |     super().run()
opal_server_1        |   File "/root/.local/lib/python3.8/site-packages/gunicorn/app/base.py", line 72, in run
opal_server_1        |     Arbiter(self).run()
opal_server_1        |     β”‚       β”” <gunicorn.app.wsgiapp.WSGIApplication object at 0x7f27520368b0>
opal_server_1        |     β”” <class 'gunicorn.arbiter.Arbiter'>
opal_server_1        |   File "/root/.local/lib/python3.8/site-packages/gunicorn/arbiter.py", line 202, in run
opal_server_1        |     self.manage_workers()
opal_server_1        |     β”‚    β”” <function Arbiter.manage_workers at 0x7f2751978ee0>
opal_server_1        |     β”” <gunicorn.arbiter.Arbiter object at 0x7f2752036190>
opal_server_1        |   File "/root/.local/lib/python3.8/site-packages/gunicorn/arbiter.py", line 551, in manage_workers
opal_server_1        |     self.spawn_workers()
opal_server_1        |     β”‚    β”” <function Arbiter.spawn_workers at 0x7f2751979040>
opal_server_1        |     β”” <gunicorn.arbiter.Arbiter object at 0x7f2752036190>
opal_server_1        |   File "/root/.local/lib/python3.8/site-packages/gunicorn/arbiter.py", line 622, in spawn_workers
opal_server_1        |     self.spawn_worker()
opal_server_1        |     β”‚    β”” <function Arbiter.spawn_worker at 0x7f2751978f70>
opal_server_1        |     β”” <gunicorn.arbiter.Arbiter object at 0x7f2752036190>
opal_server_1        |   File "/root/.local/lib/python3.8/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
opal_server_1        |     worker.init_process()
opal_server_1        |     β”‚      β”” <function UvicornWorker.init_process at 0x7f2750f07940>
opal_server_1        |     β”” <uvicorn.workers.UvicornWorker object at 0x7f27511b4a30>
opal_server_1        |   File "/root/.local/lib/python3.8/site-packages/uvicorn/workers.py", line 64, in init_process
opal_server_1        |     super(UvicornWorker, self).init_process()
opal_server_1        |           β”‚              β”” <uvicorn.workers.UvicornWorker object at 0x7f27511b4a30>
opal_server_1        |           β”” <class 'uvicorn.workers.UvicornWorker'>
opal_server_1        |   File "/root/.local/lib/python3.8/site-packages/gunicorn/workers/base.py", line 142, in init_process
opal_server_1        |     self.run()
opal_server_1        |     β”‚    β”” <function UvicornWorker.run at 0x7f2750f07a60>
opal_server_1        |     β”” <uvicorn.workers.UvicornWorker object at 0x7f27511b4a30>
opal_server_1        |   File "/root/.local/lib/python3.8/site-packages/uvicorn/workers.py", line 77, in run
opal_server_1        |     loop.run_until_complete(server.serve(sockets=self.sockets))
opal_server_1        |     β”‚    β”‚                  β”‚      β”‚             β”‚    β”” [<gunicorn.sock.TCPSocket object at 0x7f275114d340>]
opal_server_1        |     β”‚    β”‚                  β”‚      β”‚             β”” <uvicorn.workers.UvicornWorker object at 0x7f27511b4a30>
opal_server_1        |     β”‚    β”‚                  β”‚      β”” <function Server.serve at 0x7f275129b940>
opal_server_1        |     β”‚    β”‚                  β”” <uvicorn.server.Server object at 0x7f2750f030d0>
opal_server_1        |     β”‚    β”” <method 'run_until_complete' of 'uvloop.loop.Loop' objects>
opal_server_1        |     β”” <uvloop.Loop running=True closed=False debug=False>
opal_server_1        | 
opal_server_1        |   File "/opal_common/git/repo_watcher.py", line 68, in run
opal_server_1        |     self._tracker = BranchTracker(
opal_server_1        |     β”‚    β”‚          β”” <class 'opal_common.git.branch_tracker.BranchTracker'>
opal_server_1        |     β”‚    β”” None
opal_server_1        |     β”” <opal_common.git.repo_watcher.RepoWatcher object at 0x7f274fe42bb0>
opal_server_1        | 
opal_server_1        |   File "/opal_common/git/branch_tracker.py", line 42, in __init__
opal_server_1        |     self._save_latest_commit_as_prev_commit()
opal_server_1        |     β”‚    β”” <function BranchTracker._save_latest_commit_as_prev_commit at 0x7f274fe2b790>
opal_server_1        |     β”” <opal_common.git.branch_tracker.BranchTracker object at 0x7f274fbf2400>
opal_server_1        | 
opal_server_1        |   File "/opal_common/git/branch_tracker.py", line 82, in _save_latest_commit_as_prev_commit
opal_server_1        |     self._prev_commit = self.latest_commit
opal_server_1        |     β”‚                   β”‚    β”” <property object at 0x7f274fe37360>
opal_server_1        |     β”‚                   β”” <opal_common.git.branch_tracker.BranchTracker object at 0x7f274fbf2400>
opal_server_1        |     β”” <opal_common.git.branch_tracker.BranchTracker object at 0x7f274fbf2400>
opal_server_1        | 
opal_server_1        |   File "/opal_common/git/branch_tracker.py", line 89, in latest_commit
opal_server_1        |     return self.tracked_branch.commit
opal_server_1        |            β”‚    β”” <property object at 0x7f274fe377c0>
opal_server_1        |            β”” <opal_common.git.branch_tracker.BranchTracker object at 0x7f274fbf2400>
opal_server_1        | 
opal_server_1        | > File "/opal_common/git/branch_tracker.py", line 105, in tracked_branch
opal_server_1        |     return getattr(self._repo.heads, self._branch_name)
opal_server_1        |                    β”‚    β”‚     β”‚      β”‚    β”” 'dev'
opal_server_1        |                    β”‚    β”‚     β”‚      β”” <opal_common.git.branch_tracker.BranchTracker object at 0x7f274fbf2400>
opal_server_1        |                    β”‚    β”‚     β”” <property object at 0x7f274feae2c0>
opal_server_1        |                    β”‚    β”” <git.repo.base.Repo '/regoclone/.git'>
opal_server_1        |                    β”” <opal_common.git.branch_tracker.BranchTracker object at 0x7f274fbf2400>
opal_server_1        | 
opal_server_1        |   File "/root/.local/lib/python3.8/site-packages/git/util.py", line 972, in __getattr__
opal_server_1        |     return list.__getattribute__(self, attr)
opal_server_1        |                                  β”‚     β”” 'dev'
opal_server_1        |                                  β”” [<git.Head "refs/heads/main">]
opal_server_1        | 
opal_server_1        | AttributeError: 'IterableList' object has no attribute 'dev'

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
rocioarcommented, Oct 26, 2021

@asafc @orweis upgrading to the latest version 0.1.16 fixed the issue for me.

2reactions
rocioarcommented, Oct 26, 2021

I’m having the same issue. I wonder if it’s related to how the repo is cloned. I think you might need to clone using the no_single_branch=True argument, or use fetch to checkout non-default branches.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cloning and Pushing a Branch into a Private repo - git
Expectation is to be able to push to a private repo that I am able to clone, but unable to push a branch...
Read more >
Troubleshooting cloning errors - GitHub Docs
This error occurs if the default branch of a repository has been deleted on GitHub.com. Detecting this error is simple; Git will warn...
Read more >
Git Clone Branch – How to Clone a Specific Branch
This repository is stored on a web-based hosting service for version control, like GitHub. You can then clone this repository to your local ......
Read more >
How To Clone a Git Repository - devconnected
You can check the current branch cloned by running the β€œgit branch” command. $ git branch * master. However, in some cases, you...
Read more >
Fix Git's 'fatal: repository not found' error quickly | TheServerSide
Here are five ways to fix that problem and successfully clone, ... is part of the Essential Guide: Master Git basics and branch...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found