tilt-dev / tilt-extensions

Extensions for Tilt
https://tilt.dev/
Apache License 2.0
200 stars 156 forks source link

(helm_resource): error when using multiple `image_deps` #551

Closed norman-zon closed 7 months ago

norman-zon commented 7 months ago

I have a helm chart where the image is set as part of a pod template like this (values.yaml):


runner-1:
  template:
    spec:
      containers:
      - name: runner
        image: my-org/runner:latest

runner-2:
  template:
    spec:
      containers:
      - name: runner
        image: my-org/runner:latest

When I use image_deps to replace the image for only the first occurence runner-1 it works as excpected:


helm_resource(
  'arc-runners',
  'chart/arc-runners',
  namespace='arc-runners',
  deps=['./chart/arc-runners'],
  image_deps=[
    'my-org/runner'
  ],
  image_keys=[
    'runner-1.template.spec.containers[0].image'
  ],
  flags=['--values=./chart/arc-runners/values.yaml'],
)

but when I try to replace both occurences Tilt fails:


  image_deps=[
    'my-org/runner',
    'my-org/runner'
  ],
  image_keys=[
    'runner-1.template.spec.containers[0].image',
    'runner-2.template.spec.containers[0].image'
  ],
STEP 3/3 — Deploying
     Running cmd: python3 /Users/ME/.local/share/tilt-dev/tilt_modules/github.com/tilt-dev/tilt-extensions/helm_resource/helm-apply-helper.py --values=./chart/arc-runners/values.yaml
     Traceback (most recent call last):
       File "/Users/me.local/share/tilt-dev/tilt_modules/github.com/tilt-dev/tilt-extensions/helm_resource/helm-apply-helper.py", line 24, in <module>
         image = os.environ['TILT_IMAGE_%s' % i]
                 ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
       File "<frozen os>", line 679, in __getitem__
     KeyError: 'TILT_IMAGE_1'

Build Failed: apply command exited with status 1
nicks commented 7 months ago

thanks for the report! i'm going to mark this as a duplicate of https://github.com/tilt-dev/tilt-extensions/issues/528