Skip to content

core.#Start follow-ups and enhancements #2398

Closed as not planned
Closed as not planned

Description

@sipsma

Task List

Things we need to make core.#Start tasks basically useful:

Basic quick fixes:

Networking:

Cue:

Buildkit fixes:

And, once we have the above features, we can document:

Misc (not necessary for documentation but shouldn't lose track of):

  • Support for output in TTY mode (right now the logs are only visible in plain progress mode, as mentioned here)

In parallel, we should gather both current feedback and feedback on the updated features:

Latest Updates

  • Previously
    • Added the initial barebones implementation
    • Sent out PR for supporting graceful stops here
    • Wrote code for getting stdout/stderr of process plugged into our logging system. It is based on the graceful stop PR, so I am waiting to send it out, but branch is here
    • Merged graecful stop PR
  • Right Now
  • Next Steps
    • Fix the buildkit bug upstream
    • TBD based on conversation with team, but networking feature may be a good next follow-up.

Discussion

core.#Start and related tasks enables users to run ephemeral containers and "sidecar" services that assist the execution of other tasks in an action or provide interactive services to end users. Whereas a core.#Exec is used to run synchronous commands with cache-able outputs, such as building code or executing a test, a core.#Start has no FS output consumable by other tasks and is not cache-able. The tradeoff of those limitations is that it can be used in ways that are off-limits to core.#Exec due to non-determinism (such as interaction with the client or providing network services).

Example use cases:

  1. Running a database used by tests executing in other core.#Exec tasks.
  2. Development servers (i.e. a server for a web project built by dagger, accessible over the user's localhost)
  3. Interactive processes, such as debug shells or dev environments
  4. Running tracing daemons like Jaeger (both for user tasks and even Buildkit itself)

Issues

A few of the tasks are just basic usability concerns (graceful stops and stdout/stderr logging) or bug fixes upstream. The others are more involved and touch on more components.

Networking

Once a process has been started in a core.#Start, we need a way of actually interacting with it. Today, this is possible but far from ideal:

  1. The network can be used, but because all Buildkit containers are in the same host network namespace (at least in our default buildkitd, as mentioned here), it's easy for port contention to become a problem. Additionally, this requires just hardcoding ports and addresses on both the client and server, which is not very flexible and can be host-dependent.
  2. A unix socket can be shared over a cache mount. This is a bit of an abuse of a cache mount though and is quite delicate. For example, it doesn't work if one of the containers specifies always: true.

Users instead need the ability to easily expose network services between containers (conceptually similar to docker compose) and the ability to proxy connections from the dagger client to services in a core.#Start.

Cue

core.#Start is asynchronous, so it's quite important to be able to create dependencies on it having started before executing other tasks. E.g. a test that uses a database running in a core.#Start needs to be sure that the database has been started before running.

Right now, this can only be easily accomplished using tricks like the one here, which don't always work (that trick only works when creating a dependency between two core tasks).

Instead, users need the ability to flexibly create arbitrary dependencies between any cue structs.

Activity

  1. mircubed commented on May 13, 2022

    @mircubed
    Contributor

    @sipsma hi! I just assigned to you for tracking, but I will set up some time for us to go through this epic in detail

  2. sipsma commented on May 13, 2022

    @sipsma
    ContributorAuthor

    Sounds good, thanks @mircubed!

  3. shykes commented on Dec 21, 2022

    @shykes
    Contributor

    Closing since CUE APIs are frozen, and this design work continues in the GraphQL API now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions