github.com/tilt-dev/tilt@v0.33.15-0.20240515162809-0a22ed45d8a0/internal/cli/Tiltfile.starter (about) 1 # Welcome to Tilt! 2 # To get you started as quickly as possible, we have created a 3 # starter Tiltfile for you. 4 # 5 # Uncomment, modify, and delete any commands as needed for your 6 # project's configuration. 7 8 9 # Output diagnostic messages 10 # You can print log messages, warnings, and fatal errors, which will 11 # appear in the (Tiltfile) resource in the web UI. Tiltfiles support 12 # multiline strings and common string operations such as formatting. 13 # 14 # More info: https://docs.tilt.dev/api.html#api.warn 15 print(""" 16 ----------------------------------------------------------------- 17 ✨ Hello Tilt! This appears in the (Tiltfile) pane whenever Tilt 18 evaluates this file. 19 ----------------------------------------------------------------- 20 """.strip()) 21 warn('ℹ️ Open {tiltfile_path} in your favorite editor to get started.'.format( 22 tiltfile_path=config.main_path)) 23 24 25 # Build Docker image 26 # Tilt will automatically associate image builds with the resource(s) 27 # that reference them (e.g. via Kubernetes or Docker Compose YAML). 28 # 29 # More info: https://docs.tilt.dev/api.html#api.docker_build 30 # 31 # docker_build('registry.example.com/my-image', 32 # context='.', 33 # # (Optional) Use a custom Dockerfile path 34 # dockerfile='./deploy/app.dockerfile', 35 # # (Optional) Filter the paths used in the build 36 # only=['./app'], 37 # # (Recommended) Updating a running container in-place 38 # # https://docs.tilt.dev/live_update_reference.html 39 # live_update=[ 40 # # Sync files from host to container 41 # sync('./app', '/src/'), 42 # # Execute commands inside the container when certain 43 # # paths change 44 # run('/src/codegen.sh', trigger=['./app/api']) 45 # ] 46 # ) 47 48 49 # Apply Kubernetes manifests 50 # Tilt will build & push any necessary images, re-deploying your 51 # resources as they change. 52 # 53 # More info: https://docs.tilt.dev/api.html#api.k8s_yaml 54 # 55 # k8s_yaml(['k8s/deployment.yaml', 'k8s/service.yaml']) 56 57 58 # Customize a Kubernetes resource 59 # By default, Kubernetes resource names are automatically assigned 60 # based on objects in the YAML manifests, e.g. Deployment name. 61 # 62 # Tilt strives for sane defaults, so calling k8s_resource is 63 # optional, and you only need to pass the arguments you want to 64 # override. 65 # 66 # More info: https://docs.tilt.dev/api.html#api.k8s_resource 67 # 68 # k8s_resource('my-deployment', 69 # # map one or more local ports to ports on your Pod 70 # port_forwards=['5000:8080'], 71 # # change whether the resource is started by default 72 # auto_init=False, 73 # # control whether the resource automatically updates 74 # trigger_mode=TRIGGER_MODE_MANUAL 75 # ) 76 77 78 # Run local commands 79 # Local commands can be helpful for one-time tasks like installing 80 # project prerequisites. They can also manage long-lived processes 81 # for non-containerized services or dependencies. 82 # 83 # More info: https://docs.tilt.dev/local_resource.html 84 # 85 # local_resource('install-helm', 86 # cmd='which helm > /dev/null || brew install helm', 87 # # `cmd_bat`, when present, is used instead of `cmd` on Windows. 88 # cmd_bat=[ 89 # 'powershell.exe', 90 # '-Noninteractive', 91 # '-Command', 92 # '& {if (!(Get-Command helm -ErrorAction SilentlyContinue)) {scoop install helm}}' 93 # ] 94 # ) 95 96 97 # Extensions are open-source, pre-packaged functions that extend Tilt 98 # 99 # More info: https://github.com/tilt-dev/tilt-extensions 100 # 101 load('ext://git_resource', 'git_checkout') 102 103 104 # Organize logic into functions 105 # Tiltfiles are written in Starlark, a Python-inspired language, so 106 # you can use functions, conditionals, loops, and more. 107 # 108 # More info: https://docs.tilt.dev/tiltfile_concepts.html 109 # 110 def tilt_demo(): 111 # Tilt provides many useful portable built-ins 112 # https://docs.tilt.dev/api.html#modules.os.path.exists 113 if os.path.exists('tilt-avatars/Tiltfile'): 114 # It's possible to load other Tiltfiles to further organize 115 # your logic in large projects 116 # https://docs.tilt.dev/multiple_repos.html 117 load_dynamic('tilt-avatars/Tiltfile') 118 watch_file('tilt-avatars/Tiltfile') 119 git_checkout('https://github.com/tilt-dev/tilt-avatars.git', 120 checkout_dir='tilt-avatars') 121 122 123 # Edit your Tiltfile without restarting Tilt 124 # While running `tilt up`, Tilt watches the Tiltfile on disk and 125 # automatically re-evaluates it on change. 126 # 127 # To see it in action, try uncommenting the following line with 128 # Tilt running. 129 # tilt_demo()