moby / moby/buildkit

llb: move selector to input

Open
#300 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
10.3k
Forks
1.5k
Avg merge
1d 23h
Merged PRs (30d)
48

Description

Selector specifies a subdirectory used for the mount in execop. While working on solver-next it has occurred to me that this isn't ideal as it makes it impossible to determine execution path without any execop specific functionality, even though inputs are defined for a generic op. There can be 2 mounts from the same input with different selectors so actually they are different and may be coming completely different cache.

One way to solve it would be to move a selector to the input field of generic llb op. Atm I don't think Edge struct in generic solver needs to be updated. This is relatively clean code-wise but not so nice for LLB as current options are truly generic while a selector path implies that inputs map to a snapshot.

A quick and hacky way to solve the issue and postpone the problem is to just always make a new input in the client if a new mount is created with a different selector. Or we could just add an input for every mount and not deduplicate. But it means that the client knows about a limitation in the backend implementation.

I think the best solution could be to add a filter op and remove selectors completely. But this is a much bigger change.

@AkihiroSuda wdyt?

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 by reading the execop selector handling, the solver-next context, and the generic LLB input and Edge concepts named in the issue. Compare moving selectors to inputs with creating inputs per mount or adding a filter op. Done requires choosing and implementing one design consistently across the client and backend, with validation for mounts that use different selectors.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, build-system
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
18/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.