tilt-dev / tilt-dev/tilt

k8s_yaml handles string yaml poorly

Open
#2,386 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Go
Stars
10.1k
Forks
413
Avg merge
1d 10h
Merged PRs (30d)
6

Description

repro:
make a 1-line tiltfile with k8s_yaml(str(local('kustomize build https://github.com/kubernetes-sigs/cluster-api//config/default?ref=v0.2.5')))
(Note this is a bad Tiltfile - the str should not be there. I wrote this while mistakenly thinking I needed to convert my blob to a string to pass it to k8s_yaml)

observed:
fsevent errors that screw up the terminal
image

expected:
not that

This is handled here.

Basically, absPathFromStarlarkValue happily converts this huge yaml string into an absolute path, and then we try to open it and set up watches on it, and then apparently fsevents generate terminal-destroying log messages when it get bad paths?

So maybe there are a couple things here:

  1. fsevents errors shouldn't garble the terminal
  2. We've talked about inferring string vs blob - it'd be nice to give a better error message here. (even ignoring #1, the log ends up being so much yaml that you can't see the start of the log, and then a "filename too long", and it's not super clear what happened)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the one-line Tiltfile, then inspect internal/tiltfile/k8s.go around the linked line and the absPathFromStarlarkValue path. Done means the malformed string no longer produces terminal-destroying filesystem errors and the resulting diagnostic makes the misuse clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.