Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable multi export #1575

Closed
wants to merge 248 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
248 commits
Select commit Hold shift + click to select a range
024f85e
enable multi-export
fahedouch Jul 16, 2020
58285c0
enabling multi-export
fahedouch Sep 13, 2020
89c63ad
secrets: allow providing secrets with env
tonistiigi Jun 16, 2020
d1f5206
secrets: remove file specifics from variable names
tonistiigi Jun 17, 2020
b929bc1
secrets: reuse constant on error message
tonistiigi Jun 18, 2020
4765aba
solver: fix marking already cached vertex as cancelled
tonistiigi Jul 5, 2020
bbee6c7
session: track sessions with a group construct
tonistiigi Jun 30, 2020
8ece6bf
pull: allow separate sessions for different parts of pull
tonistiigi Jul 1, 2020
a10bbea
pull: fix session updating on resolver
tonistiigi Jul 5, 2020
1977ec2
resolver: add credentials cache
tonistiigi Jul 5, 2020
90790d1
Update Executor interface for Run and Exec
coryb Jul 9, 2020
f3e9a1c
fix error handling for exec when container fails to start
coryb Jul 10, 2020
450049f
simplify done channel handling, fix other pr comments.
coryb Jul 11, 2020
8b7ec2f
update godoc for Executor interface
coryb Jul 13, 2020
32dcf0d
inline cache: fix handling of duplicate blobs
tonistiigi Jul 15, 2020
da2f8db
Build the containerd-shim-runc-v2 shim for tests
TBBle Jan 6, 2020
302cdce
Revert "Pin containerd runtime to v1"
TBBle Jan 5, 2020
e884b3d
Don't build the containerd-shim shim for tests
TBBle Jul 16, 2020
214ea6d
Split LocalMounter.Mount into Windows and Unix
TBBle Jul 16, 2020
355d742
Correctly build forks in Travis
TBBle Mar 1, 2020
8f474a1
Wrap original error when failing to read download context
TBBle Mar 1, 2020
5bedb35
Move printLogs from oci.go to sandbox.go
TBBle Mar 1, 2020
931da4c
Use new containerd shim in integ tests; don't skip on require error.
sipsma Jul 16, 2020
e3e9f8b
remotecache: Only visit each item once when walking results.
sipsma Jul 16, 2020
71bdb4e
add Run/Exec to FrontendLLBBridge interface
coryb Jul 16, 2020
abffd6b
remove `Get` prefix from Executor/CacheManager funcs and update to av…
coryb Jul 17, 2020
765733b
update FrontendLLBBridge to be composed of Executor
coryb Jul 17, 2020
4ddbab9
Release needs context.TODO() so if ctx is cancelled the refs can be c…
coryb Jul 17, 2020
cad849a
buildkitd: ensure stack traces on logging errors
tonistiigi Jul 17, 2020
4abeb61
integration: add concurrent sandbox limit
tonistiigi Jul 18, 2020
f88e6c6
integration: increase timeouts
tonistiigi Jul 18, 2020
9ea3516
integration: fix rootless worker binaries closing after tests
tonistiigi Jul 18, 2020
9640c28
hack: unblock master deploy
tonistiigi Jul 17, 2020
6f52966
replace gometalinter with golangci linter
tonistiigi Jul 18, 2020
32bf10e
lint: add misspell and unused
tonistiigi Jul 18, 2020
51208f1
lint: enable golint
tonistiigi Jul 18, 2020
6fa2b88
rename binfmt_misc to archutil
tonistiigi Jul 18, 2020
5e0ce86
package name fixes
tonistiigi Jul 18, 2020
57d6ae4
avoid returning private type from public function
tonistiigi Jul 18, 2020
345d2f0
contenthash: avoid deprecated Xattrs header
tonistiigi Jul 18, 2020
1ca5af4
session: avoid deprecated grpc.Stream type
tonistiigi Jul 18, 2020
6393302
contenthash: fix buffer reuse pool
tonistiigi Jul 18, 2020
08f471e
client: update dialer to contextDialer
tonistiigi Jul 18, 2020
08e8ebf
lint: enable more linters
tonistiigi Jul 18, 2020
3bc6b57
handle error returns more properly
tonistiigi Jul 18, 2020
ece1f22
Provide separate NetProviders map for Windows
TBBle Jul 20, 2020
a606625
Implement separate handling for Windows Network namespaces
TBBle Jul 20, 2020
c2fe1ba
Reorder CNI config to set options before consumers
TBBle Jul 20, 2020
aa61fac
Don't add loopback CNI configuration on Windows
TBBle Jul 20, 2020
95d81fb
Support not chowning files on all platforms
TBBle Jul 22, 2020
128df1c
vendor: update tonistiigi/fsutil v0.0.0-20200720184806-8f851f9d2045
thaJeztah Jul 23, 2020
205e916
Treat unix sockets as regular files
alexcb Jul 18, 2020
dc9f276
integration: lock buffer for concurrent writes
tonistiigi Jul 23, 2020
7c2445e
Shortcut read-only bind-mounts in Windows, like non-Windows
TBBle Jul 23, 2020
9393d50
Give a name to the only mount we care about
TBBle Jul 24, 2020
2df4a32
buildctl-daemonless.sh: show log on "could not connect to ..."
AkihiroSuda Jul 24, 2020
b95c321
vendor: update fsutil to c3ed55f3b4
tonistiigi Jul 27, 2020
eabedf9
hack: add shfmt
tonistiigi Jul 25, 2020
507aad7
Add initial GitHub Actions-based Windows CI
TBBle Jul 27, 2020
dc9ce04
README.md: drop cgroup v2 notes
AkihiroSuda Jul 27, 2020
306e6c7
docs/rootless.md: drop support for Debian 9 and Fedora 30
AkihiroSuda Jul 27, 2020
aaa879a
README.md: add HLB, Earthfile, and Cargo Wharf
AkihiroSuda Jul 27, 2020
ee0e94f
Fix testutil/integration build on Windows
TBBle Jul 27, 2020
9db28da
Use OS-agnostic os.SameFile instead of inode comparision
TBBle Jul 27, 2020
c5876e8
Add errors-on-non-Linux ToRootless implementation
TBBle Jul 27, 2020
535016a
Fix undefined variable in Windows-specific test
TBBle Jul 27, 2020
a41bdf6
Log HostComputeNamespace name instead of the whole object
TBBle Jul 27, 2020
06f62a8
Skip tests on Windows that attempt to bind-mount read-only
TBBle Jul 27, 2020
2afa84b
Don't rely on sh being in the PATH on Windows for tests
TBBle Jul 27, 2020
d3b7e36
Skip source tests on Windows that depend on read-write bind-mounts
TBBle Jul 27, 2020
1396536
Run all the hasPrefix test-cases, even if one fails
TBBle Jul 27, 2020
3edbb7b
Fix oci.hasPrefix to operate correctly on Windows
TBBle Jul 27, 2020
e0717e9
Provide the known default PATH to the llbtest test
TBBle Jul 27, 2020
8dac5ef
Don't silently ignore failed wildcard expansion
TBBle Jul 28, 2020
8cad19f
Use filesystem-supplied modes for checksumming content
TBBle Jul 27, 2020
6eb134b
vendor: update containerd to eb6354a11
tonistiigi Jul 29, 2020
1525550
add testing for containerd 1.4-beta2
tonistiigi Jul 29, 2020
9cc8cd1
hack: use caching for master deploy
tonistiigi Jul 29, 2020
85f9c46
resolver: allow setting both insecure tls and http
tonistiigi Jul 27, 2020
4fd3a13
push: reenable setting insecure exporter opt
tonistiigi Jul 27, 2020
bba3e41
resolver: enable tracing on default transport
tonistiigi Jul 30, 2020
c97ca98
executor/oci.GetUser(): remove unused context
thaJeztah Jul 30, 2020
87e4b6e
Clarify the gateway 'test' as a build-test
TBBle Jul 30, 2020
b34f69c
Ensure that time has passed between foo0 and foo1
TBBle Jul 28, 2020
816c012
vendor: update opentracing-go v1.2.0, go-stdlib v1.0.0
thaJeztah Jul 30, 2020
513f5eb
Unify OCI Spec generation across all host platforms
TBBle Jul 24, 2020
d74ae65
Compile containerd worker on Windows
TBBle Jul 24, 2020
f6cc4e9
Fix linter warning about comment mismatch
TBBle Jul 27, 2020
dcb0128
Refactor OCI Spec generation to use oci.SpecOpts more
TBBle Jul 28, 2020
673f338
Don't ignore failure to setup networking
TBBle Jul 28, 2020
45a40e7
buildctl: improve secret parsing
tonistiigi Jul 29, 2020
b213b87
pull: fix counter for ensuremanifestloaded check
tonistiigi Aug 2, 2020
bd52845
resolver: make sure authorizer is not regenerated
tonistiigi Aug 2, 2020
62803b1
resolver: reenable keep-alive
tonistiigi Aug 2, 2020
fbd1df4
wrap errors from executor Run/Exec to allow access to exit code
coryb Jul 30, 2020
6217677
remove *pixel from winsize struct, tweak ExitError handling for ctx.Err
coryb Jul 31, 2020
00efe6d
fix containerd executor Run/Exec to close container input on eof from…
coryb Aug 1, 2020
d720280
only warn on resize errors
coryb Aug 1, 2020
3e472c7
update container resize events in sequence, also move it out of exit/…
coryb Aug 3, 2020
544e4b2
travis: replace after_failure with after_script
tonistiigi Aug 3, 2020
7a8942f
client: fix connhelper context canceling
tonistiigi Aug 5, 2020
d45a78f
new connection helper: podman-container://<CONTAINER>
AkihiroSuda Aug 5, 2020
7606676
grpcerrors: use full typeurl registration
tonistiigi Jul 27, 2020
e625149
Add support for lazily-pulled blobs in cache manager.
sipsma May 28, 2020
8ef1199
Fix progress in schema1 pull.
sipsma Aug 3, 2020
aa0b9ba
pull: de-pointer non-optional platform field
sipsma Aug 3, 2020
b2b774d
cache: Remove ImageRef from DescHandlers
sipsma Aug 5, 2020
7096349
setting host part of address as :authority pseudo header.
everpeace Jul 14, 2020
026ff15
llb: Cache DefinitionOp inputs to support memoization during Marshal
sipsma Aug 10, 2020
a92fa99
add sipsma and coryb as maintainers
tonistiigi Aug 11, 2020
d4f004c
vendor: update containerd to fa1220fce
tonistiigi Aug 8, 2020
3912cc9
resolver: add better pooling and custom authenticator
tonistiigi Aug 5, 2020
98013e9
resolver: fix token expiring issues
tonistiigi Aug 11, 2020
f20894b
resolver: clean up unused resolver pool
tonistiigi Aug 11, 2020
1ba8f35
resolver: switch post/get order on requesting token
tonistiigi Aug 11, 2020
d62cbb6
resolver: add docs to new functions
tonistiigi Aug 11, 2020
d6618bd
resolver: avoid retrying fatal error
tonistiigi Aug 12, 2020
3e41e4f
resolver: handle nil group properly
tonistiigi Aug 11, 2020
dab7587
secretsprovider.NewStore() simplify env handling
thaJeztah Aug 14, 2020
7b4d42b
Fix platform typo
JonZeolla Aug 17, 2020
bdcda22
update containerd to v1.4.0, runc to v1.0.0-rc92
AkihiroSuda Aug 17, 2020
76998f7
cni: remove duplicate error check
jimen0 Aug 23, 2020
eb8ff0f
vendor: github.com/gofrs/flock v0.7.3
thaJeztah Aug 24, 2020
248fe39
vendor: github.com/pkg/profile v1.5.0
thaJeztah Aug 24, 2020
f13140b
build-arg add support BUILDKIT_SYNTAX
Aug 10, 2020
cf24c1f
vendor: update containerd to efa0e809
tonistiigi Aug 31, 2020
7022c23
Enable to use remote snapshots for refs
ktock Aug 17, 2020
7812258
Add integration test for containerd and stargz snapshotter
ktock Aug 24, 2020
0e22bb4
ensure containerd is running for worker tests
coryb Sep 1, 2020
3b7b4fe
vendor: update containerd to d4e7820
errordeveloper Sep 4, 2020
660f366
fix tests after busybox update
tonistiigi Sep 12, 2020
df3b716
enabling multi-export
fahedouch Sep 23, 2020
3a27190
fix variable type
fahedouch Sep 28, 2020
eb96686
fix exporter condition
fahedouch Sep 28, 2020
4db4c90
enbale cache
fahedouch Sep 29, 2020
2e5c020
fix client tests
fahedouch Oct 2, 2020
1d7134c
fix single output exporter
fahedouch Oct 11, 2020
9b4269b
set single exporter for control
fahedouch Oct 14, 2020
66e2018
fix signle exporter
fahedouch Oct 15, 2020
66ad559
Limit size of additional label for avoiding preparation failure
ktock Sep 10, 2020
cdaf6bd
Enable to use stargz snapshotter without spawning plugin process
ktock Sep 2, 2020
67a4eb1
Enable to run integration tests with stargz snapshotter
ktock Sep 3, 2020
5fbb33a
client: allow build callback to return nil result
tonistiigi Sep 17, 2020
54716af
client: avoid checking token cap on default case
tonistiigi Sep 17, 2020
0ccb1d1
Allow stargz target in Dockerfile to use golang build cache
ktock Sep 22, 2020
e97ab10
sshprovider: on Windows, ModeSocket might not be set on the ssh socket
nicks Sep 23, 2020
6382b3f
dockerfile: allow multiple values for ARG
tonistiigi Sep 22, 2020
b7cde0e
go.mod: github.com/containerd/console v1.0.1
thaJeztah Sep 24, 2020
27a173d
vendor: sirupsen/logrus v1.7.0
thaJeztah Sep 30, 2020
61ef714
Make HTTP/2 authority pseudo-header spec-compliant
edrevo Oct 3, 2020
dfcd6e1
update gateway to add ability to run and exec into containers
coryb Aug 5, 2020
4d2a851
cleanup release on error logic for gateway NewContainer
coryb Sep 1, 2020
6bf1434
add capability entry for gateway exec
coryb Sep 3, 2020
3e27e9c
remove unnecessary gateway container interface
coryb Sep 11, 2020
bb3cfdc
fix case on error messages
coryb Sep 11, 2020
0093d1a
add exec tests with multiple mounts
coryb Sep 13, 2020
fc8e415
add cap support check to gatewayClientForBuild
coryb Sep 13, 2020
896e27d
make GrpcClient implement gateway.client.Client
coryb Sep 13, 2020
cabe104
move ExecOps mounting logic into new package so logic can be reused f…
coryb Sep 15, 2020
304b0dd
update gateway exec mount tests to verity ssh and secret mounts
coryb Sep 17, 2020
d163dd9
fix minor nits
coryb Oct 2, 2020
6c593aa
remove SessonManager from FrontendLLBBridge, adding as arg to Fronten…
coryb Oct 2, 2020
da370e8
Move SecurityMode to InitMessage from NewContainer message so it can …
coryb Oct 2, 2020
3cacda0
remove unnecessary MountManager interface
coryb Oct 2, 2020
afa206e
fix unnecessary MetadataStore rename
coryb Oct 2, 2020
4e0b6f0
fix linting error
coryb Oct 2, 2020
a7fbb3a
use grpc typed error for ExitMessage error
coryb Oct 2, 2020
9ffa933
Default Cwd to "/"
coryb Oct 2, 2020
b392b06
Simplify rpc exec exit error handling
coryb Oct 2, 2020
9f4f187
frontend: make sure inputs support for frontends is detectable from c…
tonistiigi Sep 23, 2020
dd618a5
dockerfile: update run mounts to stable channel
tonistiigi Oct 5, 2020
c922cf3
hack: fix release script
tonistiigi Oct 7, 2020
cb3fc0e
frontend: support for subrequests
tonistiigi Oct 7, 2020
b7d2722
auth: fetch tokens from client side
tonistiigi Aug 12, 2020
454582f
dockerfile: parse comments associated with args and stages
tonistiigi Sep 22, 2020
5a9af10
fix object name
fahedouch Oct 15, 2020
9980922
fix export Attrs
fahedouch Oct 18, 2020
c5175a7
fix exportersResponse
fahedouch Oct 29, 2020
7e5f20a
fix cache exporter
fahedouch Oct 29, 2020
677d893
fix CI tests
fahedouch Oct 30, 2020
a4620df
Prevent context canceled errors from being permanent in authorizer
vladaionescu Oct 8, 2020
bb050a8
Add hostname specifying for building
jingxiaolu Jun 16, 2020
71b21cb
tests: Adding tests for hostname specifying for building
jingxiaolu Oct 10, 2020
231f9ff
Update binfmt_misc tests to have non-executable stack
kees Oct 17, 2020
9fcc6f1
remotecache: validate out broken links from loops
tonistiigi Aug 31, 2020
a1f7b99
stack: remove helper functions from error stack traces
tonistiigi Oct 19, 2020
da559ab
add tty support for runc executor
coryb Oct 11, 2020
cec5eb1
refactor tty output tests to avoid flakey sleeps
coryb Oct 17, 2020
5e1b599
shutdown container process when context is done
coryb Oct 17, 2020
8f63b38
syscall.Errno(0x5) == syscall.EIO
coryb Oct 19, 2020
201b26c
exporter: avoid descriptor annotations on docker manifests
tonistiigi Oct 12, 2020
f9e44bf
update go-runc to use runc.ExitError for container exec status
coryb Oct 19, 2020
51f67d6
executor: remove stub files from rootfs
tonistiigi Oct 19, 2020
7af6499
remotecache: don’t export cache for empty layers
tonistiigi Oct 19, 2020
36010ec
exporter: don’t keep timestamp for empty layer
tonistiigi Oct 19, 2020
427a6cb
exptypes: define empty gz layer digest
tonistiigi Oct 19, 2020
4d0aad5
Enable parallelization of NewContentHashFunc
hinshun Oct 21, 2020
a3b19c5
update go-runc mod, use runc Started chan
coryb Oct 21, 2020
a3edbbf
authprovider: allow readonly config dir
tonistiigi Oct 22, 2020
02e0447
Dockerfile: don’t remove debug info on buildkitd/runc binaries
tonistiigi Oct 25, 2020
43f3aaf
debug: enable gc triggers
tonistiigi Oct 26, 2020
0cc3335
solver: make sure job id cleared after build
tonistiigi Oct 26, 2020
b6595f2
exec: use platform specific default path
tonistiigi Oct 23, 2020
823c1bf
dockerfile: set default shell based on OS
tonistiigi Oct 23, 2020
2a5ab14
dockerfile: add test for default shell and path
tonistiigi Oct 23, 2020
42e13ec
remotecache: allow oci mediatypes on exporting to registry
tonistiigi Oct 23, 2020
b4f14d5
readme: document oci-mediatypes cache export option
tonistiigi Oct 26, 2020
8630c28
Add test for second solve using rootfs of first solve that error'ed f…
hinshun Oct 27, 2020
aa64f03
source: fix puller error caching on cancellation
tonistiigi Oct 27, 2020
8703881
gateway exec: add platform and worker constraints to NewContainer api
coryb Oct 27, 2020
720db13
TestParseCases(): fix "expected" and "actual" being reversed
thaJeztah Oct 26, 2020
bdbe498
Dockerfile: fix parsing of trailing backslash
thaJeztah Jul 7, 2020
d426cf6
Bump stargz-snapshotter and partial registry logic integration
ktock Oct 28, 2020
7b7359d
Delay decoding stargz config for avoiding extra dependency for config…
ktock Oct 29, 2020
19de44b
replace github.com/docker/docker/pkg/locker with moby/locker v1.0.1
thaJeztah Oct 30, 2020
1265b52
Add documentation about stargz/eStargz support
ktock Oct 28, 2020
cfed559
vendor: github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
thaJeztah Oct 30, 2020
35e629b
utils: move dockerignore function to builder/dockerignore
Dec 14, 2015
76756c5
Fix ReadAll to run on Windows.
anusha-ragunathan Feb 4, 2016
a6f6e39
Add support for comment in .dockerignore
yongtang Jun 1, 2016
dc6f379
Skip UTF-8 BOM bytes from Dockerignore if exist
yongtang Jun 3, 2016
7f8438b
add defer file.Close to avoid potential fd leak
allencloud Jun 25, 2016
7faba79
use t.Fatal() to output the err message where the values used for for…
Feb 21, 2017
c710528
Fix behavior of absolute paths in .dockerignore
simonferquel Mar 24, 2017
51601bd
Add canonical import comment
dnephin Feb 5, 2018
40c6ca7
Fix typos
wingkwong Feb 10, 2020
6a23424
dockerignore: remove import path enforcement comments
thaJeztah Oct 30, 2020
868a95f
frontend/dockerfile: use dockerignore package from buildkit
thaJeztah Oct 30, 2020
2249bd2
vendor: github.com/Microsoft/go-winio v0.4.15-0.20200908182639-5b44b7…
thaJeztah Oct 30, 2020
9dc2466
vendor: github.com/gorilla/mux v1.8.0
thaJeztah Oct 30, 2020
f8f1d61
vendor: golang.org/x/sys v0.0.0-20200922070232-aee5d888a860
thaJeztah Oct 30, 2020
e269ba1
vendor: github.com/docker/libnetwork v0.8.0-dev.2.0.20200917202933-d0…
thaJeztah Oct 30, 2020
6d95e1e
vendor: github.com/docker/cli v20.10.0-beta1.0.20201029214301-1d20b15…
thaJeztah Oct 30, 2020
3e491ff
vendor: github.com/docker/docker v20.10.0-beta1.0.20201030232932-c2cc…
thaJeztah Oct 30, 2020
4afe93f
update runc used in integration tests so exec no longer panics
coryb Nov 2, 2020
34a6746
Fix race in CNI namespaces.
vladaionescu Nov 2, 2020
7420e92
Rename nativeID to nsPath. Simplify.
vladaionescu Nov 2, 2020
ead9df8
add session injection to remote loading
tonistiigi Oct 27, 2020
67332ba
executor: change mount to struct
tonistiigi Nov 2, 2020
60c555b
update RootlessKit, fuse-overlayfs, and containerd-fuse-overlayfs
AkihiroSuda Nov 5, 2020
b2616b8
progress: add log limits and clipping
tonistiigi Oct 26, 2020
b90486b
control: split status messages if they grow big
tonistiigi Oct 26, 2020
c83cf8f
client: use containerd grpc message size defaults
tonistiigi Oct 26, 2020
023aa50
logs: show log limit in the clipping message
tonistiigi Nov 5, 2020
7358325
Add fuse dependency to moby/buildkit image
ktock Nov 6, 2020
d3fb750
resolve MR conflics
fahedouch Nov 6, 2020
2bab0e3
lint code
fahedouch Nov 7, 2020
4facfdb
Merge branch 'master' into enable-multi-export
fahedouch Nov 9, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,186 changes: 878 additions & 308 deletions api/services/control/control.pb.go

Large diffs are not rendered by default.

26 changes: 18 additions & 8 deletions api/services/control/control.proto
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,23 @@ message UsageRecord {
bool Shared = 11;
}

message ExporterAttrs {
map<string, string> exporterAttrs = 1;
}

message SolveRequest {
string Ref = 1;
pb.Definition Definition = 2;
string Exporter = 3;
map<string, string> ExporterAttrs = 4;
string Session = 5;
string Frontend = 6;
map<string, string> FrontendAttrs = 7;
CacheOptions Cache = 8 [(gogoproto.nullable) = false];
repeated string Entitlements = 9 [(gogoproto.customtype) = "github.com/moby/buildkit/util/entitlements.Entitlement" ];
map<string, pb.Definition> FrontendInputs = 10;
ExporterAttrs ExporterAttrs = 4;
repeated string Exporters = 5;
repeated ExporterAttrs ExportersAttrs = 6;
string Session = 7;
string Frontend = 8;
map<string, string> FrontendAttrs = 9;
CacheOptions Cache = 10 [(gogoproto.nullable) = false];
repeated string Entitlements = 11 [(gogoproto.customtype) = "github.com/moby/buildkit/util/entitlements.Entitlement" ];
map<string, pb.Definition> FrontendInputs = 12;
}

message CacheOptions {
Expand Down Expand Up @@ -94,9 +100,13 @@ message CacheOptionsEntry {
map<string, string> Attrs = 2;
}

message SolveResponse {
message ExporterResponse{
map<string, string> ExporterResponse = 1;
}
message SolveResponse {
ExporterResponse ExporterResponse = 1;
repeated ExporterResponse ExportersResponse= 2;
}

message StatusRequest {
string Ref = 1;
Expand Down
95 changes: 63 additions & 32 deletions client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,12 +582,15 @@ func testPushByDigest(t *testing.T, sb integration.Sandbox) {
_, _, err = contentutil.ProviderFromRef(name + ":latest")
require.Error(t, err)

desc, _, err := contentutil.ProviderFromRef(name + "@" + resp.ExporterResponse["containerimage.digest"])
require.NoError(t, err)

require.Equal(t, resp.ExporterResponse["containerimage.digest"], desc.Digest.String())
require.Equal(t, images.MediaTypeDockerSchema2Manifest, desc.MediaType)
require.True(t, desc.Size > 0)
if len(resp.ExportersResponse) > 0 {
for _, e := range resp.ExportersResponse {
desc, _, err := contentutil.ProviderFromRef(name + "@" + e.ExporterResponse["containerimage.digest"])
require.NoError(t, err)
require.Equal(t, e.ExporterResponse["containerimage.digest"], desc.Digest.String())
require.Equal(t, images.MediaTypeDockerSchema2Manifest, desc.MediaType)
require.True(t, desc.Size > 0)
}
}
}

func testSecurityMode(t *testing.T, sb integration.Sandbox) {
Expand Down Expand Up @@ -850,8 +853,11 @@ func testFrontendImageNaming(t *testing.T, sb integration.Sandbox) {

resp, err := c.Build(context.TODO(), so, "", frontend, nil)
require.NoError(t, err)

checkImageName[exp](out, imageName, resp.ExporterResponse)
if len(resp.ExportersResponse) > 0 {
for _, e := range resp.ExportersResponse {
checkImageName[exp](out, imageName, e.ExporterResponse)
}
}
})
}
})
Expand Down Expand Up @@ -1539,10 +1545,14 @@ func testFrontendMetadataReturn(t *testing.T, sb integration.Sandbox) {
},
}, "", frontend, nil)
require.NoError(t, err)
require.Contains(t, res.ExporterResponse, "frontend.returned")
require.Equal(t, res.ExporterResponse["frontend.returned"], "true")
require.NotContains(t, res.ExporterResponse, "not-frontend.not-returned")
require.NotContains(t, res.ExporterResponse, "frontendnot.returned.either")
if len(res.ExportersResponse) > 0 {
for _, e := range res.ExportersResponse {
require.Contains(t, e.ExporterResponse, "frontend.returned")
require.Equal(t, e.ExporterResponse["frontend.returned"], "true")
require.NotContains(t, e.ExporterResponse, "not-frontend.not-returned")
require.NotContains(t, e.ExporterResponse, "frontendnot.returned.either")
}
}
checkAllReleasable(t, c, sb, true)
}

Expand Down Expand Up @@ -1645,10 +1655,14 @@ func testExporterTargetExists(t *testing.T, sb integration.Sandbox) {
},
}, nil)
require.NoError(t, err)
dgst := res.ExporterResponse["containerimage.digest"]
if len(res.ExportersResponse) > 0 {
for _, e := range res.ExportersResponse {
dgst := e.ExporterResponse["containerimage.digest"]

require.True(t, strings.HasPrefix(dgst, "sha256:"))
require.Equal(t, dgst, mdDgst)
require.True(t, strings.HasPrefix(dgst, "sha256:"))
require.Equal(t, dgst, mdDgst)
}
}
}

func testTarExporterWithSocket(t *testing.T, sb integration.Sandbox) {
Expand Down Expand Up @@ -2491,18 +2505,12 @@ func testBasicInlineCacheImportExport(t *testing.T, sb integration.Sandbox) {
}, nil)
require.NoError(t, err)

dgst, ok := resp.ExporterResponse["containerimage.digest"]
require.Equal(t, ok, true)

unique, err := readFileInImage(c, target+"@"+dgst, "/unique")
require.NoError(t, err)

err = c.Prune(context.TODO(), nil, PruneAll)
require.NoError(t, err)

checkAllRemoved(t, c, sb)

resp, err = c.Solve(context.TODO(), def, SolveOpt{
res, err := c.Solve(context.TODO(), def, SolveOpt{
// specifying inline cache exporter is needed for reproducing containerimage.digest
// (not needed for reproducing rootfs/unique)
Exports: []ExportEntry{
Expand Down Expand Up @@ -2530,17 +2538,26 @@ func testBasicInlineCacheImportExport(t *testing.T, sb integration.Sandbox) {
}, nil)
require.NoError(t, err)

dgst2, ok := resp.ExporterResponse["containerimage.digest"]
require.Equal(t, ok, true)
if len(resp.ExportersResponse) > 0 && len(res.ExportersResponse) > 0 {
for _, e := range res.ExportersResponse {
for _, v := range resp.ExportersResponse {
dgst, ok := v.ExporterResponse["containerimage.digest"]
require.Equal(t, ok, true)

require.Equal(t, dgst, dgst2)
dgst2, ok := e.ExporterResponse["containerimage.digest"]
require.Equal(t, ok, true)

require.Equal(t, dgst, dgst2)
}
}
}

err = c.Prune(context.TODO(), nil, PruneAll)
require.NoError(t, err)

checkAllRemoved(t, c, sb)

resp, err = c.Solve(context.TODO(), def, SolveOpt{
res, err = c.Solve(context.TODO(), def, SolveOpt{
Exports: []ExportEntry{
{
Type: ExporterImage,
Expand All @@ -2561,13 +2578,27 @@ func testBasicInlineCacheImportExport(t *testing.T, sb integration.Sandbox) {
}, nil)
require.NoError(t, err)

dgst3, ok := resp.ExporterResponse["containerimage.digest"]
require.Equal(t, ok, true)
if len(resp.ExportersResponse) > 0 && len(res.ExportersResponse) > 0 {
for _, e := range resp.ExportersResponse {
for _, v := range res.ExportersResponse {
dgst3, ok := v.ExporterResponse["containerimage.digest"]
require.Equal(t, ok, true)

dgst, ok := e.ExporterResponse["containerimage.digest"]
require.Equal(t, ok, true)

unique, err := readFileInImage(c, target+"@"+dgst, "/unique")
require.NoError(t, err)

// dgst3 != dgst, because inline cache is not exported for dgst3
unique3, err := readFileInImage(c, target+"@"+dgst3, "/unique")
require.NoError(t, err)

require.EqualValues(t, unique, unique3)
}
}
}

// dgst3 != dgst, because inline cache is not exported for dgst3
unique3, err := readFileInImage(c, target+"@"+dgst3, "/unique")
require.NoError(t, err)
require.EqualValues(t, unique, unique3)
}

func readFileInImage(c *Client, ref, path string) ([]byte, error) {
Expand Down
3 changes: 2 additions & 1 deletion client/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package client
import (
"time"

controlapi "github.com/moby/buildkit/api/services/control"
digest "github.com/opencontainers/go-digest"
)

Expand Down Expand Up @@ -42,5 +43,5 @@ type SolveStatus struct {

type SolveResponse struct {
// ExporterResponse is also used for CacheExporter
ExporterResponse map[string]string
ExportersResponse []*controlapi.ExporterResponse
}
135 changes: 93 additions & 42 deletions client/solve.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,6 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
return nil, err
}

var ex ExportEntry
if len(opt.Exports) > 1 {
return nil, errors.New("currently only single Exports can be specified")
}
if len(opt.Exports) == 1 {
ex = opt.Exports[0]
}

if !opt.SessionPreInitialized {
if len(syncedDirs) > 0 {
s.Allow(filesync.NewFSSyncProvider(syncedDirs))
Expand All @@ -131,29 +123,50 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
s.Allow(a)
}

switch ex.Type {
case ExporterLocal:
if ex.Output != nil {
return nil, errors.New("output file writer is not supported by local exporter")
}
if ex.OutputDir == "" {
return nil, errors.New("output directory is required for local exporter")
}
s.Allow(filesync.NewFSSyncTargetDir(ex.OutputDir))
case ExporterOCI, ExporterDocker, ExporterTar:
if ex.OutputDir != "" {
return nil, errors.Errorf("output directory %s is not supported by %s exporter", ex.OutputDir, ex.Type)
}
if ex.Output == nil {
return nil, errors.Errorf("output file writer is required for %s exporter", ex.Type)
}
s.Allow(filesync.NewFSSyncTarget(ex.Output))
default:
if ex.Output != nil {
return nil, errors.Errorf("output file writer is not supported by %s exporter", ex.Type)
}
if ex.OutputDir != "" {
return nil, errors.Errorf("output directory %s is not supported by %s exporter", ex.OutputDir, ex.Type)
duplicateLocalExporter := 0
duplicateOciExporter := 0
duplicateDockerExporter := 0
duplicateTarExporter := 0
for _, ex := range opt.Exports {
switch ex.Type {
case ExporterLocal:
duplicateLocalExporter++
if duplicateLocalExporter > 1 {
return nil, errors.New("using multiple ExporterLocal is not supported")
}
if ex.Output != nil {
return nil, errors.New("output file writer is not supported by local exporter")
}
if ex.OutputDir == "" {
return nil, errors.New("output directory is required for local exporter")
}
s.Allow(filesync.NewFSSyncTargetDir(ex.OutputDir))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some things like output directory do not seem to support multiple afaics. That is fine but please add validation for not allowing 2 local exporters etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Would you recheck please :) ?

case ExporterOCI, ExporterDocker, ExporterTar:
switch ex.Type {
case ExporterOCI:
duplicateOciExporter++
case ExporterDocker:
duplicateDockerExporter++
case ExporterTar:
duplicateTarExporter++
}
if duplicateOciExporter > 1 || duplicateDockerExporter > 1 || duplicateTarExporter > 1 {
return nil, errors.New("using multiple ExporterOCI is not supported")
}
if ex.OutputDir != "" {
return nil, errors.Errorf("output directory %s is not supported by %s exporter", ex.OutputDir, ex.Type)
}
if ex.Output == nil {
return nil, errors.Errorf("output file writer is required for %s exporter", ex.Type)
}
s.Allow(filesync.NewFSSyncTarget(ex.Output))
default:
if ex.Output != nil {
return nil, errors.Errorf("output file writer is not supported by %s exporter", ex.Type)
}
if ex.OutputDir != "" {
return nil, errors.Errorf("output directory %s is not supported by %s exporter", ex.OutputDir, ex.Type)
}
}
}

Expand Down Expand Up @@ -198,11 +211,40 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
frontendInputs[key] = def.ToPB()
}

var exportersTypes []string
var exporterType string
m := &controlapi.SolveRequest{
ExportersAttrs: []*controlapi.ExporterAttrs{},
ExporterAttrs: &controlapi.ExporterAttrs{},
}
expo := &controlapi.ExporterAttrs{
ExporterAttrs: make(map[string]string),
}

if len(opt.Exports) > 1 {
exporterType = ""
m.ExporterAttrs = nil
for _, ex := range opt.Exports {
exportersTypes = append(exportersTypes, ex.Type)
expo.ExporterAttrs = ex.Attrs
m.ExportersAttrs = append(m.ExportersAttrs, expo)
}
}
if len(opt.Exports) == 1 {
exportersTypes = nil
m.ExportersAttrs = nil
exporterType = opt.Exports[0].Type
expo.ExporterAttrs = opt.Exports[0].Attrs
m.ExporterAttrs = expo
}

resp, err := c.controlClient().Solve(ctx, &controlapi.SolveRequest{
Ref: ref,
Definition: pbd,
Exporter: ex.Type,
ExporterAttrs: ex.Attrs,
Exporters: exportersTypes,
ExportersAttrs: m.ExportersAttrs,
Exporter: exporterType,
ExporterAttrs: m.ExporterAttrs,
Session: s.ID(),
Frontend: opt.Frontend,
FrontendAttrs: opt.FrontendAttrs,
Expand All @@ -213,8 +255,13 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
if err != nil {
return errors.Wrap(err, "failed to solve")
}

var exportersResponse []*controlapi.ExporterResponse
for _, v := range resp.ExportersResponse {
exportersResponse = append(exportersResponse, v)
}
res = &SolveResponse{
ExporterResponse: resp.ExporterResponse,
ExportersResponse: exportersResponse,
}
return nil
})
Expand Down Expand Up @@ -299,14 +346,18 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
}
// Update index.json of exported cache content store
// FIXME(AkihiroSuda): dedupe const definition of cache/remotecache.ExporterResponseManifestDesc = "cache.manifest"
if manifestDescJSON := res.ExporterResponse["cache.manifest"]; manifestDescJSON != "" {
var manifestDesc ocispec.Descriptor
if err = json.Unmarshal([]byte(manifestDescJSON), &manifestDesc); err != nil {
return nil, err
}
for indexJSONPath, tag := range cacheOpt.indicesToUpdate {
if err = ociindex.PutDescToIndexJSONFileLocked(indexJSONPath, manifestDesc, tag); err != nil {
return nil, err
if len(res.ExportersResponse) > 0 {
for _, v := range res.ExportersResponse {
if manifestDescJSON := v.ExporterResponse["cache.manifest"]; manifestDescJSON != "" {
var manifestDesc ocispec.Descriptor
if err = json.Unmarshal([]byte(manifestDescJSON), &manifestDesc); err != nil {
return nil, err
}
for indexJSONPath, tag := range cacheOpt.indicesToUpdate {
if err = ociindex.PutDescToIndexJSONFileLocked(indexJSONPath, manifestDesc, tag); err != nil {
return nil, err
}
}
}
}
}
Expand Down
Loading