tilt-dev / tilt-dev/tilt

Tilt does not support incremental builds

Open
#6,332 0 comments 3 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

Expected Behavior

I'd expect Tilt to allow incremental builds (see "About Your Use Case") same as the docker build CLI:

Build command:

docker build --tag docker.example.com/project/image:latest .

Self-referencing dockerfile:

...
COPY --from=docker.example.com/project/image:latest /lib /lib
...
Current Behavior

The docker build CLI does not have an issue with the self-referencing dockerfile. It just pulls the latest version of the image the COPY command requires from the CI's registry and then starts the build.

However, when using docker_build() in Tilt I get an error:

getting image build info for service: Image dependency cycle: docker.example.com/project/image:latest
Steps to Reproduce

(The cycle detection looks like a consciously integrated and unit tested feature, hence I believe it is clear how to reproduce it. If not, please let me know!)

Context
tilt doctor Output
$ tilt doctor
Tilt: v0.33.11, built 2024-02-15
System: linux-amd64
---
Docker (cluster)
- Host: tcp://192.168.49.2:2376
- Server Version: 24.0.7
- API Version: 1.43
- Builder: 2
---
Docker (local)
- Host: unix:///var/run/docker.sock
- Server Version: 25.0.3
- Version: 1.44
- Builder: 2
- Compose Version: v2.24.6
---
Kubernetes
- Env: minikube
- Context: minikube
- Cluster Name: minikube
- Namespace: default
- Container Runtime: docker
- Version: v1.28.3
- Cluster Local Registry: none
---
Thanks for seeing the Tilt Doctor!
Please send the info above when filing bug reports. 💗

The info below helps us understand how you're using Tilt so we can improve,
but is not required to ask for help.
---
Analytics Settings
--> (These results reflect your personal opt in/out status and may be overridden by an `analytics_settings` call in your Tiltfile)
- User Mode: opt-in
- Machine: 39fbf492702fe92fd21f2f3f95e0c377
- Repo: ilwzMX3bpG4n/TVLO/2yHg==
...
About Your Use Case

We have a large C++ code base and plan to switch to container-based development & deployment using Kubernetes.

The idea is that our CI periodically creates a development docker image where all binaries are prebuilt. When building the next version of the image, the developer or the next CI job pulls the latest existing image from the CI's repository and just build the delta. This procedure seems to be common practice and is describe in the section "Building incrementally" from this blog.

Of course the image originally has to be bootstrapped in the CI. But now as the image exists, both docker builds (local and CI) should pull the latest existing image from the CI's repository enabling incremental builds.

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

Start at Tilt's docker_build() handling and the unit-tested cycle detection that reports the self-referencing COPY as an image dependency cycle. Compare that behavior with Docker's CLI handling of the same Dockerfile; done means an existing registry image can seed the build without triggering a false dependency cycle.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker
Domain
build-system, devops
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.