Skip to content

Commit

Permalink
Fix titlfile on linux
Browse files Browse the repository at this point in the history
Signed-off-by: Danil-Grigorev <danil.grigorev@suse.com>
  • Loading branch information
Danil-Grigorev committed Sep 25, 2024
1 parent 8a64dbd commit 2cd588b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 6 additions & 1 deletion tilt/io/Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ def dir_create(path):
"""
local("mkdir -p {}".format(path),echo_off=True,quiet=True)

def prepare_file(path):
"""Prepare file for writing"""

local("echo '' > {}".format(path))

def file_write(path, contents):
"""Write contents to a file
Expand All @@ -17,7 +22,7 @@ def file_write(path, contents):
contents: The contents of the file
"""
local('echo "$CONTENTS" > {}'.format(path),
local('echo "$CONTENTS" >> {}'.format(path),
env={'CONTENTS': str(contents)},
echo_off=True,
quiet=True)
Expand Down
6 changes: 4 additions & 2 deletions tilt/project/Tiltfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- mode: Python -*-

load("../k8s/Tiltfile", "k8s_find_object_name")
load("../io/Tiltfile", "info", "file_write", "dir_create")
load("../io/Tiltfile", "info", "file_write", "dir_create", "prepare_file")

def project_enable(name, project, debug):
"""Enable a project in Tilt
Expand Down Expand Up @@ -70,7 +70,9 @@ def project_enable(name, project, debug):
yaml = kustomize(context + '/' + kustomize_dir)
yaml = update_manager(yaml, "manager", debug, env)
yaml_path = context + "/.tiltbuild/manifest.yaml"
file_write(yaml_path, yaml)
prepare_file(yaml_path)
for line in str(yaml).splitlines():
file_write(yaml_path, line)
k8s_yaml(yaml)

objs = decode_yaml_stream(yaml)
Expand Down

0 comments on commit 2cd588b

Please sign in to comment.