tilt icon indicating copy to clipboard operation
tilt copied to clipboard

qq: Is it possible to globally set trigger_mode for a service?

Open rdvoskin-oneapp opened this issue 8 months ago • 1 comments

Summary

We have nested Tiltfiles and nested docker-compose files, and I'd like to globally set the trigger_mode per service without having to call dc_resource in each "leaf" Tiltfile for each service. Is that currently possible?

Details

File structure:

./platform/
        ./docker-compose-infra.yml <-- has platform services, like platform-serviceA, platform-serviceB, etc
        ./Tiltfile <--does NOT load docker-compose-infra.yml, only has custom commands
./services/serviceA
        ./docker-compose.yml <-- has product services, like product-serviceA
        ./Tiltfile <-- Is used by product teams to load platform  services and their own product services

In./services/serviceA/Tiltfile:

load('../platform/Tiltfile',  'some_custom_command')
docker-compose('../platform/docker-compose-infra.yml')
docker-compose('./docker-compose.yml')
some_custom_command()

I know I can call dc_resource('platform-serviceA, trigger_mode = TRIGGER_MODE_MANUAL, auto_init = True) but is there a way to globally set the trigger_mode for a specific service so that I dont need to call dc_resource in every product Tiltfile? Otherwise, every product team's Tiltfile needs to call dc_resource for platform service to turn off trigger_mode auto.

rdvoskin-oneapp avatar Apr 14 '25 17:04 rdvoskin-oneapp

Not sure I understand the question. The way we usually see people do this is they define a helper function like

def my_company_common():
  docker-compose('../platform/docker-compose-infra.yml')
  dc_resource('platform-serviceA', trigger_mode = TRIGGER_MODE_MANUAL, auto_init = True)

Does that help?

This guide has some tips - https://docs.tilt.dev/multiple_repos.html

nicks avatar Apr 19 '25 03:04 nicks