#Buildkit resources

1 messages Ā· Page 1 of 1 (latest)

royal wigeon
#

Turning on the CrazyMax signal šŸ™‚ @plush compass

#

There is an architecture diagram somewhere, but I can never find it

limpid sequoia
#

that's me. just less hair.

royal wigeon
#

@faint cedar not sure if you still watch this channel… But if you do we would welcome any suggestions šŸ™‚

limpid sequoia
#

The build cache can even be exported to a registry, where it can be pulled on-demand by subsequent invocations on any host.
🤯
have we explored that yet?

royal wigeon
#

Yes šŸ™‚ It has drawbacks, but current plan is to rely on that for CI embedding

#

They have a cache exporter that works specifically with Github Action’s persistent storage API

#

cc @lapis yarrow @plush compass

royal wigeon
#

(Main drawbacks are that exporting is an additional action in the DAG, and can’t be parallelized, so it adds to the total run time. And some remote cache exporters don’t support ā€œmax modeā€, meaning they don’t actually cache everything. This can result in only caching results from the last run, greatly reducing utility of the cache.)

plush compass
timid gust
#

I was gonna try to find some resources around Buildkit. Thanks for pulling these together!

royal wigeon
#

A thought just occured to me: does Cue support native Protobuf import? šŸ˜„ cc @timid gust

timid gust
#

@royal wigeon Hmm.... I think so. Can't remember if that work is done, or just in progress.

timid gust
royal wigeon
#

Nice! So could I for example cue get github.com/moby/buildkit/solver/pb ?

#

Or cue import ?

timid gust
royal wigeon
#

Yeah it doesn’t really say how

royal wigeon
#

Ah cue import does mention proto support! Will try that

timid gust
#

Nice!

royal wigeon
#

@timid gust it seems to be OK with the proto file, but failing on import (the proto file has dependencies on other proto files)

#

Dropping for now, I don’t really need it for my proof of concept. Copy-pasting bits and pieces is fine for my immediate purpose.

timid gust
#

@royal wigeon šŸ‘ -I, --proto_path stringArray paths in which to search for imports

royal wigeon
#

TIL, buildkit LLB does not define distinct operations for loading a local directory, remote docker image or remote git ref. It’s all OpSource with a URI-formatted identifier. Supported URL schemes are local://, docker-image://, git://, https://

timid gust
#

Interesting.

royal wigeon
#

Top-level op:

// Op represents a vertex of the LLB DAG.
message Op {
    // inputs is a set of input edges.
    repeated Input inputs = 1;
    oneof op {
        ExecOp exec = 2;
        SourceOp source = 3;
        FileOp file = 4;
        BuildOp build = 5;
    }
    Platform platform = 10;
    WorkerConstraints constraints = 11;
}

Source op:


// SourceOp specifies a source such as build contexts and images.
message SourceOp {
    // TODO: use source type or any type instead of URL protocol.
    // identifier e.g. local://, docker-image://, git://, https://...
    string identifier = 1;
    // attrs are defined in attr.go
    map<string, string> attrs = 2;
}
#

Note this doesn’t map 1-1 to the corresponding Go API

#

Which I am more familiar with

#

For example here’s the llb.Git() call which is roughly equivalent to our op.#FetchGit. You can see how it maps git-specific parameters do the more generic llb ā€œsourceā€ op: https://github.com/moby/buildkit/blob/be8ab28a0ab1f7eafa4c551a86d5aafaed7c99c2/client/llb/source.go#L210-L287

GitHub

concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit - buildkit/source.go at be8ab28a0ab1f7eafa4c551a86d5aafaed7c99c2 Ā· moby/buildkit

#

I’m wondering if we should target the Go API, or underlying LLB format, in our CUE bindings? cc @plush compass @faint cedar @flat nacelle

#

I guess the LLB format is more stable by necessity… But some aspects of the proto API seem awkward, with the Go API hiding some of the awkwardness… For example llb.Git() takes a remote which can be eg. ssh:// or https://. But SourceOp must prefix all git remotes with git:// so how where does the information go about the original scheme? The answer seems to be ā€œdon’t look to closelyā€ šŸ˜‰