Skip to content

Commit

Permalink
helm_remote: update directory crawling to be a bit more idiomatic (ti…
Browse files Browse the repository at this point in the history
…lt-dev#573)

pointed out in
tilt-dev#572

to be clear, i don't think this will actually
fix the bug reported there. it's likely a deeper
issue. but i agree that we shouldn't be hard-coding
'/' to terminate the loop

Signed-off-by: Nick Santos <[email protected]>
  • Loading branch information
nicks authored Apr 24, 2024
1 parent 027c37b commit eed5bf2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
10 changes: 6 additions & 4 deletions coreos_prometheus/Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
def _find_root_tiltfile_dir():
# Find top-level Tilt path
current = os.path.abspath('./')
while current != '/':
if os.path.exists(os.path.join(current, 'Tiltfile')):
while True:
if os.path.exists(os.path.join(current, 'tilt_modules')):
return current

current = os.path.dirname(current)
next_dir = os.path.dirname(current)
if next_dir == current:
fail('Could not find root Tiltfile')

fail('Could not find root Tiltfile')
current = next_dir

def _find_cache_dir():
cachedir = os.getenv('TILT_CACHE_DIR', '')
Expand Down
8 changes: 5 additions & 3 deletions git_resource/Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
def _find_root_tiltfile_dir():
# Find top-level Tilt path
current = os.path.abspath('./')
while current != '/':
while True:
if os.path.exists(os.path.join(current, 'tilt_modules')):
return current

current = os.path.dirname(current)
next_dir = os.path.dirname(current)
if next_dir == current:
fail('Could not find root Tiltfile')

fail('Could not find root Tiltfile')
current = next_dir

def _find_checkout_dir():
from_env = os.getenv('TILT_GIT_RESOURCE_CHECKOUT_DIR', '')
Expand Down
8 changes: 5 additions & 3 deletions helm_remote/Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ if _get_skip() == None:
def _find_root_tiltfile_dir():
# Find top-level Tilt path
current = os.path.abspath('./')
while current != '/':
while True:
if os.path.exists(os.path.join(current, 'tilt_modules')):
return current

current = os.path.dirname(current)
next_dir = os.path.dirname(current)
if next_dir == current:
fail('Could not find root Tiltfile')

fail('Could not find root Tiltfile')
current = next_dir

def _find_cache_dir():
from_env = os.getenv('TILT_HELM_REMOTE_CACHE_DIR', '')
Expand Down

0 comments on commit eed5bf2

Please sign in to comment.