2017-06-06 18:01:18 +00:00
|
|
|
syntax = "proto3";
|
|
|
|
|
2018-02-27 07:06:01 +00:00
|
|
|
// Package pb provides the protobuf definition of LLB: low-level builder instruction.
|
|
|
|
// LLB is DAG-structured; Op represents a vertex, and Definition represents a graph.
|
2017-06-06 18:01:18 +00:00
|
|
|
package pb;
|
|
|
|
|
2017-06-21 21:48:21 +00:00
|
|
|
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
|
|
|
|
2018-09-17 22:19:04 +00:00
|
|
|
option (gogoproto.stable_marshaler_all) = true;
|
|
|
|
|
2018-02-27 07:06:01 +00:00
|
|
|
// Op represents a vertex of the LLB DAG.
|
2017-06-06 18:01:18 +00:00
|
|
|
message Op {
|
2018-02-27 07:06:01 +00:00
|
|
|
// inputs is a set of input edges.
|
2017-06-09 01:16:19 +00:00
|
|
|
repeated Input inputs = 1;
|
2017-06-06 18:01:18 +00:00
|
|
|
oneof op {
|
|
|
|
ExecOp exec = 2;
|
|
|
|
SourceOp source = 3;
|
2019-01-23 21:05:59 +00:00
|
|
|
FileOp file = 4;
|
2017-07-21 17:58:24 +00:00
|
|
|
BuildOp build = 5;
|
2018-06-21 21:09:38 +00:00
|
|
|
}
|
|
|
|
Platform platform = 10;
|
|
|
|
WorkerConstraints constraints = 11;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Platform is github.com/opencontainers/image-spec/specs-go/v1.Platform
|
|
|
|
message Platform {
|
|
|
|
string Architecture = 1;
|
|
|
|
string OS = 2;
|
|
|
|
string Variant = 3;
|
|
|
|
string OSVersion = 4; // unused
|
|
|
|
repeated string OSFeatures = 5; // unused
|
2017-06-06 18:01:18 +00:00
|
|
|
}
|
|
|
|
|
2018-02-27 07:06:01 +00:00
|
|
|
// Input represents an input edge for an Op.
|
2017-06-09 01:16:19 +00:00
|
|
|
message Input {
|
2018-02-27 07:06:01 +00:00
|
|
|
// digest of the marshaled input Op
|
2017-06-21 21:48:21 +00:00
|
|
|
string digest = 1 [(gogoproto.customtype) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
|
2018-02-27 07:06:01 +00:00
|
|
|
// output index of the input Op
|
2017-07-21 17:58:24 +00:00
|
|
|
int64 index = 2 [(gogoproto.customtype) = "OutputIndex", (gogoproto.nullable) = false];
|
2017-06-09 01:16:19 +00:00
|
|
|
}
|
|
|
|
|
2018-02-27 07:06:01 +00:00
|
|
|
// ExecOp executes a command in a container.
|
2017-06-06 18:01:18 +00:00
|
|
|
message ExecOp {
|
|
|
|
Meta meta = 1;
|
|
|
|
repeated Mount mounts = 2;
|
2018-08-04 19:42:01 +00:00
|
|
|
NetMode network = 3;
|
2019-01-10 02:21:39 +00:00
|
|
|
SecurityMode security = 4;
|
2017-06-06 18:01:18 +00:00
|
|
|
}
|
|
|
|
|
2018-02-27 07:06:01 +00:00
|
|
|
// Meta is a set of arguments for ExecOp.
|
2017-10-02 04:59:34 +00:00
|
|
|
// Meta is unrelated to LLB metadata.
|
|
|
|
// FIXME: rename (ExecContext? ExecArgs?)
|
2017-06-06 18:01:18 +00:00
|
|
|
message Meta {
|
|
|
|
repeated string args = 1;
|
|
|
|
repeated string env = 2;
|
|
|
|
string cwd = 3;
|
2017-12-11 21:17:07 +00:00
|
|
|
string user = 4;
|
2018-05-20 21:48:35 +00:00
|
|
|
ProxyEnv proxy_env = 5;
|
2018-08-01 21:15:43 +00:00
|
|
|
repeated HostIP extraHosts = 6;
|
2017-06-06 18:01:18 +00:00
|
|
|
}
|
|
|
|
|
2018-08-04 19:42:01 +00:00
|
|
|
enum NetMode {
|
|
|
|
UNSET = 0; // sandbox
|
|
|
|
HOST = 1;
|
|
|
|
NONE = 2;
|
|
|
|
}
|
|
|
|
|
2019-01-10 02:21:39 +00:00
|
|
|
enum SecurityMode {
|
|
|
|
SANDBOX = 0;
|
|
|
|
INSECURE = 1; // privileged mode
|
|
|
|
}
|
|
|
|
|
2018-02-27 07:06:01 +00:00
|
|
|
// Mount specifies how to mount an input Op as a filesystem.
|
2017-06-06 18:01:18 +00:00
|
|
|
message Mount {
|
2017-07-21 17:58:24 +00:00
|
|
|
int64 input = 1 [(gogoproto.customtype) = "InputIndex", (gogoproto.nullable) = false];
|
2017-06-06 18:01:18 +00:00
|
|
|
string selector = 2;
|
|
|
|
string dest = 3;
|
2017-07-21 17:58:24 +00:00
|
|
|
int64 output = 4 [(gogoproto.customtype) = "OutputIndex", (gogoproto.nullable) = false];
|
2017-07-18 06:08:22 +00:00
|
|
|
bool readonly = 5;
|
2018-05-15 19:09:09 +00:00
|
|
|
MountType mountType = 6;
|
|
|
|
CacheOpt cacheOpt = 20;
|
2018-07-19 21:44:18 +00:00
|
|
|
SecretOpt secretOpt = 21;
|
2018-09-04 23:33:07 +00:00
|
|
|
SSHOpt SSHOpt = 22;
|
2020-08-05 01:11:32 +00:00
|
|
|
string resultID = 23;
|
2018-05-15 19:09:09 +00:00
|
|
|
}
|
|
|
|
|
2018-06-18 20:57:36 +00:00
|
|
|
// MountType defines a type of a mount from a supported set
|
2018-05-15 19:09:09 +00:00
|
|
|
enum MountType {
|
|
|
|
BIND = 0;
|
|
|
|
SECRET = 1;
|
|
|
|
SSH = 2;
|
|
|
|
CACHE = 3;
|
2018-06-08 05:28:52 +00:00
|
|
|
TMPFS = 4;
|
2018-05-15 19:09:09 +00:00
|
|
|
}
|
|
|
|
|
2018-06-18 20:57:36 +00:00
|
|
|
// CacheOpt defines options specific to cache mounts
|
2018-05-15 19:09:09 +00:00
|
|
|
message CacheOpt {
|
2018-06-18 20:57:36 +00:00
|
|
|
// ID is an optional namespace for the mount
|
2018-05-15 19:09:09 +00:00
|
|
|
string ID = 1;
|
2018-06-18 20:57:36 +00:00
|
|
|
// Sharing is the sharing mode for the mount
|
|
|
|
CacheSharingOpt sharing = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CacheSharingOpt defines different sharing modes for cache mount
|
|
|
|
enum CacheSharingOpt {
|
|
|
|
// SHARED cache mount can be used concurrently by multiple writers
|
|
|
|
SHARED = 0;
|
|
|
|
// PRIVATE creates a new mount if there are multiple writers
|
|
|
|
PRIVATE = 1;
|
|
|
|
// LOCKED pauses second writer until first one releases the mount
|
|
|
|
LOCKED = 2;
|
2017-06-06 18:01:18 +00:00
|
|
|
}
|
|
|
|
|
2018-07-19 21:44:18 +00:00
|
|
|
// SecretOpt defines options describing secret mounts
|
|
|
|
message SecretOpt {
|
|
|
|
// ID of secret. Used for quering the value.
|
|
|
|
string ID = 1;
|
|
|
|
// UID of secret file
|
|
|
|
uint32 uid = 2;
|
|
|
|
// GID of secret file
|
|
|
|
uint32 gid = 3;
|
|
|
|
// Mode is the filesystem mode of secret file
|
|
|
|
uint32 mode = 4;
|
|
|
|
// Optional defines if secret value is required. Error is produced
|
|
|
|
// if value is not found and optional is false.
|
|
|
|
bool optional = 5;
|
|
|
|
}
|
|
|
|
|
2018-09-04 23:33:07 +00:00
|
|
|
// SSHOpt defines options describing secret mounts
|
|
|
|
message SSHOpt {
|
|
|
|
// ID of exposed ssh rule. Used for quering the value.
|
|
|
|
string ID = 1;
|
|
|
|
// UID of agent socket
|
|
|
|
uint32 uid = 2;
|
|
|
|
// GID of agent socket
|
|
|
|
uint32 gid = 3;
|
|
|
|
// Mode is the filesystem mode of agent socket
|
|
|
|
uint32 mode = 4;
|
|
|
|
// Optional defines if ssh socket is required. Error is produced
|
|
|
|
// if client does not expose ssh.
|
|
|
|
bool optional = 5;
|
|
|
|
}
|
|
|
|
|
2018-02-27 07:06:01 +00:00
|
|
|
// SourceOp specifies a source such as build contexts and images.
|
2017-06-06 18:01:18 +00:00
|
|
|
message SourceOp {
|
2018-02-27 07:06:01 +00:00
|
|
|
// TODO: use source type or any type instead of URL protocol.
|
|
|
|
// identifier e.g. local://, docker-image://, git://, https://...
|
2017-06-06 18:01:18 +00:00
|
|
|
string identifier = 1;
|
2018-02-27 07:06:01 +00:00
|
|
|
// attrs are defined in attr.go
|
2017-07-08 23:25:07 +00:00
|
|
|
map<string, string> attrs = 2;
|
2017-06-06 18:01:18 +00:00
|
|
|
}
|
2017-07-21 17:58:24 +00:00
|
|
|
|
2018-02-27 07:06:01 +00:00
|
|
|
// BuildOp is used for nested build invocation.
|
2018-07-05 23:32:01 +00:00
|
|
|
// BuildOp is experimental and can break without backwards compatibility
|
2017-07-21 17:58:24 +00:00
|
|
|
message BuildOp {
|
|
|
|
int64 builder = 1 [(gogoproto.customtype) = "InputIndex", (gogoproto.nullable) = false];
|
|
|
|
map<string, BuildInput> inputs = 2;
|
2017-10-02 04:59:34 +00:00
|
|
|
Definition def = 3;
|
2017-07-21 17:58:24 +00:00
|
|
|
map<string, string> attrs = 4;
|
|
|
|
// outputs
|
|
|
|
}
|
|
|
|
|
2018-02-27 07:06:01 +00:00
|
|
|
// BuildInput is used for BuildOp.
|
2017-07-21 17:58:24 +00:00
|
|
|
message BuildInput {
|
|
|
|
int64 input = 1 [(gogoproto.customtype) = "InputIndex", (gogoproto.nullable) = false];
|
2017-10-02 04:59:34 +00:00
|
|
|
}
|
|
|
|
|
2018-02-27 07:06:01 +00:00
|
|
|
// OpMetadata is a per-vertex metadata entry, which can be defined for arbitrary Op vertex and overridable on the run time.
|
2017-10-02 04:59:34 +00:00
|
|
|
message OpMetadata {
|
2018-02-27 07:06:01 +00:00
|
|
|
// ignore_cache specifies to ignore the cache for this Op.
|
2017-10-02 04:59:34 +00:00
|
|
|
bool ignore_cache = 1;
|
2017-12-08 00:13:50 +00:00
|
|
|
// Description can be used for keeping any text fields that builder doesn't parse
|
2018-06-21 21:09:38 +00:00
|
|
|
map<string, string> description = 2;
|
|
|
|
// index 3 reserved for WorkerConstraint in previous versions
|
|
|
|
// WorkerConstraint worker_constraint = 3;
|
2018-05-07 21:20:25 +00:00
|
|
|
ExportCache export_cache = 4;
|
2018-07-18 22:32:37 +00:00
|
|
|
|
|
|
|
map<string, bool> caps = 5 [(gogoproto.castkey) = "github.com/moby/buildkit/util/apicaps.CapID", (gogoproto.nullable) = false];
|
2020-04-27 23:35:20 +00:00
|
|
|
}
|
|
|
|
|
2020-05-20 00:21:49 +00:00
|
|
|
// Source is a source mapping description for a file
|
2020-04-27 23:35:20 +00:00
|
|
|
message Source {
|
2020-05-20 23:16:38 +00:00
|
|
|
map<string, Locations> locations = 1;
|
|
|
|
repeated SourceInfo infos = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Locations is a list of ranges with a index to its source map.
|
|
|
|
message Locations {
|
|
|
|
repeated Location locations = 1;
|
2020-05-01 18:39:45 +00:00
|
|
|
}
|
|
|
|
|
2020-05-20 00:21:49 +00:00
|
|
|
// Source info contains the shared metadata of a source mapping
|
2020-05-01 18:39:45 +00:00
|
|
|
message SourceInfo {
|
2020-05-16 22:26:17 +00:00
|
|
|
string filename = 1;
|
2020-05-01 18:39:45 +00:00
|
|
|
bytes data = 2;
|
|
|
|
Definition definition = 3;
|
|
|
|
}
|
|
|
|
|
2020-05-20 00:21:49 +00:00
|
|
|
// Location defines list of areas in to source file
|
2020-05-01 18:39:45 +00:00
|
|
|
message Location {
|
2020-05-20 23:16:38 +00:00
|
|
|
int32 sourceIndex = 1;
|
|
|
|
repeated Range ranges = 2;
|
2020-04-27 23:35:20 +00:00
|
|
|
}
|
|
|
|
|
2020-05-20 00:21:49 +00:00
|
|
|
// Range is an area in the source file
|
2020-04-27 23:35:20 +00:00
|
|
|
message Range {
|
2020-05-16 22:26:17 +00:00
|
|
|
Position start = 1 [(gogoproto.nullable) = false];
|
|
|
|
Position end = 2 [(gogoproto.nullable) = false];
|
2020-04-27 23:35:20 +00:00
|
|
|
}
|
|
|
|
|
2020-05-20 00:21:49 +00:00
|
|
|
// Position is single location in a source file
|
2020-04-27 23:35:20 +00:00
|
|
|
message Position {
|
2020-05-16 22:26:17 +00:00
|
|
|
int32 Line = 1;
|
|
|
|
int32 Character = 2;
|
2017-11-21 08:08:36 +00:00
|
|
|
}
|
|
|
|
|
2018-05-07 21:20:25 +00:00
|
|
|
message ExportCache {
|
|
|
|
bool Value = 1;
|
2018-05-20 21:48:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message ProxyEnv {
|
|
|
|
string http_proxy = 1;
|
|
|
|
string https_proxy = 2;
|
|
|
|
string ftp_proxy = 3;
|
|
|
|
string no_proxy = 4;
|
|
|
|
}
|
2018-05-07 21:20:25 +00:00
|
|
|
|
2018-06-21 21:09:38 +00:00
|
|
|
// WorkerConstraints defines conditions for the worker
|
|
|
|
message WorkerConstraints {
|
2017-12-19 09:34:34 +00:00
|
|
|
repeated string filter = 1; // containerd-style filter
|
2017-10-02 04:59:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Definition is the LLB definition structure with per-vertex metadata entries
|
|
|
|
message Definition {
|
2018-02-27 07:06:01 +00:00
|
|
|
// def is a list of marshaled Op messages
|
2017-10-02 04:59:34 +00:00
|
|
|
repeated bytes def = 1;
|
2018-02-27 07:06:01 +00:00
|
|
|
// metadata contains metadata for the each of the Op messages.
|
|
|
|
// A key must be an LLB op digest string. Currently, empty string is not expected as a key, but it may change in the future.
|
2017-10-02 04:59:34 +00:00
|
|
|
map<string, OpMetadata> metadata = 2 [(gogoproto.castkey) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
|
2020-05-20 23:16:38 +00:00
|
|
|
// Source contains the source mapping information for the vertexes in the definition
|
|
|
|
Source Source = 3;
|
2017-10-02 04:59:34 +00:00
|
|
|
}
|
2018-08-01 21:15:43 +00:00
|
|
|
|
|
|
|
message HostIP {
|
|
|
|
string Host = 1;
|
|
|
|
string IP = 2;
|
2019-01-23 21:05:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message FileOp {
|
|
|
|
repeated FileAction actions = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message FileAction {
|
|
|
|
int64 input = 1 [(gogoproto.customtype) = "InputIndex", (gogoproto.nullable) = false]; // could be real input or target (target index + max input index)
|
|
|
|
int64 secondaryInput = 2 [(gogoproto.customtype) = "InputIndex", (gogoproto.nullable) = false]; // --//--
|
2019-03-11 17:19:24 +00:00
|
|
|
int64 output = 3 [(gogoproto.customtype) = "OutputIndex", (gogoproto.nullable) = false];
|
2019-01-23 21:05:59 +00:00
|
|
|
oneof action {
|
2019-02-05 01:36:01 +00:00
|
|
|
// FileActionCopy copies files from secondaryInput on top of input
|
2019-01-23 21:05:59 +00:00
|
|
|
FileActionCopy copy = 4;
|
2019-02-05 01:36:01 +00:00
|
|
|
// FileActionMkFile creates a new file
|
2019-01-23 21:05:59 +00:00
|
|
|
FileActionMkFile mkfile = 5;
|
2019-02-05 01:36:01 +00:00
|
|
|
// FileActionMkDir creates a new directory
|
2019-01-23 21:05:59 +00:00
|
|
|
FileActionMkDir mkdir = 6;
|
2019-02-05 01:36:01 +00:00
|
|
|
// FileActionRm removes a file
|
2019-01-23 21:05:59 +00:00
|
|
|
FileActionRm rm = 7;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
message FileActionCopy {
|
2019-02-05 01:36:01 +00:00
|
|
|
// src is the source path
|
2019-01-23 21:05:59 +00:00
|
|
|
string src = 1;
|
2019-02-05 01:36:01 +00:00
|
|
|
// dest path
|
2019-01-23 21:05:59 +00:00
|
|
|
string dest = 2;
|
2019-02-05 01:36:01 +00:00
|
|
|
// optional owner override
|
2019-03-11 17:19:24 +00:00
|
|
|
ChownOpt owner = 3;
|
2019-02-05 01:36:01 +00:00
|
|
|
// optional permission bits override
|
2019-03-11 17:19:24 +00:00
|
|
|
int32 mode = 4;
|
2019-02-05 01:36:01 +00:00
|
|
|
// followSymlink resolves symlinks in src
|
2019-03-11 17:19:24 +00:00
|
|
|
bool followSymlink = 5;
|
2019-02-05 01:36:01 +00:00
|
|
|
// dirCopyContents only copies contents if src is a directory
|
2019-03-11 17:19:24 +00:00
|
|
|
bool dirCopyContents = 6;
|
2019-02-05 01:36:01 +00:00
|
|
|
// attemptUnpackDockerCompatibility detects if src is an archive to unpack it instead
|
2019-03-11 17:19:24 +00:00
|
|
|
bool attemptUnpackDockerCompatibility = 7;
|
2019-02-05 01:36:01 +00:00
|
|
|
// createDestPath creates dest path directories if needed
|
2019-03-11 17:19:24 +00:00
|
|
|
bool createDestPath = 8;
|
2019-02-05 01:36:01 +00:00
|
|
|
// allowWildcard allows filepath.Match wildcards in src path
|
2019-03-11 17:19:24 +00:00
|
|
|
bool allowWildcard = 9;
|
2019-02-05 01:36:01 +00:00
|
|
|
// allowEmptyWildcard doesn't fail the whole copy if wildcard doesn't resolve to files
|
2019-03-11 17:19:24 +00:00
|
|
|
bool allowEmptyWildcard = 10;
|
2019-02-05 01:36:01 +00:00
|
|
|
// optional created time override
|
2019-03-11 17:19:24 +00:00
|
|
|
int64 timestamp = 11;
|
2019-01-23 21:05:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message FileActionMkFile {
|
2019-02-05 01:36:01 +00:00
|
|
|
// path for the new file
|
2019-01-23 21:05:59 +00:00
|
|
|
string path = 1;
|
2019-02-05 01:36:01 +00:00
|
|
|
// permission bits
|
2019-01-23 21:05:59 +00:00
|
|
|
int32 mode = 2;
|
2019-02-05 01:36:01 +00:00
|
|
|
// data is the new file contents
|
2019-01-23 21:05:59 +00:00
|
|
|
bytes data = 3;
|
2019-02-05 01:36:01 +00:00
|
|
|
// optional owner for the new file
|
2019-01-23 21:05:59 +00:00
|
|
|
ChownOpt owner = 4;
|
2019-02-05 01:36:01 +00:00
|
|
|
// optional created time override
|
2019-02-01 18:52:53 +00:00
|
|
|
int64 timestamp = 5;
|
2019-01-23 21:05:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message FileActionMkDir {
|
2019-02-05 01:36:01 +00:00
|
|
|
// path for the new directory
|
2019-01-23 21:05:59 +00:00
|
|
|
string path = 1;
|
2019-02-05 01:36:01 +00:00
|
|
|
// permission bits
|
2019-01-23 21:05:59 +00:00
|
|
|
int32 mode = 2;
|
2019-02-05 01:36:01 +00:00
|
|
|
// makeParents creates parent directories as well if needed
|
2019-02-01 18:52:53 +00:00
|
|
|
bool makeParents = 3;
|
2019-02-05 01:36:01 +00:00
|
|
|
// optional owner for the new directory
|
2019-01-23 21:05:59 +00:00
|
|
|
ChownOpt owner = 4;
|
2019-02-05 01:36:01 +00:00
|
|
|
// optional created time override
|
2019-02-01 18:52:53 +00:00
|
|
|
int64 timestamp = 5;
|
2019-01-23 21:05:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message FileActionRm {
|
2019-02-05 01:36:01 +00:00
|
|
|
// path to remove
|
2019-01-23 21:05:59 +00:00
|
|
|
string path = 1;
|
2019-02-05 01:36:01 +00:00
|
|
|
// allowNotFound doesn't fail the rm if file is not found
|
2019-02-01 18:52:53 +00:00
|
|
|
bool allowNotFound = 2;
|
2019-02-05 01:36:01 +00:00
|
|
|
// allowWildcard allows filepath.Match wildcards in path
|
2019-02-01 18:52:53 +00:00
|
|
|
bool allowWildcard = 3;
|
2019-01-23 21:05:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message ChownOpt {
|
|
|
|
UserOpt user = 1;
|
|
|
|
UserOpt group = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message UserOpt {
|
2019-02-05 01:36:01 +00:00
|
|
|
oneof user {
|
|
|
|
NamedUserOpt byName = 1;
|
|
|
|
uint32 byID = 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
message NamedUserOpt {
|
2019-01-23 21:05:59 +00:00
|
|
|
string name = 1;
|
2019-02-05 01:36:01 +00:00
|
|
|
int64 input = 2 [(gogoproto.customtype) = "InputIndex", (gogoproto.nullable) = false];
|
2020-05-20 23:16:38 +00:00
|
|
|
}
|