diff --git a/components/cli/cli/command/image/build.go b/components/cli/cli/command/image/build.go index fc660faddc..1a94e52b9c 100644 --- a/components/cli/cli/command/image/build.go +++ b/components/cli/cli/command/image/build.go @@ -270,10 +270,7 @@ func runBuild(dockerCli command.Cli, options buildOptions) error { } // And canonicalize dockerfile name to a platform-independent one - relDockerfile, err = archive.CanonicalTarNameForPath(relDockerfile) - if err != nil { - return errors.Errorf("cannot canonicalize dockerfile path %s: %v", relDockerfile, err) - } + relDockerfile = archive.CanonicalTarNameForPath(relDockerfile) excludes = build.TrimBuildFilesFromExcludes(excludes, relDockerfile, options.dockerfileFromStdin()) buildCtx, err = archive.TarWithOptions(contextDir, &archive.TarOptions{ diff --git a/components/cli/vendor.conf b/components/cli/vendor.conf index a1b09191af..f32af05797 100755 --- a/components/cli/vendor.conf +++ b/components/cli/vendor.conf @@ -1,12 +1,13 @@ github.com/agl/ed25519 d2b94fd789ea21d12fac1a4443dd3a3f79cda72c github.com/Azure/go-ansiterm d6e3b3328b783f23731bc4d058875b0371ff8109 github.com/beorn7/perks 4c0e84591b9aa9e6dcfdf3e020114cd81f89d5f9 +github.com/containerd/containerd 08f7ee9828af1783dc98cc5cc1739e915697c667 github.com/containerd/continuity d8fb8589b0e8e85b8c8bbaa8840226d0dfeb7371 github.com/coreos/etcd v3.2.1 github.com/cpuguy83/go-md2man v1.0.8 github.com/davecgh/go-spew 346938d642f2ec3594ed81d874461961cd0faa76 github.com/docker/distribution 83389a148052d74ac602f5f1d62f86ff2f3c4aa5 -github.com/docker/docker c752b0991e31ba9869ab6a0661af57e9423874fb +github.com/docker/docker b711437bbd8596312c962d4189e9ad4d2108c2dc github.com/docker/docker-credential-helpers 5241b46610f2491efdf9d1c85f1ddf5b02f6d962 # the docker/go package contains a customized version of canonical/json # and is used by Notary. The package is periodically rebased on current Go versions. @@ -49,12 +50,12 @@ github.com/matttproud/golang_protobuf_extensions v1.0.0 github.com/Microsoft/go-winio v0.4.8 github.com/miekg/pkcs11 5f6e0d0dad6f472df908c8e968a98ef00c9224bb github.com/mitchellh/mapstructure f3009df150dadf309fdee4a54ed65c124afad715 -github.com/moby/buildkit b062a2d8ddbaa477c25c63d68a9cffbb43f6e474 +github.com/moby/buildkit 9acf51e49185b348608e0096b2903dd72907adcb github.com/morikuni/aec 39771216ff4c63d11f5e604076f9c45e8be1067b github.com/Nvveen/Gotty a8b993ba6abdb0e0c12b0125c603323a71c7790c https://github.com/ijc25/Gotty github.com/opencontainers/go-digest v1.0.0-rc1 github.com/opencontainers/image-spec v1.0.1 -github.com/opencontainers/runc 69663f0bd4b60df09991c08812a60108003fa340 +github.com/opencontainers/runc ad0f5255060d36872be04de22f8731f38ef2d7b1 github.com/opentracing/opentracing-go 1361b9cd60be79c4c3a7fa9841b3c132e40066a7 github.com/peterbourgon/diskv 5f041e8faa004a95c88a202771f4cc3e991971e6 github.com/pkg/errors 839d9e913e063e28dfd0e6c7b7512793e0a48be9 diff --git a/components/cli/vendor/github.com/containerd/containerd/LICENSE b/components/cli/vendor/github.com/containerd/containerd/LICENSE new file mode 100644 index 0000000000..584149b6ee --- /dev/null +++ b/components/cli/vendor/github.com/containerd/containerd/LICENSE @@ -0,0 +1,191 @@ + + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + Copyright The containerd Authors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/components/cli/vendor/github.com/containerd/containerd/NOTICE b/components/cli/vendor/github.com/containerd/containerd/NOTICE new file mode 100644 index 0000000000..8915f02773 --- /dev/null +++ b/components/cli/vendor/github.com/containerd/containerd/NOTICE @@ -0,0 +1,16 @@ +Docker +Copyright 2012-2015 Docker, Inc. + +This product includes software developed at Docker, Inc. (https://www.docker.com). + +The following is courtesy of our legal counsel: + + +Use and transfer of Docker may be subject to certain restrictions by the +United States and other governments. +It is your responsibility to ensure that your use and/or transfer does not +violate applicable laws. + +For more information, please see https://www.bis.doc.gov + +See also https://www.apache.org/dev/crypto.html and/or seek legal counsel. diff --git a/components/cli/vendor/github.com/containerd/containerd/README.md b/components/cli/vendor/github.com/containerd/containerd/README.md new file mode 100644 index 0000000000..2130d68cfe --- /dev/null +++ b/components/cli/vendor/github.com/containerd/containerd/README.md @@ -0,0 +1,215 @@ +![banner](/docs/static/img/containerd-dark.png?raw=true) + +[![GoDoc](https://godoc.org/github.com/containerd/containerd?status.svg)](https://godoc.org/github.com/containerd/containerd) +[![Build Status](https://travis-ci.org/containerd/containerd.svg?branch=master)](https://travis-ci.org/containerd/containerd) +[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fcontainerd%2Fcontainerd.svg?type=shield)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fcontainerd%2Fcontainerd?ref=badge_shield) +[![Go Report Card](https://goreportcard.com/badge/github.com/containerd/containerd)](https://goreportcard.com/report/github.com/containerd/containerd) +[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/1271/badge)](https://bestpractices.coreinfrastructure.org/projects/1271) + +containerd is an industry-standard container runtime with an emphasis on simplicity, robustness and portability. It is available as a daemon for Linux and Windows, which can manage the complete container lifecycle of its host system: image transfer and storage, container execution and supervision, low-level storage and network attachments, etc. + +containerd is designed to be embedded into a larger system, rather than being used directly by developers or end-users. + +![architecture](design/architecture.png) + +## Getting Started + +See our documentation on [containerd.io](https://containerd.io): +* [for ops and admins](docs/ops.md) +* [namespaces](docs/namespaces.md) +* [client options](docs/client-opts.md) + +See how to build containerd from source at [BUILDING](BUILDING.md). + +If you are interested in trying out containerd see our example at [Getting Started](docs/getting-started.md). + + +## Runtime Requirements + +Runtime requirements for containerd are very minimal. Most interactions with +the Linux and Windows container feature sets are handled via [runc](https://github.com/opencontainers/runc) and/or +OS-specific libraries (e.g. [hcsshim](https://github.com/Microsoft/hcsshim) for Microsoft). The current required version of `runc` is always listed in [RUNC.md](/RUNC.md). + +There are specific features +used by containerd core code and snapshotters that will require a minimum kernel +version on Linux. With the understood caveat of distro kernel versioning, a +reasonable starting point for Linux is a minimum 4.x kernel version. + +The overlay filesystem snapshotter, used by default, uses features that were +finalized in the 4.x kernel series. If you choose to use btrfs, there may +be more flexibility in kernel version (minimum recommended is 3.18), but will +require the btrfs kernel module and btrfs tools to be installed on your Linux +distribution. + +To use Linux checkpoint and restore features, you will need `criu` installed on +your system. See more details in [Checkpoint and Restore](#checkpoint-and-restore). + +Build requirements for developers are listed in [BUILDING](BUILDING.md). + +## Features + +### Client + +containerd offers a full client package to help you integrate containerd into your platform. + +```go + +import ( + "github.com/containerd/containerd" + "github.com/containerd/containerd/cio" +) + + +func main() { + client, err := containerd.New("/run/containerd/containerd.sock") + defer client.Close() +} + +``` + +### Namespaces + +Namespaces allow multiple consumers to use the same containerd without conflicting with each other. It has the benefit of sharing content but still having separation with containers and images. + +To set a namespace for requests to the API: + +```go +context = context.Background() +// create a context for docker +docker = namespaces.WithNamespace(context, "docker") + +containerd, err := client.NewContainer(docker, "id") +``` + +To set a default namespace on the client: + +```go +client, err := containerd.New(address, containerd.WithDefaultNamespace("docker")) +``` + +### Distribution + +```go +// pull an image +image, err := client.Pull(context, "docker.io/library/redis:latest") + +// push an image +err := client.Push(context, "docker.io/library/redis:latest", image.Target()) +``` + +### Containers + +In containerd, a container is a metadata object. Resources such as an OCI runtime specification, image, root filesystem, and other metadata can be attached to a container. + +```go +redis, err := client.NewContainer(context, "redis-master") +defer redis.Delete(context) +``` + +### OCI Runtime Specification + +containerd fully supports the OCI runtime specification for running containers. We have built in functions to help you generate runtime specifications based on images as well as custom parameters. + +You can specify options when creating a container about how to modify the specification. + +```go +redis, err := client.NewContainer(context, "redis-master", containerd.WithNewSpec(oci.WithImageConfig(image))) +``` + +### Root Filesystems + +containerd allows you to use overlay or snapshot filesystems with your containers. It comes with builtin support for overlayfs and btrfs. + +```go +// pull an image and unpack it into the configured snapshotter +image, err := client.Pull(context, "docker.io/library/redis:latest", containerd.WithPullUnpack) + +// allocate a new RW root filesystem for a container based on the image +redis, err := client.NewContainer(context, "redis-master", + containerd.WithNewSnapshot("redis-rootfs", image), + containerd.WithNewSpec(oci.WithImageConfig(image)), +) + +// use a readonly filesystem with multiple containers +for i := 0; i < 10; i++ { + id := fmt.Sprintf("id-%s", i) + container, err := client.NewContainer(ctx, id, + containerd.WithNewSnapshotView(id, image), + containerd.WithNewSpec(oci.WithImageConfig(image)), + ) +} +``` + +### Tasks + +Taking a container object and turning it into a runnable process on a system is done by creating a new `Task` from the container. A task represents the runnable object within containerd. + +```go +// create a new task +task, err := redis.NewTask(context, cio.Stdio) +defer task.Delete(context) + +// the task is now running and has a pid that can be use to setup networking +// or other runtime settings outside of containerd +pid := task.Pid() + +// start the redis-server process inside the container +err := task.Start(context) + +// wait for the task to exit and get the exit status +status, err := task.Wait(context) +``` + +### Checkpoint and Restore + +If you have [criu](https://criu.org/Main_Page) installed on your machine you can checkpoint and restore containers and their tasks. This allow you to clone and/or live migrate containers to other machines. + +```go +// checkpoint the task then push it to a registry +checkpoint, err := task.Checkpoint(context, containerd.WithExit) + +err := client.Push(context, "myregistry/checkpoints/redis:master", checkpoint) + +// on a new machine pull the checkpoint and restore the redis container +image, err := client.Pull(context, "myregistry/checkpoints/redis:master") + +checkpoint := image.Target() + +redis, err = client.NewContainer(context, "redis-master", containerd.WithCheckpoint(checkpoint, "redis-rootfs")) +defer container.Delete(context) + +task, err = redis.NewTask(context, cio.Stdio, containerd.WithTaskCheckpoint(checkpoint)) +defer task.Delete(context) + +err := task.Start(context) +``` + +### Releases and API Stability + +Please see [RELEASES.md](RELEASES.md) for details on versioning and stability +of containerd components. + +### Development reports. + +Weekly summary on the progress and what is being worked on. +https://github.com/containerd/containerd/tree/master/reports + +### Communication + +For async communication and long running discussions please use issues and pull requests on the github repo. +This will be the best place to discuss design and implementation. + +For sync communication we have a community slack with a #containerd channel that everyone is welcome to join and chat about development. + +**Slack:** https://dockr.ly/community + +### Reporting security issues + +__If you are reporting a security issue, please reach out discreetly at security@containerd.io__. + +## Licenses + +The containerd codebase is released under the [Apache 2.0 license](LICENSE.code). +The README.md file, and files in the "docs" folder are licensed under the +Creative Commons Attribution 4.0 International License. You may obtain a +copy of the license, titled CC-BY-4.0, at http://creativecommons.org/licenses/by/4.0/. diff --git a/components/cli/vendor/github.com/containerd/containerd/errdefs/errors.go b/components/cli/vendor/github.com/containerd/containerd/errdefs/errors.go new file mode 100644 index 0000000000..40427fc5a5 --- /dev/null +++ b/components/cli/vendor/github.com/containerd/containerd/errdefs/errors.go @@ -0,0 +1,78 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +// Package errdefs defines the common errors used throughout containerd +// packages. +// +// Use with errors.Wrap and error.Wrapf to add context to an error. +// +// To detect an error class, use the IsXXX functions to tell whether an error +// is of a certain type. +// +// The functions ToGRPC and FromGRPC can be used to map server-side and +// client-side errors to the correct types. +package errdefs + +import "github.com/pkg/errors" + +// Definitions of common error types used throughout containerd. All containerd +// errors returned by most packages will map into one of these errors classes. +// Packages should return errors of these types when they want to instruct a +// client to take a particular action. +// +// For the most part, we just try to provide local grpc errors. Most conditions +// map very well to those defined by grpc. +var ( + ErrUnknown = errors.New("unknown") // used internally to represent a missed mapping. + ErrInvalidArgument = errors.New("invalid argument") + ErrNotFound = errors.New("not found") + ErrAlreadyExists = errors.New("already exists") + ErrFailedPrecondition = errors.New("failed precondition") + ErrUnavailable = errors.New("unavailable") + ErrNotImplemented = errors.New("not implemented") // represents not supported and unimplemented +) + +// IsInvalidArgument returns true if the error is due to an invalid argument +func IsInvalidArgument(err error) bool { + return errors.Cause(err) == ErrInvalidArgument +} + +// IsNotFound returns true if the error is due to a missing object +func IsNotFound(err error) bool { + return errors.Cause(err) == ErrNotFound +} + +// IsAlreadyExists returns true if the error is due to an already existing +// metadata item +func IsAlreadyExists(err error) bool { + return errors.Cause(err) == ErrAlreadyExists +} + +// IsFailedPrecondition returns true if an operation could not proceed to the +// lack of a particular condition +func IsFailedPrecondition(err error) bool { + return errors.Cause(err) == ErrFailedPrecondition +} + +// IsUnavailable returns true if the error is due to a resource being unavailable +func IsUnavailable(err error) bool { + return errors.Cause(err) == ErrUnavailable +} + +// IsNotImplemented returns true if the error is due to not being implemented +func IsNotImplemented(err error) bool { + return errors.Cause(err) == ErrNotImplemented +} diff --git a/components/cli/vendor/github.com/containerd/containerd/errdefs/grpc.go b/components/cli/vendor/github.com/containerd/containerd/errdefs/grpc.go new file mode 100644 index 0000000000..4eab03ab86 --- /dev/null +++ b/components/cli/vendor/github.com/containerd/containerd/errdefs/grpc.go @@ -0,0 +1,138 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package errdefs + +import ( + "strings" + + "github.com/pkg/errors" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// ToGRPC will attempt to map the backend containerd error into a grpc error, +// using the original error message as a description. +// +// Further information may be extracted from certain errors depending on their +// type. +// +// If the error is unmapped, the original error will be returned to be handled +// by the regular grpc error handling stack. +func ToGRPC(err error) error { + if err == nil { + return nil + } + + if isGRPCError(err) { + // error has already been mapped to grpc + return err + } + + switch { + case IsInvalidArgument(err): + return status.Errorf(codes.InvalidArgument, err.Error()) + case IsNotFound(err): + return status.Errorf(codes.NotFound, err.Error()) + case IsAlreadyExists(err): + return status.Errorf(codes.AlreadyExists, err.Error()) + case IsFailedPrecondition(err): + return status.Errorf(codes.FailedPrecondition, err.Error()) + case IsUnavailable(err): + return status.Errorf(codes.Unavailable, err.Error()) + case IsNotImplemented(err): + return status.Errorf(codes.Unimplemented, err.Error()) + } + + return err +} + +// ToGRPCf maps the error to grpc error codes, assembling the formatting string +// and combining it with the target error string. +// +// This is equivalent to errors.ToGRPC(errors.Wrapf(err, format, args...)) +func ToGRPCf(err error, format string, args ...interface{}) error { + return ToGRPC(errors.Wrapf(err, format, args...)) +} + +// FromGRPC returns the underlying error from a grpc service based on the grpc error code +func FromGRPC(err error) error { + if err == nil { + return nil + } + + var cls error // divide these into error classes, becomes the cause + + switch code(err) { + case codes.InvalidArgument: + cls = ErrInvalidArgument + case codes.AlreadyExists: + cls = ErrAlreadyExists + case codes.NotFound: + cls = ErrNotFound + case codes.Unavailable: + cls = ErrUnavailable + case codes.FailedPrecondition: + cls = ErrFailedPrecondition + case codes.Unimplemented: + cls = ErrNotImplemented + default: + cls = ErrUnknown + } + + msg := rebaseMessage(cls, err) + if msg != "" { + err = errors.Wrapf(cls, msg) + } else { + err = errors.WithStack(cls) + } + + return err +} + +// rebaseMessage removes the repeats for an error at the end of an error +// string. This will happen when taking an error over grpc then remapping it. +// +// Effectively, we just remove the string of cls from the end of err if it +// appears there. +func rebaseMessage(cls error, err error) string { + desc := errDesc(err) + clss := cls.Error() + if desc == clss { + return "" + } + + return strings.TrimSuffix(desc, ": "+clss) +} + +func isGRPCError(err error) bool { + _, ok := status.FromError(err) + return ok +} + +func code(err error) codes.Code { + if s, ok := status.FromError(err); ok { + return s.Code() + } + return codes.Unknown +} + +func errDesc(err error) string { + if s, ok := status.FromError(err); ok { + return s.Message() + } + return err.Error() +} diff --git a/components/cli/vendor/github.com/containerd/containerd/log/context.go b/components/cli/vendor/github.com/containerd/containerd/log/context.go new file mode 100644 index 0000000000..f40603b17b --- /dev/null +++ b/components/cli/vendor/github.com/containerd/containerd/log/context.go @@ -0,0 +1,86 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package log + +import ( + "context" + "sync/atomic" + + "github.com/sirupsen/logrus" +) + +var ( + // G is an alias for GetLogger. + // + // We may want to define this locally to a package to get package tagged log + // messages. + G = GetLogger + + // L is an alias for the the standard logger. + L = logrus.NewEntry(logrus.StandardLogger()) +) + +type ( + loggerKey struct{} +) + +// TraceLevel is the log level for tracing. Trace level is lower than debug level, +// and is usually used to trace detailed behavior of the program. +const TraceLevel = logrus.Level(uint32(logrus.DebugLevel + 1)) + +// ParseLevel takes a string level and returns the Logrus log level constant. +// It supports trace level. +func ParseLevel(lvl string) (logrus.Level, error) { + if lvl == "trace" { + return TraceLevel, nil + } + return logrus.ParseLevel(lvl) +} + +// WithLogger returns a new context with the provided logger. Use in +// combination with logger.WithField(s) for great effect. +func WithLogger(ctx context.Context, logger *logrus.Entry) context.Context { + return context.WithValue(ctx, loggerKey{}, logger) +} + +// GetLogger retrieves the current logger from the context. If no logger is +// available, the default logger is returned. +func GetLogger(ctx context.Context) *logrus.Entry { + logger := ctx.Value(loggerKey{}) + + if logger == nil { + return L + } + + return logger.(*logrus.Entry) +} + +// Trace logs a message at level Trace with the log entry passed-in. +func Trace(e *logrus.Entry, args ...interface{}) { + level := logrus.Level(atomic.LoadUint32((*uint32)(&e.Logger.Level))) + if level >= TraceLevel { + e.Debug(args...) + } +} + +// Tracef logs a message at level Trace with the log entry passed-in. +func Tracef(e *logrus.Entry, format string, args ...interface{}) { + level := logrus.Level(atomic.LoadUint32((*uint32)(&e.Logger.Level))) + if level >= TraceLevel { + e.Debugf(format, args...) + } +} diff --git a/components/cli/vendor/github.com/containerd/containerd/platforms/cpuinfo.go b/components/cli/vendor/github.com/containerd/containerd/platforms/cpuinfo.go new file mode 100644 index 0000000000..a5c5ab42b9 --- /dev/null +++ b/components/cli/vendor/github.com/containerd/containerd/platforms/cpuinfo.go @@ -0,0 +1,101 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package platforms + +import ( + "bufio" + "os" + "runtime" + "strings" + + "github.com/containerd/containerd/errdefs" + "github.com/containerd/containerd/log" + "github.com/pkg/errors" +) + +// Present the ARM instruction set architecture, eg: v7, v8 +var cpuVariant string + +func init() { + if isArmArch(runtime.GOARCH) { + cpuVariant = getCPUVariant() + } else { + cpuVariant = "" + } +} + +// For Linux, the kernel has already detected the ABI, ISA and Features. +// So we don't need to access the ARM registers to detect platform information +// by ourselves. We can just parse these information from /proc/cpuinfo +func getCPUInfo(pattern string) (info string, err error) { + if !isLinuxOS(runtime.GOOS) { + return "", errors.Wrapf(errdefs.ErrNotImplemented, "getCPUInfo for OS %s", runtime.GOOS) + } + + cpuinfo, err := os.Open("/proc/cpuinfo") + if err != nil { + return "", err + } + defer cpuinfo.Close() + + // Start to Parse the Cpuinfo line by line. For SMP SoC, we parse + // the first core is enough. + scanner := bufio.NewScanner(cpuinfo) + for scanner.Scan() { + newline := scanner.Text() + list := strings.Split(newline, ":") + + if len(list) > 1 && strings.EqualFold(strings.TrimSpace(list[0]), pattern) { + return strings.TrimSpace(list[1]), nil + } + } + + // Check whether the scanner encountered errors + err = scanner.Err() + if err != nil { + return "", err + } + + return "", errors.Wrapf(errdefs.ErrNotFound, "getCPUInfo for pattern: %s", pattern) +} + +func getCPUVariant() string { + variant, err := getCPUInfo("Cpu architecture") + if err != nil { + log.L.WithError(err).Error("failure getting variant") + return "" + } + + switch variant { + case "8": + variant = "v8" + case "7", "7M", "?(12)", "?(13)", "?(14)", "?(15)", "?(16)", "?(17)": + variant = "v7" + case "6", "6TEJ": + variant = "v6" + case "5", "5T", "5TE", "5TEJ": + variant = "v5" + case "4", "4T": + variant = "v4" + case "3": + variant = "v3" + default: + variant = "unknown" + } + + return variant +} diff --git a/components/cli/vendor/github.com/containerd/containerd/platforms/database.go b/components/cli/vendor/github.com/containerd/containerd/platforms/database.go new file mode 100644 index 0000000000..8e85448ed0 --- /dev/null +++ b/components/cli/vendor/github.com/containerd/containerd/platforms/database.go @@ -0,0 +1,114 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package platforms + +import ( + "runtime" + "strings" +) + +// isLinuxOS returns true if the operating system is Linux. +// +// The OS value should be normalized before calling this function. +func isLinuxOS(os string) bool { + return os == "linux" +} + +// These function are generated from from https://golang.org/src/go/build/syslist.go. +// +// We use switch statements because they are slightly faster than map lookups +// and use a little less memory. + +// isKnownOS returns true if we know about the operating system. +// +// The OS value should be normalized before calling this function. +func isKnownOS(os string) bool { + switch os { + case "android", "darwin", "dragonfly", "freebsd", "linux", "nacl", "netbsd", "openbsd", "plan9", "solaris", "windows", "zos": + return true + } + return false +} + +// isArmArch returns true if the architecture is ARM. +// +// The arch value should be normalized before being passed to this function. +func isArmArch(arch string) bool { + switch arch { + case "arm", "arm64": + return true + } + return false +} + +// isKnownArch returns true if we know about the architecture. +// +// The arch value should be normalized before being passed to this function. +func isKnownArch(arch string) bool { + switch arch { + case "386", "amd64", "amd64p32", "arm", "armbe", "arm64", "arm64be", "ppc64", "ppc64le", "mips", "mipsle", "mips64", "mips64le", "mips64p32", "mips64p32le", "ppc", "s390", "s390x", "sparc", "sparc64": + return true + } + return false +} + +func normalizeOS(os string) string { + if os == "" { + return runtime.GOOS + } + os = strings.ToLower(os) + + switch os { + case "macos": + os = "darwin" + } + return os +} + +// normalizeArch normalizes the architecture. +func normalizeArch(arch, variant string) (string, string) { + arch, variant = strings.ToLower(arch), strings.ToLower(variant) + switch arch { + case "i386": + arch = "386" + variant = "" + case "x86_64", "x86-64": + arch = "amd64" + variant = "" + case "aarch64", "arm64": + arch = "arm64" + switch variant { + case "8", "v8": + variant = "" + } + case "armhf": + arch = "arm" + variant = "v7" + case "armel": + arch = "arm" + variant = "v6" + case "arm": + switch variant { + case "", "7": + variant = "v7" + case "5", "6", "8": + variant = "v" + variant + } + } + + return arch, variant +} diff --git a/components/cli/vendor/github.com/containerd/containerd/platforms/defaults.go b/components/cli/vendor/github.com/containerd/containerd/platforms/defaults.go new file mode 100644 index 0000000000..dee59abadc --- /dev/null +++ b/components/cli/vendor/github.com/containerd/containerd/platforms/defaults.go @@ -0,0 +1,38 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package platforms + +import ( + "runtime" + + specs "github.com/opencontainers/image-spec/specs-go/v1" +) + +// Default returns the default specifier for the platform. +func Default() string { + return Format(DefaultSpec()) +} + +// DefaultSpec returns the current platform's default platform specification. +func DefaultSpec() specs.Platform { + return specs.Platform{ + OS: runtime.GOOS, + Architecture: runtime.GOARCH, + // The Variant field will be empty if arch != ARM. + Variant: cpuVariant, + } +} diff --git a/components/cli/vendor/github.com/containerd/containerd/platforms/platforms.go b/components/cli/vendor/github.com/containerd/containerd/platforms/platforms.go new file mode 100644 index 0000000000..29b7ad6b5e --- /dev/null +++ b/components/cli/vendor/github.com/containerd/containerd/platforms/platforms.go @@ -0,0 +1,268 @@ +/* + Copyright The containerd Authors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +// Package platforms provides a toolkit for normalizing, matching and +// specifying container platforms. +// +// Centered around OCI platform specifications, we define a string-based +// specifier syntax that can be used for user input. With a specifier, users +// only need to specify the parts of the platform that are relevant to their +// context, providing an operating system or architecture or both. +// +// How do I use this package? +// +// The vast majority of use cases should simply use the match function with +// user input. The first step is to parse a specifier into a matcher: +// +// m, err := Parse("linux") +// if err != nil { ... } +// +// Once you have a matcher, use it to match against the platform declared by a +// component, typically from an image or runtime. Since extracting an images +// platform is a little more involved, we'll use an example against the +// platform default: +// +// if ok := m.Match(Default()); !ok { /* doesn't match */ } +// +// This can be composed in loops for resolving runtimes or used as a filter for +// fetch and select images. +// +// More details of the specifier syntax and platform spec follow. +// +// Declaring Platform Support +// +// Components that have strict platform requirements should use the OCI +// platform specification to declare their support. Typically, this will be +// images and runtimes that should make these declaring which platform they +// support specifically. This looks roughly as follows: +// +// type Platform struct { +// Architecture string +// OS string +// Variant string +// } +// +// Most images and runtimes should at least set Architecture and OS, according +// to their GOARCH and GOOS values, respectively (follow the OCI image +// specification when in doubt). ARM should set variant under certain +// discussions, which are outlined below. +// +// Platform Specifiers +// +// While the OCI platform specifications provide a tool for components to +// specify structured information, user input typically doesn't need the full +// context and much can be inferred. To solve this problem, we introduced +// "specifiers". A specifier has the format +// `||/[/]`. The user can provide either the +// operating system or the architecture or both. +// +// An example of a common specifier is `linux/amd64`. If the host has a default +// of runtime that matches this, the user can simply provide the component that +// matters. For example, if a image provides amd64 and arm64 support, the +// operating system, `linux` can be inferred, so they only have to provide +// `arm64` or `amd64`. Similar behavior is implemented for operating systems, +// where the architecture may be known but a runtime may support images from +// different operating systems. +// +// Normalization +// +// Because not all users are familiar with the way the Go runtime represents +// platforms, several normalizations have been provided to make this package +// easier to user. +// +// The following are performed for architectures: +// +// Value Normalized +// aarch64 arm64 +// armhf arm +// armel arm/v6 +// i386 386 +// x86_64 amd64 +// x86-64 amd64 +// +// We also normalize the operating system `macos` to `darwin`. +// +// ARM Support +// +// To qualify ARM architecture, the Variant field is used to qualify the arm +// version. The most common arm version, v7, is represented without the variant +// unless it is explicitly provided. This is treated as equivalent to armhf. A +// previous architecture, armel, will be normalized to arm/v6. +// +// While these normalizations are provided, their support on arm platforms has +// not yet been fully implemented and tested. +package platforms + +import ( + "regexp" + "runtime" + "strings" + + "github.com/containerd/containerd/errdefs" + specs "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/pkg/errors" +) + +var ( + specifierRe = regexp.MustCompile(`^[A-Za-z0-9_-]+$`) +) + +// Matcher matches platforms specifications, provided by an image or runtime. +type Matcher interface { + Match(platform specs.Platform) bool +} + +// NewMatcher returns a simple matcher based on the provided platform +// specification. The returned matcher only looks for equality based on os, +// architecture and variant. +// +// One may implement their own matcher if this doesn't provide the the required +// functionality. +// +// Applications should opt to use `Match` over directly parsing specifiers. +func NewMatcher(platform specs.Platform) Matcher { + return &matcher{ + Platform: Normalize(platform), + } +} + +type matcher struct { + specs.Platform +} + +func (m *matcher) Match(platform specs.Platform) bool { + normalized := Normalize(platform) + return m.OS == normalized.OS && + m.Architecture == normalized.Architecture && + m.Variant == normalized.Variant +} + +func (m *matcher) String() string { + return Format(m.Platform) +} + +// Parse parses the platform specifier syntax into a platform declaration. +// +// Platform specifiers are in the format `||/[/]`. +// The minimum required information for a platform specifier is the operating +// system or architecture. If there is only a single string (no slashes), the +// value will be matched against the known set of operating systems, then fall +// back to the known set of architectures. The missing component will be +// inferred based on the local environment. +func Parse(specifier string) (specs.Platform, error) { + if strings.Contains(specifier, "*") { + // TODO(stevvooe): need to work out exact wildcard handling + return specs.Platform{}, errors.Wrapf(errdefs.ErrInvalidArgument, "%q: wildcards not yet supported", specifier) + } + + parts := strings.Split(specifier, "/") + + for _, part := range parts { + if !specifierRe.MatchString(part) { + return specs.Platform{}, errors.Wrapf(errdefs.ErrInvalidArgument, "%q is an invalid component of %q: platform specifier component must match %q", part, specifier, specifierRe.String()) + } + } + + var p specs.Platform + switch len(parts) { + case 1: + // in this case, we will test that the value might be an OS, then look + // it up. If it is not known, we'll treat it as an architecture. Since + // we have very little information about the platform here, we are + // going to be a little more strict if we don't know about the argument + // value. + p.OS = normalizeOS(parts[0]) + if isKnownOS(p.OS) { + // picks a default architecture + p.Architecture = runtime.GOARCH + if p.Architecture == "arm" { + // TODO(stevvooe): Resolve arm variant, if not v6 (default) + return specs.Platform{}, errors.Wrapf(errdefs.ErrNotImplemented, "arm support not fully implemented") + } + + return p, nil + } + + p.Architecture, p.Variant = normalizeArch(parts[0], "") + if p.Architecture == "arm" && p.Variant == "v7" { + p.Variant = "" + } + if isKnownArch(p.Architecture) { + p.OS = runtime.GOOS + return p, nil + } + + return specs.Platform{}, errors.Wrapf(errdefs.ErrInvalidArgument, "%q: unknown operating system or architecture", specifier) + case 2: + // In this case, we treat as a regular os/arch pair. We don't care + // about whether or not we know of the platform. + p.OS = normalizeOS(parts[0]) + p.Architecture, p.Variant = normalizeArch(parts[1], "") + if p.Architecture == "arm" && p.Variant == "v7" { + p.Variant = "" + } + + return p, nil + case 3: + // we have a fully specified variant, this is rare + p.OS = normalizeOS(parts[0]) + p.Architecture, p.Variant = normalizeArch(parts[1], parts[2]) + if p.Architecture == "arm64" && p.Variant == "" { + p.Variant = "v8" + } + + return p, nil + } + + return specs.Platform{}, errors.Wrapf(errdefs.ErrInvalidArgument, "%q: cannot parse platform specifier", specifier) +} + +// Format returns a string specifier from the provided platform specification. +func Format(platform specs.Platform) string { + if platform.OS == "" { + return "unknown" + } + + return joinNotEmpty(platform.OS, platform.Architecture, platform.Variant) +} + +func joinNotEmpty(s ...string) string { + var ss []string + for _, s := range s { + if s == "" { + continue + } + + ss = append(ss, s) + } + + return strings.Join(ss, "/") +} + +// Normalize validates and translate the platform to the canonical value. +// +// For example, if "Aarch64" is encountered, we change it to "arm64" or if +// "x86_64" is encountered, it becomes "amd64". +func Normalize(platform specs.Platform) specs.Platform { + platform.OS = normalizeOS(platform.OS) + platform.Architecture, platform.Variant = normalizeArch(platform.Architecture, platform.Variant) + + // these fields are deprecated, remove them + platform.OSFeatures = nil + platform.OSVersion = "" + + return platform +} diff --git a/components/cli/vendor/github.com/containerd/containerd/vendor.conf b/components/cli/vendor/github.com/containerd/containerd/vendor.conf new file mode 100644 index 0000000000..2e100c1619 --- /dev/null +++ b/components/cli/vendor/github.com/containerd/containerd/vendor.conf @@ -0,0 +1,83 @@ +github.com/containerd/go-runc f271fa2021de855d4d918dbef83c5fe19db1bdd5 +github.com/containerd/console 9290d21dc56074581f619579c43d970b4514bc08 +github.com/containerd/cgroups fe281dd265766145e943a034aa41086474ea6130 +github.com/containerd/typeurl f6943554a7e7e88b3c14aad190bf05932da84788 +github.com/containerd/fifo 3d5202aec260678c48179c56f40e6f38a095738c +github.com/containerd/btrfs 2e1aa0ddf94f91fa282b6ed87c23bf0d64911244 +github.com/containerd/continuity d3c23511c1bf5851696cba83143d9cbcd666869b +github.com/coreos/go-systemd 48702e0da86bd25e76cfef347e2adeb434a0d0a6 +github.com/docker/go-metrics 4ea375f7759c82740c893fc030bc37088d2ec098 +github.com/docker/go-events 9461782956ad83b30282bf90e31fa6a70c255ba9 +github.com/docker/go-units v0.3.1 +github.com/godbus/dbus c7fdd8b5cd55e87b4e1f4e372cdb1db61dd6c66f +github.com/prometheus/client_golang f4fb1b73fb099f396a7f0036bf86aa8def4ed823 +github.com/prometheus/client_model 99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c +github.com/prometheus/common 89604d197083d4781071d3c65855d24ecfb0a563 +github.com/prometheus/procfs cb4147076ac75738c9a7d279075a253c0cc5acbd +github.com/beorn7/perks 4c0e84591b9aa9e6dcfdf3e020114cd81f89d5f9 +github.com/matttproud/golang_protobuf_extensions v1.0.0 +github.com/gogo/protobuf v1.0.0 +github.com/gogo/googleapis 08a7655d27152912db7aaf4f983275eaf8d128ef +github.com/golang/protobuf v1.1.0 +github.com/opencontainers/runtime-spec v1.0.1 +github.com/opencontainers/runc 69663f0bd4b60df09991c08812a60108003fa340 +github.com/sirupsen/logrus v1.0.0 +github.com/urfave/cli 7bc6a0acffa589f415f88aca16cc1de5ffd66f9c +golang.org/x/net b3756b4b77d7b13260a0a2ec658753cf48922eac +google.golang.org/grpc v1.12.0 +github.com/pkg/errors v0.8.0 +github.com/opencontainers/go-digest c9281466c8b2f606084ac71339773efd177436e7 +golang.org/x/sys 314a259e304ff91bd6985da2a7149bbf91237993 https://github.com/golang/sys +github.com/opencontainers/image-spec v1.0.1 +golang.org/x/sync 450f422ab23cf9881c94e2db30cac0eb1b7cf80c +github.com/BurntSushi/toml a368813c5e648fee92e5f6c30e3944ff9d5e8895 +github.com/grpc-ecosystem/go-grpc-prometheus 6b7015e65d366bf3f19b2b2a000a831940f0f7e0 +github.com/Microsoft/go-winio v0.4.7 +github.com/Microsoft/hcsshim v0.6.11 +github.com/boltdb/bolt e9cf4fae01b5a8ff89d0ec6b32f0d9c9f79aefdd +google.golang.org/genproto d80a6e20e776b0b17a324d0ba1ab50a39c8e8944 +golang.org/x/text 19e51611da83d6be54ddafce4a4af510cb3e9ea4 +github.com/stevvooe/ttrpc d4528379866b0ce7e9d71f3eb96f0582fc374577 +github.com/syndtr/gocapability db04d3cc01c8b54962a58ec7e491717d06cfcc16 +gotest.tools v2.1.0 +github.com/google/go-cmp v0.1.0 + +github.com/containerd/cri 8bcb9a95394e8d7845da1d6a994d3ac2a86d22f0 +github.com/containerd/go-cni f2d7272f12d045b16ed924f50e91f9f9cecc55a7 +github.com/blang/semver v3.1.0 +github.com/containernetworking/cni v0.6.0 +github.com/containernetworking/plugins v0.7.0 +github.com/davecgh/go-spew v1.1.0 +github.com/docker/distribution b38e5838b7b2f2ad48e06ec4b500011976080621 +github.com/docker/docker 86f080cff0914e9694068ed78d503701667c4c00 +github.com/docker/spdystream 449fdfce4d962303d702fec724ef0ad181c92528 +github.com/emicklei/go-restful ff4f55a206334ef123e4f79bbf348980da81ca46 +github.com/ghodss/yaml 73d445a93680fa1a78ae23a5839bad48f32ba1ee +github.com/golang/glog 44145f04b68cf362d9c4df2182967c2275eaefed +github.com/google/gofuzz 44d81051d367757e1c7c6a5a86423ece9afcf63c +github.com/hashicorp/errwrap 7554cd9344cec97297fa6649b055a8c98c2a1e55 +github.com/hashicorp/go-multierror ed905158d87462226a13fe39ddf685ea65f1c11f +github.com/json-iterator/go 1.0.4 +github.com/opencontainers/runtime-tools 6073aff4ac61897f75895123f7e24135204a404d +github.com/opencontainers/selinux 4a2974bf1ee960774ffd517717f1f45325af0206 +github.com/seccomp/libseccomp-golang 32f571b70023028bd57d9288c20efbcb237f3ce0 +github.com/spf13/pflag v1.0.0 +github.com/tchap/go-patricia 5ad6cdb7538b0097d5598c7e57f0a24072adf7dc +golang.org/x/crypto 49796115aa4b964c318aad4f3084fdb41e9aa067 +golang.org/x/time f51c12702a4d776e4c1fa9b0fabab841babae631 +gopkg.in/inf.v0 3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4 +gopkg.in/yaml.v2 53feefa2559fb8dfa8d81baad31be332c97d6c77 +k8s.io/api 7e796de92438aede7cb5d6bcf6c10f4fa65db560 +k8s.io/apimachinery fcb9a12f7875d01f8390b28faedc37dcf2e713b9 +k8s.io/apiserver 4a8377c547bbff4576a35b5b5bf4026d9b5aa763 +k8s.io/client-go b9a0cf870f239c4a4ecfd3feb075a50e7cbe1473 +k8s.io/kubernetes v1.10.0 +k8s.io/utils 258e2a2fa64568210fbd6267cf1d8fd87c3cb86e + +# zfs dependencies +github.com/containerd/zfs 9a0b8b8b5982014b729cd34eb7cd7a11062aa6ec +github.com/mistifyio/go-zfs 166add352731e515512690329794ee593f1aaff2 +github.com/pborman/uuid c65b2f87fee37d1c7854c9164a450713c28d50cd + +# aufs dependencies +github.com/containerd/aufs a7fbd554da7a9eafbe5a460a421313a9fd18d988 diff --git a/components/cli/vendor/github.com/docker/docker/api/types/client.go b/components/cli/vendor/github.com/docker/docker/api/types/client.go index 3df8d23368..3b698c2c24 100644 --- a/components/cli/vendor/github.com/docker/docker/api/types/client.go +++ b/components/cli/vendor/github.com/docker/docker/api/types/client.go @@ -7,7 +7,7 @@ import ( "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/filters" - "github.com/docker/go-units" + units "github.com/docker/go-units" ) // CheckpointCreateOptions holds parameters to create a checkpoint from a container diff --git a/components/cli/vendor/github.com/docker/docker/api/types/configs.go b/components/cli/vendor/github.com/docker/docker/api/types/configs.go index f6537a27f2..178e911a7a 100644 --- a/components/cli/vendor/github.com/docker/docker/api/types/configs.go +++ b/components/cli/vendor/github.com/docker/docker/api/types/configs.go @@ -55,3 +55,10 @@ type PluginEnableConfig struct { type PluginDisableConfig struct { ForceDisable bool } + +// NetworkListConfig stores the options available for listing networks +type NetworkListConfig struct { + // TODO(@cpuguy83): naming is hard, this is pulled from what was being used in the router before moving here + Detailed bool + Verbose bool +} diff --git a/components/cli/vendor/github.com/docker/docker/api/types/network/network.go b/components/cli/vendor/github.com/docker/docker/api/types/network/network.go index 761d0b34f2..ccb448f23a 100644 --- a/components/cli/vendor/github.com/docker/docker/api/types/network/network.go +++ b/components/cli/vendor/github.com/docker/docker/api/types/network/network.go @@ -1,4 +1,8 @@ package network // import "github.com/docker/docker/api/types/network" +import ( + "github.com/docker/docker/api/types/filters" + "github.com/docker/docker/errdefs" +) // Address represents an IP address type Address struct { @@ -106,3 +110,17 @@ type NetworkingConfig struct { type ConfigReference struct { Network string } + +var acceptedFilters = map[string]bool{ + "driver": true, + "type": true, + "name": true, + "id": true, + "label": true, + "scope": true, +} + +// ValidateFilters validates the list of filter args with the available filters. +func ValidateFilters(filter filters.Args) error { + return errdefs.InvalidParameter(filter.Validate(acceptedFilters)) +} diff --git a/components/cli/vendor/github.com/docker/docker/client/image_build.go b/components/cli/vendor/github.com/docker/docker/client/image_build.go index dff19b989f..9add3c10b3 100644 --- a/components/cli/vendor/github.com/docker/docker/client/image_build.go +++ b/components/cli/vendor/github.com/docker/docker/client/image_build.go @@ -30,12 +30,6 @@ func (cli *Client) ImageBuild(ctx context.Context, buildContext io.Reader, optio } headers.Add("X-Registry-Config", base64.URLEncoding.EncodeToString(buf)) - if options.Platform != "" { - if err := cli.NewVersionError("1.32", "platform"); err != nil { - return types.ImageBuildResponse{}, err - } - query.Set("platform", options.Platform) - } headers.Set("Content-Type", "application/x-tar") serverResp, err := cli.postRaw(ctx, "/build", query, buildContext, headers) @@ -131,6 +125,9 @@ func (cli *Client) imageBuildOptionsToQuery(options types.ImageBuildOptions) (ur query.Set("session", options.SessionID) } if options.Platform != "" { + if err := cli.NewVersionError("1.32", "platform"); err != nil { + return query, err + } query.Set("platform", strings.ToLower(options.Platform)) } if options.BuildID != "" { diff --git a/components/cli/vendor/github.com/docker/docker/pkg/archive/archive.go b/components/cli/vendor/github.com/docker/docker/pkg/archive/archive.go index daddebded4..86922ddcac 100644 --- a/components/cli/vendor/github.com/docker/docker/pkg/archive/archive.go +++ b/components/cli/vendor/github.com/docker/docker/pkg/archive/archive.go @@ -367,11 +367,7 @@ func FileInfoHeader(name string, fi os.FileInfo, link string) (*tar.Header, erro hdr.AccessTime = time.Time{} hdr.ChangeTime = time.Time{} hdr.Mode = fillGo18FileTypeBits(int64(chmodTarEntry(os.FileMode(hdr.Mode))), fi) - name, err = canonicalTarName(name, fi.IsDir()) - if err != nil { - return nil, fmt.Errorf("tar: cannot canonicalize path: %v", err) - } - hdr.Name = name + hdr.Name = canonicalTarName(name, fi.IsDir()) if err := setHeaderForSpecialDevice(hdr, name, fi.Sys()); err != nil { return nil, err } @@ -447,17 +443,14 @@ func newTarAppender(idMapping *idtools.IDMappings, writer io.Writer, chownOpts * // canonicalTarName provides a platform-independent and consistent posix-style //path for files and directories to be archived regardless of the platform. -func canonicalTarName(name string, isDir bool) (string, error) { - name, err := CanonicalTarNameForPath(name) - if err != nil { - return "", err - } +func canonicalTarName(name string, isDir bool) string { + name = CanonicalTarNameForPath(name) // suffix with '/' for directories if isDir && !strings.HasSuffix(name, "/") { name += "/" } - return name, nil + return name } // addTarFile adds to the tar archive a file from `path` as `name` diff --git a/components/cli/vendor/github.com/docker/docker/pkg/archive/archive_unix.go b/components/cli/vendor/github.com/docker/docker/pkg/archive/archive_unix.go index e81076c170..fda3f50c6a 100644 --- a/components/cli/vendor/github.com/docker/docker/pkg/archive/archive_unix.go +++ b/components/cli/vendor/github.com/docker/docker/pkg/archive/archive_unix.go @@ -32,8 +32,8 @@ func getWalkRoot(srcPath string, include string) string { // CanonicalTarNameForPath returns platform-specific filepath // to canonical posix-style path for tar archival. p is relative // path. -func CanonicalTarNameForPath(p string) (string, error) { - return p, nil // already unix-style +func CanonicalTarNameForPath(p string) string { + return p // already unix-style } // chmodTarEntry is used to adjust the file permissions used in tar header based diff --git a/components/cli/vendor/github.com/docker/docker/pkg/archive/archive_windows.go b/components/cli/vendor/github.com/docker/docker/pkg/archive/archive_windows.go index 69aadd823c..3160c5a8fd 100644 --- a/components/cli/vendor/github.com/docker/docker/pkg/archive/archive_windows.go +++ b/components/cli/vendor/github.com/docker/docker/pkg/archive/archive_windows.go @@ -2,10 +2,8 @@ package archive // import "github.com/docker/docker/pkg/archive" import ( "archive/tar" - "fmt" "os" "path/filepath" - "strings" "github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/longpath" @@ -26,16 +24,8 @@ func getWalkRoot(srcPath string, include string) string { // CanonicalTarNameForPath returns platform-specific filepath // to canonical posix-style path for tar archival. p is relative // path. -func CanonicalTarNameForPath(p string) (string, error) { - // windows: convert windows style relative path with backslashes - // into forward slashes. Since windows does not allow '/' or '\' - // in file names, it is mostly safe to replace however we must - // check just in case - if strings.Contains(p, "/") { - return "", fmt.Errorf("Windows path contains forward slash: %s", p) - } - return strings.Replace(p, string(os.PathSeparator), "/", -1), nil - +func CanonicalTarNameForPath(p string) string { + return filepath.ToSlash(p) } // chmodTarEntry is used to adjust the file permissions used in tar header based diff --git a/components/cli/vendor/github.com/docker/docker/pkg/archive/changes_linux.go b/components/cli/vendor/github.com/docker/docker/pkg/archive/changes_linux.go index 78a5393c8e..f8792b3d4e 100644 --- a/components/cli/vendor/github.com/docker/docker/pkg/archive/changes_linux.go +++ b/components/cli/vendor/github.com/docker/docker/pkg/archive/changes_linux.go @@ -284,30 +284,3 @@ func clen(n []byte) int { } return len(n) } - -// OverlayChanges walks the path rw and determines changes for the files in the path, -// with respect to the parent layers -func OverlayChanges(layers []string, rw string) ([]Change, error) { - return changes(layers, rw, overlayDeletedFile, nil) -} - -func overlayDeletedFile(root, path string, fi os.FileInfo) (string, error) { - if fi.Mode()&os.ModeCharDevice != 0 { - s := fi.Sys().(*syscall.Stat_t) - if unix.Major(uint64(s.Rdev)) == 0 && unix.Minor(uint64(s.Rdev)) == 0 { // nolint: unconvert - return path, nil - } - } - if fi.Mode()&os.ModeDir != 0 { - opaque, err := system.Lgetxattr(filepath.Join(root, path), "trusted.overlay.opaque") - if err != nil { - return "", err - } - if len(opaque) == 1 && opaque[0] == 'y' { - return path, nil - } - } - - return "", nil - -} diff --git a/components/cli/vendor/github.com/docker/docker/pkg/streamformatter/streamformatter.go b/components/cli/vendor/github.com/docker/docker/pkg/streamformatter/streamformatter.go index 2b5e713040..04917d49ab 100644 --- a/components/cli/vendor/github.com/docker/docker/pkg/streamformatter/streamformatter.go +++ b/components/cli/vendor/github.com/docker/docker/pkg/streamformatter/streamformatter.go @@ -139,14 +139,14 @@ type AuxFormatter struct { } // Emit emits the given interface as an aux progress message -func (sf *AuxFormatter) Emit(aux interface{}) error { +func (sf *AuxFormatter) Emit(id string, aux interface{}) error { auxJSONBytes, err := json.Marshal(aux) if err != nil { return err } auxJSON := new(json.RawMessage) *auxJSON = auxJSONBytes - msgJSON, err := json.Marshal(&jsonmessage.JSONMessage{Aux: auxJSON}) + msgJSON, err := json.Marshal(&jsonmessage.JSONMessage{ID: id, Aux: auxJSON}) if err != nil { return err } diff --git a/components/cli/vendor/github.com/docker/docker/pkg/system/lcow.go b/components/cli/vendor/github.com/docker/docker/pkg/system/lcow.go index 5c3fbfe6f4..5be3e2182b 100644 --- a/components/cli/vendor/github.com/docker/docker/pkg/system/lcow.go +++ b/components/cli/vendor/github.com/docker/docker/pkg/system/lcow.go @@ -1,69 +1,32 @@ package system // import "github.com/docker/docker/pkg/system" import ( - "fmt" "runtime" "strings" specs "github.com/opencontainers/image-spec/specs-go/v1" + "github.com/pkg/errors" ) -// ValidatePlatform determines if a platform structure is valid. -// TODO This is a temporary function - can be replaced by parsing from -// https://github.com/containerd/containerd/pull/1403/files at a later date. -// @jhowardmsft -func ValidatePlatform(platform *specs.Platform) error { - platform.Architecture = strings.ToLower(platform.Architecture) - platform.OS = strings.ToLower(platform.OS) - // Based on https://github.com/moby/moby/pull/34642#issuecomment-330375350, do - // not support anything except operating system. - if platform.Architecture != "" { - return fmt.Errorf("invalid platform architecture %q", platform.Architecture) - } - if platform.OS != "" { - if !(platform.OS == runtime.GOOS || (LCOWSupported() && platform.OS == "linux")) { - return fmt.Errorf("invalid platform os %q", platform.OS) - } - } - if len(platform.OSFeatures) != 0 { - return fmt.Errorf("invalid platform osfeatures %q", platform.OSFeatures) - } - if platform.OSVersion != "" { - return fmt.Errorf("invalid platform osversion %q", platform.OSVersion) - } - if platform.Variant != "" { - return fmt.Errorf("invalid platform variant %q", platform.Variant) - } - return nil -} - -// ParsePlatform parses a platform string in the format os[/arch[/variant] -// into an OCI image-spec platform structure. -// TODO This is a temporary function - can be replaced by parsing from -// https://github.com/containerd/containerd/pull/1403/files at a later date. -// @jhowardmsft -func ParsePlatform(in string) *specs.Platform { - p := &specs.Platform{} - elements := strings.SplitN(strings.ToLower(in), "/", 3) - if len(elements) == 3 { - p.Variant = elements[2] - } - if len(elements) >= 2 { - p.Architecture = elements[1] - } - if len(elements) >= 1 { - p.OS = elements[0] - } - return p -} - // IsOSSupported determines if an operating system is supported by the host func IsOSSupported(os string) bool { - if runtime.GOOS == os { + if strings.EqualFold(runtime.GOOS, os) { return true } - if LCOWSupported() && os == "linux" { + if LCOWSupported() && strings.EqualFold(os, "linux") { return true } return false } + +// ValidatePlatform determines if a platform structure is valid. +// TODO This is a temporary windows-only function, should be replaced by +// comparison of worker capabilities +func ValidatePlatform(platform specs.Platform) error { + if runtime.GOOS == "windows" { + if !(platform.OS == runtime.GOOS || (LCOWSupported() && platform.OS == "linux")) { + return errors.Errorf("unsupported os %s", platform.OS) + } + } + return nil +} diff --git a/components/cli/vendor/github.com/docker/docker/vendor.conf b/components/cli/vendor/github.com/docker/docker/vendor.conf index 4ffb3edf56..33e2dc8445 100644 --- a/components/cli/vendor/github.com/docker/docker/vendor.conf +++ b/components/cli/vendor/github.com/docker/docker/vendor.conf @@ -1,7 +1,7 @@ # the following lines are in sorted order, FYI github.com/Azure/go-ansiterm d6e3b3328b783f23731bc4d058875b0371ff8109 github.com/Microsoft/hcsshim v0.6.11 -github.com/Microsoft/go-winio v0.4.7 +github.com/Microsoft/go-winio v0.4.8 github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a github.com/go-check/check 4ed411733c5785b40214c70bce814c3a3a689609 https://github.com/cpuguy83/check.git github.com/golang/gddo 9b12a26f3fbd7397dee4e20939ddca719d840d2a @@ -18,8 +18,7 @@ golang.org/x/sys 37707fdb30a5b38865cfb95e5aab41707daec7fd github.com/docker/go-units 9e638d38cf6977a37a8ea0078f3ee75a7cdb2dd1 github.com/docker/go-connections 7beb39f0b969b075d1325fecb092faf27fd357b6 golang.org/x/text f72d8390a633d5dfb0cc84043294db9f6c935756 -github.com/pmezard/go-difflib v1.0.0 -github.com/gotestyourself/gotestyourself cf3a5ab914a2efa8bc838d09f5918c1d44d029 +gotest.tools v2.1.0 github.com/google/go-cmp v0.2.0 github.com/RackSec/srslog 456df3a81436d29ba874f3590eeeee25d666f8a5 @@ -27,7 +26,7 @@ github.com/imdario/mergo v0.3.5 golang.org/x/sync fd80eb99c8f653c847d294a001bdf2a3a6f768f5 # buildkit -github.com/moby/buildkit b062a2d8ddbaa477c25c63d68a9cffbb43f6e474 +github.com/moby/buildkit 9acf51e49185b348608e0096b2903dd72907adcb github.com/tonistiigi/fsutil 8abad97ee3969cdf5e9c367f46adba2c212b3ddb github.com/grpc-ecosystem/grpc-opentracing 8e809c8a86450a29b90dcc9efbf062d0fe6d9746 github.com/opentracing/opentracing-go 1361b9cd60be79c4c3a7fa9841b3c132e40066a7 @@ -38,14 +37,14 @@ github.com/mitchellh/hashstructure 2bca23e0e452137f789efbc8610126fd8b94f73b #get libnetwork packages # When updating, also update LIBNETWORK_COMMIT in hack/dockerfile/install/proxy accordingly -github.com/docker/libnetwork 19279f0492417475b6bfbd0aa529f73e8f178fb5 +github.com/docker/libnetwork 430c00a6a6b3dfdd774f21e1abd4ad6b0216c629 github.com/docker/go-events 9461782956ad83b30282bf90e31fa6a70c255ba9 github.com/armon/go-radix e39d623f12e8e41c7b5529e9a9dd67a1e2261f80 github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec github.com/hashicorp/go-msgpack 71c2886f5a673a35f909803f38ece5810165097b github.com/hashicorp/memberlist 3d8438da9589e7b608a83ffac1ef8211486bcb7c github.com/sean-/seed e2103e2c35297fb7e17febb81e49b312087a2372 -github.com/hashicorp/go-sockaddr acd314c5781ea706c710d9ea70069fd2e110d61d +github.com/hashicorp/go-sockaddr 6d291a969b86c4b633730bfc6b8b9d64c3aafed9 github.com/hashicorp/go-multierror fcdddc395df1ddf4247c69bd436e84cfa0733f7e github.com/hashicorp/serf 598c54895cc5a7b1a24a398d635e8c0ea0959870 github.com/docker/libkv 1d8431073ae03cdaedb198a89722f3aab6d418ef @@ -76,7 +75,7 @@ github.com/pborman/uuid v1.0 google.golang.org/grpc v1.12.0 # This does not need to match RUNC_COMMIT as it is used for helper packages but should be newer or equal -github.com/opencontainers/runc 0e561642f81e84ebd0b3afd6ec510c75a2ccb71b +github.com/opencontainers/runc ad0f5255060d36872be04de22f8731f38ef2d7b1 github.com/opencontainers/runtime-spec v1.0.1 github.com/opencontainers/image-spec v1.0.1 github.com/seccomp/libseccomp-golang 32f571b70023028bd57d9288c20efbcb237f3ce0 @@ -115,7 +114,7 @@ github.com/googleapis/gax-go v2.0.0 google.golang.org/genproto 694d95ba50e67b2e363f3483057db5d4910c18f9 # containerd -github.com/containerd/containerd 63522d9eaa5a0443d225642c4b6f4f5fdedf932b +github.com/containerd/containerd 08f7ee9828af1783dc98cc5cc1739e915697c667 github.com/containerd/fifo 3d5202aec260678c48179c56f40e6f38a095738c github.com/containerd/continuity d3c23511c1bf5851696cba83143d9cbcd666869b github.com/containerd/cgroups fe281dd265766145e943a034aa41086474ea6130 diff --git a/components/cli/vendor/github.com/moby/buildkit/README.md b/components/cli/vendor/github.com/moby/buildkit/README.md index 4180753fc6..567947634e 100644 --- a/components/cli/vendor/github.com/moby/buildkit/README.md +++ b/components/cli/vendor/github.com/moby/buildkit/README.md @@ -1,5 +1,3 @@ -### Important: This repository is in an early development phase - [![asciicinema example](https://asciinema.org/a/gPEIEo1NzmDTUu2bEPsUboqmU.png)](https://asciinema.org/a/gPEIEo1NzmDTUu2bEPsUboqmU) @@ -29,6 +27,16 @@ Read the proposal from https://github.com/moby/moby/issues/32925 Introductory blog post https://blog.mobyproject.org/introducing-buildkit-17e056cc5317 +### Used by + +[Moby](https://github.com/moby/moby/pull/37151) + +[img](https://github.com/genuinetools/img) + +[OpenFaaS Cloud](https://github.com/openfaas/openfaas-cloud) + +[container build interface](https://github.com/containerbuilding/cbi) + ### Quick start Dependencies: @@ -130,11 +138,11 @@ docker inspect myimage ##### Building a Dockerfile using [external frontend](https://hub.docker.com/r/tonistiigi/dockerfile/tags/): -During development, an external version of the Dockerfile frontend is pushed to https://hub.docker.com/r/tonistiigi/dockerfile that can be used with the gateway frontend. The source for the external frontend is currently located in `./frontend/dockerfile/cmd/dockerfile-frontend` but will move out of this repository in the future ([#163](https://github.com/moby/buildkit/issues/163)). +During development, an external version of the Dockerfile frontend is pushed to https://hub.docker.com/r/tonistiigi/dockerfile that can be used with the gateway frontend. The source for the external frontend is currently located in `./frontend/dockerfile/cmd/dockerfile-frontend` but will move out of this repository in the future ([#163](https://github.com/moby/buildkit/issues/163)). For automatic build from master branch of this repository `tonistiigi/dockerfile:master` image can be used. ``` -buildctl build --frontend=gateway.v0 --frontend-opt=source=tonistiigi/dockerfile:v0 --local context=. --local dockerfile=. -buildctl build --frontend gateway.v0 --frontend-opt=source=tonistiigi/dockerfile:v0 --frontend-opt=context=git://github.com/moby/moby --frontend-opt build-arg:APT_MIRROR=cdn-fastly.deb.debian.org +buildctl build --frontend=gateway.v0 --frontend-opt=source=tonistiigi/dockerfile --local context=. --local dockerfile=. +buildctl build --frontend gateway.v0 --frontend-opt=source=tonistiigi/dockerfile --frontend-opt=context=git://github.com/moby/moby --frontend-opt build-arg:APT_MIRROR=cdn-fastly.deb.debian.org ```` ### Exporters diff --git a/components/cli/vendor/github.com/moby/buildkit/api/services/control/control.pb.go b/components/cli/vendor/github.com/moby/buildkit/api/services/control/control.pb.go index e92bd7f04d..5feffaf9de 100644 --- a/components/cli/vendor/github.com/moby/buildkit/api/services/control/control.pb.go +++ b/components/cli/vendor/github.com/moby/buildkit/api/services/control/control.pb.go @@ -542,8 +542,9 @@ func (m *ListWorkersResponse) GetRecord() []*WorkerRecord { } type WorkerRecord struct { - ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` - Labels map[string]string `protobuf:"bytes,2,rep,name=Labels" json:"Labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` + Labels map[string]string `protobuf:"bytes,2,rep,name=Labels" json:"Labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Platforms []pb.Platform `protobuf:"bytes,3,rep,name=platforms" json:"platforms"` } func (m *WorkerRecord) Reset() { *m = WorkerRecord{} } @@ -565,6 +566,13 @@ func (m *WorkerRecord) GetLabels() map[string]string { return nil } +func (m *WorkerRecord) GetPlatforms() []pb.Platform { + if m != nil { + return m.Platforms + } + return nil +} + func init() { proto.RegisterType((*PruneRequest)(nil), "moby.buildkit.v1.PruneRequest") proto.RegisterType((*DiskUsageRequest)(nil), "moby.buildkit.v1.DiskUsageRequest") @@ -1650,6 +1658,18 @@ func (m *WorkerRecord) MarshalTo(dAtA []byte) (int, error) { i += copy(dAtA[i:], v) } } + if len(m.Platforms) > 0 { + for _, msg := range m.Platforms { + dAtA[i] = 0x1a + i++ + i = encodeVarintControl(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } return i, nil } @@ -1979,6 +1999,12 @@ func (m *WorkerRecord) Size() (n int) { n += mapEntrySize + 1 + sovControl(uint64(mapEntrySize)) } } + if len(m.Platforms) > 0 { + for _, e := range m.Platforms { + l = e.Size() + n += 1 + l + sovControl(uint64(l)) + } + } return n } @@ -4663,6 +4689,37 @@ func (m *WorkerRecord) Unmarshal(dAtA []byte) error { } m.Labels[mapkey] = mapvalue iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Platforms", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowControl + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthControl + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Platforms = append(m.Platforms, pb.Platform{}) + if err := m.Platforms[len(m.Platforms)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipControl(dAtA[iNdEx:]) @@ -4792,80 +4849,81 @@ var ( func init() { proto.RegisterFile("control.proto", fileDescriptorControl) } var fileDescriptorControl = []byte{ - // 1192 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xcd, 0x6e, 0x23, 0x45, - 0x10, 0x66, 0x6c, 0xc7, 0x3f, 0x65, 0x27, 0x0a, 0x0d, 0xac, 0x46, 0x03, 0x24, 0x66, 0x00, 0xc9, - 0x8a, 0x76, 0xc7, 0xd9, 0xc0, 0x22, 0xc8, 0x61, 0xb5, 0xeb, 0x78, 0x11, 0x89, 0x12, 0xb1, 0x74, - 0x36, 0xac, 0xc4, 0x6d, 0x6c, 0x77, 0xbc, 0xa3, 0xd8, 0xd3, 0xa6, 0xbb, 0x27, 0xda, 0xf0, 0x14, - 0x1c, 0xb8, 0xf2, 0x14, 0x1c, 0x38, 0x73, 0x40, 0xda, 0x23, 0x67, 0x0e, 0x59, 0x94, 0x3b, 0x3c, - 0x03, 0xea, 0x9f, 0xb1, 0xdb, 0x1e, 0xe7, 0xc7, 0xd9, 0x53, 0xba, 0x3a, 0x5f, 0x7d, 0x53, 0x5d, - 0x5f, 0xb9, 0xaa, 0x60, 0xb9, 0x4b, 0x63, 0xc1, 0xe8, 0x20, 0x18, 0x31, 0x2a, 0x28, 0x5a, 0x1d, - 0xd2, 0xce, 0x59, 0xd0, 0x49, 0xa2, 0x41, 0xef, 0x24, 0x12, 0xc1, 0xe9, 0x7d, 0xef, 0x5e, 0x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, - 0x34, 0x58, 0xf7, 0x71, 0xe3, 0xe9, 0x7d, 0x05, 0x55, 0xeb, 0x7a, 0x91, 0x9e, 0xbd, 0xf5, 0x6f, - 0x1e, 0x4a, 0x3b, 0x7a, 0xa9, 0x47, 0xcf, 0xa0, 0x32, 0x5e, 0x81, 0x91, 0x9f, 0x8d, 0x63, 0x76, - 0x97, 0xf6, 0x3e, 0xbe, 0x12, 0x63, 0x32, 0xf7, 0x0d, 0x2c, 0xa9, 0xa5, 0x1c, 0xcd, 0x49, 0x99, - 0xbd, 0xad, 0x7b, 0x57, 0x2f, 0xd7, 0x9b, 0x8e, 0x64, 0x52, 0xd3, 0x6d, 0x1e, 0x93, 0xbd, 0x06, - 0x79, 0xeb, 0xd7, 0x8c, 0x45, 0x74, 0x00, 0x45, 0xd3, 0x68, 0xe6, 0x41, 0xed, 0x19, 0xe6, 0xd5, - 0x2f, 0x07, 0x68, 0xb2, 0x4d, 0x07, 0x1d, 0x8c, 0x77, 0xbc, 0x79, 0xa1, 0xd9, 0x05, 0xea, 0x5d, - 0xf3, 0xff, 0x86, 0xb3, 0xe9, 0xa0, 0x1f, 0xa0, 0x6a, 0x95, 0x20, 0xfa, 0x24, 0xeb, 0x92, 0xad, - 0x67, 0xef, 0xd3, 0x6b, 0x50, 0x3a, 0xd8, 0x56, 0xed, 0xd5, 0xc5, 0x9a, 0xf3, 0xd7, 0xc5, 0x9a, - 0xf3, 0xcf, 0xc5, 0x9a, 0xd3, 0x29, 0xaa, 0x5f, 0xe4, 0x67, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, - 0x4d, 0x94, 0x5a, 0xb6, 0xd8, 0x0d, 0x00, 0x00, + // 1214 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0x4f, 0x6f, 0x1b, 0x55, + 0x10, 0x67, 0x6d, 0xc7, 0xf6, 0x8e, 0x9d, 0x28, 0x3c, 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, 0x09, + 0x5b, 0x85, 0x2f, 0x2d, 0xc1, 0x90, 0x77, 0x71, 0x11, 0x06, 0xef, 0xb5, 0x05, 0x75, 0xd3, 0x43, + 0xf4, 0x01, 0xd8, 0xca, 0xa9, 0x49, 0x71, 0x4c, 0x14, 0xa2, 0x0e, 0x77, 0x86, 0x5a, 0x60, 0x4e, + 0xa1, 0x51, 0x6c, 0xda, 0x81, 0xa1, 0x41, 0xdf, 0x41, 0x4d, 0x81, 0x55, 0x94, 0x8b, 0x32, 0xca, + 0xad, 0xab, 0x83, 0xe2, 0x1b, 0x16, 0x2a, 0xc6, 0x26, 0x87, 0xfb, 0x08, 0x56, 0x67, 0x01, 0x0b, + 0xdd, 0xf0, 0x37, 0x0b, 0x96, 0x75, 0x52, 0x75, 0x17, 0x0a, 0x33, 0x46, 0x4c, 0x33, 0x9d, 0xee, + 0x47, 0x0f, 0x2f, 0xad, 0x07, 0x05, 0xf3, 0x67, 0xed, 0x94, 0xbf, 0x39, 0x3a, 0x77, 0x1b, 0xde, + 0x9b, 0x0b, 0x5d, 0xc8, 0xf3, 0x8f, 0x60, 0xf9, 0x90, 0x87, 0x7c, 0xc4, 0x2e, 0xfd, 0x64, 0xbd, + 0x5f, 0x2d, 0x58, 0xc9, 0x30, 0xfa, 0x76, 0x9f, 0x43, 0xf5, 0x14, 0x53, 0x8e, 0x5f, 0x62, 0xa6, + 0x6f, 0xe5, 0xe4, 0x6f, 0xf5, 0xbd, 0x44, 0x04, 0x63, 0x24, 0xda, 0x82, 0x2a, 0x93, 0x3c, 0x58, + 0xa5, 0x75, 0x6e, 0x29, 0x2b, 0x2b, 0xfd, 0xbe, 0x31, 0x1e, 0xb5, 0xa0, 0x14, 0x93, 0x41, 0x96, + 0xed, 0xf7, 0x2f, 0xb3, 0xdb, 0x23, 0x83, 0x40, 0x02, 0xbd, 0xf3, 0x02, 0x94, 0x95, 0x0e, 0xed, + 0x42, 0xb9, 0x1f, 0x0d, 0x30, 0xe3, 0xea, 0x56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x38, 0xb9, 0xeb, 0xd7, 0x0c, 0x52, 0xb4, 0x0f, 0x65, 0xdd, 0x9a, + 0xe6, 0x41, 0xcd, 0xa9, 0xe7, 0x36, 0x2e, 0x07, 0x28, 0xb2, 0x0d, 0x0b, 0xed, 0x8f, 0xb7, 0xc2, + 0x79, 0xae, 0x99, 0x25, 0xed, 0x5e, 0xf3, 0xbc, 0x69, 0x6d, 0x58, 0xe8, 0x07, 0xa8, 0x19, 0x45, + 0x8b, 0x3e, 0xc9, 0x9b, 0xe4, 0xbf, 0x00, 0xf7, 0xd3, 0x6b, 0x50, 0xca, 0xd9, 0x76, 0xfd, 0xd5, + 0xc5, 0x9a, 0xf5, 0xd7, 0xc5, 0x9a, 0xf5, 0xcf, 0xc5, 0x9a, 0xd5, 0x2d, 0xcb, 0x6f, 0xf8, 0xb3, + 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0x86, 0xd4, 0x0f, 0xa1, 0x0a, 0x0e, 0x00, 0x00, } diff --git a/components/cli/vendor/github.com/moby/buildkit/api/services/control/control.proto b/components/cli/vendor/github.com/moby/buildkit/api/services/control/control.proto index 7944ce89a8..9768920f7e 100644 --- a/components/cli/vendor/github.com/moby/buildkit/api/services/control/control.proto +++ b/components/cli/vendor/github.com/moby/buildkit/api/services/control/control.proto @@ -118,4 +118,5 @@ message ListWorkersResponse { message WorkerRecord { string ID = 1; map Labels = 2; + repeated pb.Platform platforms = 3 [(gogoproto.nullable) = false]; } diff --git a/components/cli/vendor/github.com/moby/buildkit/client/client.go b/components/cli/vendor/github.com/moby/buildkit/client/client.go index c71c00c0e2..403ed52a8c 100644 --- a/components/cli/vendor/github.com/moby/buildkit/client/client.go +++ b/components/cli/vendor/github.com/moby/buildkit/client/client.go @@ -5,7 +5,6 @@ import ( "crypto/tls" "crypto/x509" "io/ioutil" - "time" "github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc" controlapi "github.com/moby/buildkit/api/services/control" @@ -23,7 +22,7 @@ type Client struct { type ClientOpt interface{} // New returns a new buildkit client. Address can be empty for the system-default address. -func New(address string, opts ...ClientOpt) (*Client, error) { +func New(ctx context.Context, address string, opts ...ClientOpt) (*Client, error) { gopts := []grpc.DialOption{ grpc.WithDialer(dialer), grpc.FailOnNonTempDialError(true), @@ -54,9 +53,6 @@ func New(address string, opts ...ClientOpt) (*Client, error) { address = appdefaults.Address } - ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) - defer cancel() - conn, err := grpc.DialContext(ctx, address, gopts...) if err != nil { return nil, errors.Wrapf(err, "failed to dial %q . make sure buildkitd is running", address) diff --git a/components/cli/vendor/github.com/moby/buildkit/client/llb/exec.go b/components/cli/vendor/github.com/moby/buildkit/client/llb/exec.go index 98be2653e4..9dec170f02 100644 --- a/components/cli/vendor/github.com/moby/buildkit/client/llb/exec.go +++ b/components/cli/vendor/github.com/moby/buildkit/client/llb/exec.go @@ -17,8 +17,8 @@ type Meta struct { ProxyEnv *ProxyEnv } -func NewExecOp(root Output, meta Meta, readOnly bool, md OpMetadata) *ExecOp { - e := &ExecOp{meta: meta, cachedOpMetadata: md} +func NewExecOp(root Output, meta Meta, readOnly bool, c Constraints) *ExecOp { + e := &ExecOp{meta: meta, constraints: c} rootMount := &mount{ target: pb.RootMount, source: root, @@ -28,32 +28,35 @@ func NewExecOp(root Output, meta Meta, readOnly bool, md OpMetadata) *ExecOp { if readOnly { e.root = root } else { - e.root = &output{vertex: e, getIndex: e.getMountIndexFn(rootMount)} + o := &output{vertex: e, getIndex: e.getMountIndexFn(rootMount)} + if p := c.Platform; p != nil { + o.platform = p + } + e.root = o } rootMount.output = e.root - return e } type mount struct { - target string - readonly bool - source Output - output Output - selector string - cacheID string - tmpfs bool + target string + readonly bool + source Output + output Output + selector string + cacheID string + tmpfs bool + cacheSharing CacheMountSharingMode // hasOutput bool } type ExecOp struct { - root Output - mounts []*mount - meta Meta - cachedPBDigest digest.Digest - cachedPB []byte - cachedOpMetadata OpMetadata - isValidated bool + MarshalCache + root Output + mounts []*mount + meta Meta + constraints Constraints + isValidated bool } func (e *ExecOp) AddMount(target string, source Output, opt ...MountOption) Output { @@ -70,9 +73,13 @@ func (e *ExecOp) AddMount(target string, source Output, opt ...MountOption) Outp } else if m.tmpfs { m.output = &output{vertex: e, err: errors.Errorf("tmpfs mount for %s can't be used as a parent", target)} } else { - m.output = &output{vertex: e, getIndex: e.getMountIndexFn(m)} + o := &output{vertex: e, getIndex: e.getMountIndexFn(m)} + if p := e.constraints.Platform; p != nil { + o.platform = p + } + m.output = o } - e.cachedPB = nil + e.Store(nil, nil, nil) e.isValidated = false return m.output } @@ -107,9 +114,9 @@ func (e *ExecOp) Validate() error { return nil } -func (e *ExecOp) Marshal() (digest.Digest, []byte, *OpMetadata, error) { - if e.cachedPB != nil { - return e.cachedPBDigest, e.cachedPB, &e.cachedOpMetadata, nil +func (e *ExecOp) Marshal(c *Constraints) (digest.Digest, []byte, *pb.OpMetadata, error) { + if e.Cached(c) { + return e.Load() } if err := e.Validate(); err != nil { return "", nil, nil, err @@ -137,10 +144,9 @@ func (e *ExecOp) Marshal() (digest.Digest, []byte, *OpMetadata, error) { } } - pop := &pb.Op{ - Op: &pb.Op_Exec{ - Exec: peo, - }, + pop, md := MarshalConstraints(c, &e.constraints) + pop.Op = &pb.Op_Exec{ + Exec: peo, } outIndex := 0 @@ -150,7 +156,7 @@ func (e *ExecOp) Marshal() (digest.Digest, []byte, *OpMetadata, error) { if m.tmpfs { return "", nil, nil, errors.Errorf("tmpfs mounts must use scratch") } - inp, err := m.source.ToInput() + inp, err := m.source.ToInput(c) if err != nil { return "", nil, nil, err } @@ -190,6 +196,14 @@ func (e *ExecOp) Marshal() (digest.Digest, []byte, *OpMetadata, error) { pm.CacheOpt = &pb.CacheOpt{ ID: m.cacheID, } + switch m.cacheSharing { + case CacheMountShared: + pm.CacheOpt.Sharing = pb.CacheSharingOpt_SHARED + case CacheMountPrivate: + pm.CacheOpt.Sharing = pb.CacheSharingOpt_PRIVATE + case CacheMountLocked: + pm.CacheOpt.Sharing = pb.CacheSharingOpt_LOCKED + } } if m.tmpfs { pm.MountType = pb.MountType_TMPFS @@ -201,9 +215,8 @@ func (e *ExecOp) Marshal() (digest.Digest, []byte, *OpMetadata, error) { if err != nil { return "", nil, nil, err } - e.cachedPBDigest = digest.FromBytes(dt) - e.cachedPB = dt - return e.cachedPBDigest, dt, &e.cachedOpMetadata, nil + e.Store(dt, md, c) + return e.Load() } func (e *ExecOp) Output() Output { @@ -273,9 +286,10 @@ func SourcePath(src string) MountOption { } } -func AsPersistentCacheDir(id string) MountOption { +func AsPersistentCacheDir(id string, sharing CacheMountSharingMode) MountOption { return func(m *mount) { m.cacheID = id + m.cacheSharing = sharing } } @@ -366,7 +380,7 @@ func WithProxy(ps ProxyEnv) RunOption { } type ExecInfo struct { - opMetaWrapper + constraintsWrapper State State Mounts []MountInfo ReadonlyRootFS bool @@ -385,3 +399,11 @@ type ProxyEnv struct { FtpProxy string NoProxy string } + +type CacheMountSharingMode int + +const ( + CacheMountShared CacheMountSharingMode = iota + CacheMountPrivate + CacheMountLocked +) diff --git a/components/cli/vendor/github.com/moby/buildkit/client/llb/marshal.go b/components/cli/vendor/github.com/moby/buildkit/client/llb/marshal.go index 4d8ad5557a..65a352fae8 100644 --- a/components/cli/vendor/github.com/moby/buildkit/client/llb/marshal.go +++ b/components/cli/vendor/github.com/moby/buildkit/client/llb/marshal.go @@ -4,6 +4,7 @@ import ( "io" "io/ioutil" + "github.com/containerd/containerd/platforms" "github.com/moby/buildkit/solver/pb" digest "github.com/opencontainers/go-digest" ) @@ -12,11 +13,11 @@ import ( // Corresponds to the Definition structure defined in solver/pb.Definition. type Definition struct { Def [][]byte - Metadata map[digest.Digest]OpMetadata + Metadata map[digest.Digest]pb.OpMetadata } func (def *Definition) ToPB() *pb.Definition { - md := make(map[digest.Digest]OpMetadata) + md := make(map[digest.Digest]pb.OpMetadata) for k, v := range def.Metadata { md[k] = v } @@ -28,14 +29,12 @@ func (def *Definition) ToPB() *pb.Definition { func (def *Definition) FromPB(x *pb.Definition) { def.Def = x.Def - def.Metadata = make(map[digest.Digest]OpMetadata) + def.Metadata = make(map[digest.Digest]pb.OpMetadata) for k, v := range x.Metadata { def.Metadata[k] = v } } -type OpMetadata = pb.OpMetadata - func WriteTo(def *Definition, w io.Writer) error { b, err := def.ToPB().Marshal() if err != nil { @@ -58,3 +57,56 @@ func ReadFrom(r io.Reader) (*Definition, error) { def.FromPB(&pbDef) return &def, nil } + +func MarshalConstraints(base, override *Constraints) (*pb.Op, *pb.OpMetadata) { + c := *base + c.WorkerConstraints = append([]string{}, c.WorkerConstraints...) + + if p := override.Platform; p != nil { + c.Platform = p + } + + for _, wc := range override.WorkerConstraints { + c.WorkerConstraints = append(c.WorkerConstraints, wc) + } + + c.Metadata = mergeMetadata(c.Metadata, override.Metadata) + + if c.Platform == nil { + defaultPlatform := platforms.Normalize(platforms.DefaultSpec()) + c.Platform = &defaultPlatform + } + + return &pb.Op{ + Platform: &pb.Platform{ + OS: c.Platform.OS, + Architecture: c.Platform.Architecture, + Variant: c.Platform.Variant, + OSVersion: c.Platform.OSVersion, + OSFeatures: c.Platform.OSFeatures, + }, + Constraints: &pb.WorkerConstraints{ + Filter: c.WorkerConstraints, + }, + }, &c.Metadata +} + +type MarshalCache struct { + digest digest.Digest + dt []byte + md *pb.OpMetadata + constraints *Constraints +} + +func (mc *MarshalCache) Cached(c *Constraints) bool { + return mc.dt != nil && mc.constraints == c +} +func (mc *MarshalCache) Load() (digest.Digest, []byte, *pb.OpMetadata, error) { + return mc.digest, mc.dt, mc.md, nil +} +func (mc *MarshalCache) Store(dt []byte, md *pb.OpMetadata, c *Constraints) { + mc.digest = digest.FromBytes(dt) + mc.dt = dt + mc.md = md + mc.constraints = c +} diff --git a/components/cli/vendor/github.com/moby/buildkit/client/llb/meta.go b/components/cli/vendor/github.com/moby/buildkit/client/llb/meta.go index 54449ff606..22aea097d4 100644 --- a/components/cli/vendor/github.com/moby/buildkit/client/llb/meta.go +++ b/components/cli/vendor/github.com/moby/buildkit/client/llb/meta.go @@ -4,16 +4,19 @@ import ( "fmt" "path" + "github.com/containerd/containerd/platforms" "github.com/google/shlex" + specs "github.com/opencontainers/image-spec/specs-go/v1" ) type contextKeyT string var ( - keyArgs = contextKeyT("llb.exec.args") - keyDir = contextKeyT("llb.exec.dir") - keyEnv = contextKeyT("llb.exec.env") - keyUser = contextKeyT("llb.exec.user") + keyArgs = contextKeyT("llb.exec.args") + keyDir = contextKeyT("llb.exec.dir") + keyEnv = contextKeyT("llb.exec.env") + keyUser = contextKeyT("llb.exec.user") + keyPlatform = contextKeyT("llb.platform") ) func addEnv(key, value string) StateOption { @@ -106,6 +109,21 @@ func shlexf(str string, v ...interface{}) StateOption { } } +func platform(p specs.Platform) StateOption { + return func(s State) State { + return s.WithValue(keyPlatform, platforms.Normalize(p)) + } +} + +func getPlatform(s State) *specs.Platform { + v := s.Value(keyPlatform) + if v != nil { + p := v.(specs.Platform) + return &p + } + return nil +} + type EnvList []KeyValue type KeyValue struct { diff --git a/components/cli/vendor/github.com/moby/buildkit/client/llb/resolver.go b/components/cli/vendor/github.com/moby/buildkit/client/llb/resolver.go index bac738c967..b539b1159e 100644 --- a/components/cli/vendor/github.com/moby/buildkit/client/llb/resolver.go +++ b/components/cli/vendor/github.com/moby/buildkit/client/llb/resolver.go @@ -4,6 +4,7 @@ import ( "context" digest "github.com/opencontainers/go-digest" + specs "github.com/opencontainers/image-spec/specs-go/v1" ) func WithMetaResolver(mr ImageMetaResolver) ImageOption { @@ -13,5 +14,5 @@ func WithMetaResolver(mr ImageMetaResolver) ImageOption { } type ImageMetaResolver interface { - ResolveImageConfig(ctx context.Context, ref string) (digest.Digest, []byte, error) + ResolveImageConfig(ctx context.Context, ref string, platform *specs.Platform) (digest.Digest, []byte, error) } diff --git a/components/cli/vendor/github.com/moby/buildkit/client/llb/source.go b/components/cli/vendor/github.com/moby/buildkit/client/llb/source.go index 5b1bf061bf..f0f2968499 100644 --- a/components/cli/vendor/github.com/moby/buildkit/client/llb/source.go +++ b/components/cli/vendor/github.com/moby/buildkit/client/llb/source.go @@ -15,22 +15,21 @@ import ( ) type SourceOp struct { - id string - attrs map[string]string - output Output - cachedPBDigest digest.Digest - cachedPB []byte - cachedOpMetadata OpMetadata - err error + MarshalCache + id string + attrs map[string]string + output Output + constraints Constraints + err error } -func NewSource(id string, attrs map[string]string, md OpMetadata) *SourceOp { +func NewSource(id string, attrs map[string]string, c Constraints) *SourceOp { s := &SourceOp{ - id: id, - attrs: attrs, - cachedOpMetadata: md, + id: id, + attrs: attrs, + constraints: c, } - s.output = &output{vertex: s} + s.output = &output{vertex: s, platform: c.Platform} return s } @@ -44,26 +43,26 @@ func (s *SourceOp) Validate() error { return nil } -func (s *SourceOp) Marshal() (digest.Digest, []byte, *OpMetadata, error) { - if s.cachedPB != nil { - return s.cachedPBDigest, s.cachedPB, &s.cachedOpMetadata, nil +func (s *SourceOp) Marshal(constraints *Constraints) (digest.Digest, []byte, *pb.OpMetadata, error) { + if s.Cached(constraints) { + return s.Load() } if err := s.Validate(); err != nil { return "", nil, nil, err } - proto := &pb.Op{ - Op: &pb.Op_Source{ - Source: &pb.SourceOp{Identifier: s.id, Attrs: s.attrs}, - }, + proto, md := MarshalConstraints(constraints, &s.constraints) + + proto.Op = &pb.Op_Source{ + Source: &pb.SourceOp{Identifier: s.id, Attrs: s.attrs}, } dt, err := proto.Marshal() if err != nil { return "", nil, nil, err } - s.cachedPB = dt - s.cachedPBDigest = digest.FromBytes(dt) - return s.cachedPBDigest, dt, &s.cachedOpMetadata, nil + + s.Store(dt, md, constraints) + return s.Load() } func (s *SourceOp) Output() Output { @@ -74,10 +73,6 @@ func (s *SourceOp) Inputs() []Output { return nil } -func Source(id string) State { - return NewState(NewSource(id, nil, OpMetadata{}).Output()) -} - func Image(ref string, opts ...ImageOption) State { r, err := reference.ParseNormalizedNamed(ref) if err == nil { @@ -87,12 +82,12 @@ func Image(ref string, opts ...ImageOption) State { for _, opt := range opts { opt.SetImageOption(&info) } - src := NewSource("docker-image://"+ref, nil, info.Metadata()) // controversial + src := NewSource("docker-image://"+ref, nil, info.Constraints) // controversial if err != nil { src.err = err } if info.metaResolver != nil { - _, dt, err := info.metaResolver.ResolveImageConfig(context.TODO(), ref) + _, dt, err := info.metaResolver.ResolveImageConfig(context.TODO(), ref, info.Constraints.Platform) if err != nil { src.err = err } else { @@ -136,7 +131,7 @@ func (fn ImageOptionFunc) SetImageOption(ii *ImageInfo) { } type ImageInfo struct { - opMetaWrapper + constraintsWrapper metaResolver ImageMetaResolver } @@ -169,7 +164,7 @@ func Git(remote, ref string, opts ...GitOption) State { if url != "" { attrs[pb.AttrFullRemoteURL] = url } - source := NewSource("git://"+id, attrs, gi.Metadata()) + source := NewSource("git://"+id, attrs, gi.Constraints) return NewState(source.Output()) } @@ -183,7 +178,7 @@ func (fn gitOptionFunc) SetGitOption(gi *GitInfo) { } type GitInfo struct { - opMetaWrapper + constraintsWrapper KeepGitDir bool } @@ -220,7 +215,7 @@ func Local(name string, opts ...LocalOption) State { attrs[pb.AttrSharedKeyHint] = gi.SharedKeyHint } - source := NewSource("local://"+name, attrs, gi.Metadata()) + source := NewSource("local://"+name, attrs, gi.Constraints) return NewState(source.Output()) } @@ -280,7 +275,7 @@ func SharedKeyHint(h string) LocalOption { } type LocalInfo struct { - opMetaWrapper + constraintsWrapper SessionID string IncludePatterns string ExcludePatterns string @@ -310,12 +305,12 @@ func HTTP(url string, opts ...HTTPOption) State { attrs[pb.AttrHTTPGID] = strconv.Itoa(hi.GID) } - source := NewSource(url, attrs, hi.Metadata()) + source := NewSource(url, attrs, hi.Constraints) return NewState(source.Output()) } type HTTPInfo struct { - opMetaWrapper + constraintsWrapper Checksum digest.Digest Filename string Perm int diff --git a/components/cli/vendor/github.com/moby/buildkit/client/llb/state.go b/components/cli/vendor/github.com/moby/buildkit/client/llb/state.go index a53b212ebb..f9e2138e42 100644 --- a/components/cli/vendor/github.com/moby/buildkit/client/llb/state.go +++ b/components/cli/vendor/github.com/moby/buildkit/client/llb/state.go @@ -3,21 +3,23 @@ package llb import ( "context" + "github.com/containerd/containerd/platforms" "github.com/moby/buildkit/solver/pb" "github.com/moby/buildkit/util/system" digest "github.com/opencontainers/go-digest" + specs "github.com/opencontainers/image-spec/specs-go/v1" ) type StateOption func(State) State type Output interface { - ToInput() (*pb.Input, error) + ToInput(*Constraints) (*pb.Input, error) Vertex() Vertex } type Vertex interface { Validate() error - Marshal() (digest.Digest, []byte, *OpMetadata, error) + Marshal(*Constraints) (digest.Digest, []byte, *pb.OpMetadata, error) Output() Output Inputs() []Output } @@ -29,12 +31,25 @@ func NewState(o Output) State { } s = dir("/")(s) s = addEnv("PATH", system.DefaultPathEnv)(s) + s = s.ensurePlatform() return s } type State struct { - out Output - ctx context.Context + out Output + ctx context.Context + opts []ConstraintsOpt +} + +func (s State) ensurePlatform() State { + if o, ok := s.out.(interface { + Platform() *specs.Platform + }); ok { + if p := o.Platform(); p != nil { + s = platform(*p)(s) + } + } + return s } func (s State) WithValue(k, v interface{}) State { @@ -48,18 +63,32 @@ func (s State) Value(k interface{}) interface{} { return s.ctx.Value(k) } -func (s State) Marshal(md ...MetadataOpt) (*Definition, error) { +func (s State) SetMarhalDefaults(co ...ConstraintsOpt) State { + s.opts = co + return s +} + +func (s State) Marshal(co ...ConstraintsOpt) (*Definition, error) { def := &Definition{ - Metadata: make(map[digest.Digest]OpMetadata, 0), + Metadata: make(map[digest.Digest]pb.OpMetadata, 0), } if s.Output() == nil { return def, nil } - def, err := marshal(s.Output().Vertex(), def, map[digest.Digest]struct{}{}, map[Vertex]struct{}{}, md) + + defaultPlatform := platforms.Normalize(platforms.DefaultSpec()) + c := &Constraints{ + Platform: &defaultPlatform, + } + for _, o := range append(s.opts, co...) { + o.SetConstraintsOption(c) + } + + def, err := marshal(s.Output().Vertex(), def, map[digest.Digest]struct{}{}, map[Vertex]struct{}{}, c) if err != nil { return def, err } - inp, err := s.Output().ToInput() + inp, err := s.Output().ToInput(c) if err != nil { return def, err } @@ -72,29 +101,25 @@ func (s State) Marshal(md ...MetadataOpt) (*Definition, error) { return def, nil } -func marshal(v Vertex, def *Definition, cache map[digest.Digest]struct{}, vertexCache map[Vertex]struct{}, md []MetadataOpt) (*Definition, error) { +func marshal(v Vertex, def *Definition, cache map[digest.Digest]struct{}, vertexCache map[Vertex]struct{}, c *Constraints) (*Definition, error) { if _, ok := vertexCache[v]; ok { return def, nil } for _, inp := range v.Inputs() { var err error - def, err = marshal(inp.Vertex(), def, cache, vertexCache, md) + def, err = marshal(inp.Vertex(), def, cache, vertexCache, c) if err != nil { return def, err } } - dgst, dt, opMeta, err := v.Marshal() + dgst, dt, opMeta, err := v.Marshal(c) if err != nil { return def, err } vertexCache[v] = struct{}{} if opMeta != nil { - m := mergeMetadata(def.Metadata[dgst], *opMeta) - for _, f := range md { - f.SetMetadataOption(&m) - } - def.Metadata[dgst] = m + def.Metadata[dgst] = mergeMetadata(def.Metadata[dgst], *opMeta) } if _, ok := cache[dgst]; ok { return def, nil @@ -113,14 +138,19 @@ func (s State) Output() Output { } func (s State) WithOutput(o Output) State { - return State{ + s = State{ out: o, ctx: s.ctx, } + s = s.ensurePlatform() + return s } func (s State) Run(ro ...RunOption) ExecState { ei := &ExecInfo{State: s} + if p := s.GetPlatform(); p != nil { + ei.Constraints.Platform = p + } for _, o := range ro { o.SetRunOption(ei) } @@ -132,7 +162,7 @@ func (s State) Run(ro ...RunOption) ExecState { ProxyEnv: ei.ProxyEnv, } - exec := NewExecOp(s.Output(), meta, ei.ReadonlyRootFS, ei.Metadata()) + exec := NewExecOp(s.Output(), meta, ei.ReadonlyRootFS, ei.Constraints) for _, m := range ei.Mounts { exec.AddMount(m.Target, m.Source, m.Opts...) } @@ -178,6 +208,14 @@ func (s State) User(v string) State { return user(v)(s) } +func (s State) Platform(p specs.Platform) State { + return platform(p)(s) +} + +func (s State) GetPlatform() *specs.Platform { + return getPlatform(s) +} + func (s State) With(so ...StateOption) State { for _, o := range so { s = o(s) @@ -189,9 +227,10 @@ type output struct { vertex Vertex getIndex func() (pb.OutputIndex, error) err error + platform *specs.Platform } -func (o *output) ToInput() (*pb.Input, error) { +func (o *output) ToInput(c *Constraints) (*pb.Input, error) { if o.err != nil { return nil, o.err } @@ -203,7 +242,7 @@ func (o *output) ToInput() (*pb.Input, error) { return nil, err } } - dgst, _, _, err := o.vertex.Marshal() + dgst, _, _, err := o.vertex.Marshal(c) if err != nil { return nil, err } @@ -214,8 +253,12 @@ func (o *output) Vertex() Vertex { return o.vertex } -type MetadataOpt interface { - SetMetadataOption(*OpMetadata) +func (o *output) Platform() *specs.Platform { + return o.platform +} + +type ConstraintsOpt interface { + SetConstraintsOption(*Constraints) RunOption LocalOption HTTPOption @@ -223,33 +266,33 @@ type MetadataOpt interface { GitOption } -type metadataOptFunc func(m *OpMetadata) +type constraintsOptFunc func(m *Constraints) -func (fn metadataOptFunc) SetMetadataOption(m *OpMetadata) { +func (fn constraintsOptFunc) SetConstraintsOption(m *Constraints) { fn(m) } -func (fn metadataOptFunc) SetRunOption(ei *ExecInfo) { - ei.ApplyMetadata(fn) +func (fn constraintsOptFunc) SetRunOption(ei *ExecInfo) { + ei.applyConstraints(fn) } -func (fn metadataOptFunc) SetLocalOption(li *LocalInfo) { - li.ApplyMetadata(fn) +func (fn constraintsOptFunc) SetLocalOption(li *LocalInfo) { + li.applyConstraints(fn) } -func (fn metadataOptFunc) SetHTTPOption(hi *HTTPInfo) { - hi.ApplyMetadata(fn) +func (fn constraintsOptFunc) SetHTTPOption(hi *HTTPInfo) { + hi.applyConstraints(fn) } -func (fn metadataOptFunc) SetImageOption(ii *ImageInfo) { - ii.ApplyMetadata(fn) +func (fn constraintsOptFunc) SetImageOption(ii *ImageInfo) { + ii.applyConstraints(fn) } -func (fn metadataOptFunc) SetGitOption(gi *GitInfo) { - gi.ApplyMetadata(fn) +func (fn constraintsOptFunc) SetGitOption(gi *GitInfo) { + gi.applyConstraints(fn) } -func mergeMetadata(m1, m2 OpMetadata) OpMetadata { +func mergeMetadata(m1, m2 pb.OpMetadata) pb.OpMetadata { if m2.IgnoreCache { m1.IgnoreCache = true } @@ -268,49 +311,77 @@ func mergeMetadata(m1, m2 OpMetadata) OpMetadata { return m1 } -var IgnoreCache = metadataOptFunc(func(md *OpMetadata) { - md.IgnoreCache = true +var IgnoreCache = constraintsOptFunc(func(c *Constraints) { + c.Metadata.IgnoreCache = true }) -func WithDescription(m map[string]string) MetadataOpt { - return metadataOptFunc(func(md *OpMetadata) { - md.Description = m +func WithDescription(m map[string]string) ConstraintsOpt { + return constraintsOptFunc(func(c *Constraints) { + c.Metadata.Description = m }) } // WithExportCache forces results for this vertex to be exported with the cache -func WithExportCache() MetadataOpt { - return metadataOptFunc(func(md *OpMetadata) { - md.ExportCache = &pb.ExportCache{Value: true} +func WithExportCache() ConstraintsOpt { + return constraintsOptFunc(func(c *Constraints) { + c.Metadata.ExportCache = &pb.ExportCache{Value: true} }) } // WithoutExportCache sets results for this vertex to be not exported with // the cache -func WithoutExportCache() MetadataOpt { - return metadataOptFunc(func(md *OpMetadata) { +func WithoutExportCache() ConstraintsOpt { + return constraintsOptFunc(func(c *Constraints) { // ExportCache with value false means to disable exporting - md.ExportCache = &pb.ExportCache{Value: false} + c.Metadata.ExportCache = &pb.ExportCache{Value: false} }) } // WithoutDefaultExportCache resets the cache export for the vertex to use // the default defined by the build configuration. -func WithoutDefaultExportCache() MetadataOpt { - return metadataOptFunc(func(md *OpMetadata) { +func WithoutDefaultExportCache() ConstraintsOpt { + return constraintsOptFunc(func(c *Constraints) { // nil means no vertex based config has been set - md.ExportCache = nil + c.Metadata.ExportCache = nil }) } -type opMetaWrapper struct { - OpMetadata +type constraintsWrapper struct { + Constraints } -func (mw *opMetaWrapper) ApplyMetadata(f func(m *OpMetadata)) { - f(&mw.OpMetadata) +func (cw *constraintsWrapper) applyConstraints(f func(c *Constraints)) { + f(&cw.Constraints) } -func (mw *opMetaWrapper) Metadata() OpMetadata { - return mw.OpMetadata +type Constraints struct { + Platform *specs.Platform + WorkerConstraints []string + Metadata pb.OpMetadata +} + +func Platform(p specs.Platform) ConstraintsOpt { + return constraintsOptFunc(func(c *Constraints) { + c.Platform = &p + }) +} + +var ( + LinuxAmd64 = Platform(specs.Platform{OS: "linux", Architecture: "amd64"}) + LinuxArmhf = Platform(specs.Platform{OS: "linux", Architecture: "arm", Variant: "v7"}) + LinuxArm = LinuxArmhf + LinuxArmel = Platform(specs.Platform{OS: "linux", Architecture: "arm", Variant: "v6"}) + LinuxArm64 = Platform(specs.Platform{OS: "linux", Architecture: "arm64"}) + LinuxS390x = Platform(specs.Platform{OS: "linux", Architecture: "s390x"}) + LinuxPpc64le = Platform(specs.Platform{OS: "linux", Architecture: "ppc64le"}) + Darwin = Platform(specs.Platform{OS: "darwin", Architecture: "amd64"}) + Windows = Platform(specs.Platform{OS: "windows", Architecture: "amd64"}) +) + +func Require(filters ...string) ConstraintsOpt { + return constraintsOptFunc(func(c *Constraints) { + for _, f := range filters { + c.WorkerConstraints = append(c.WorkerConstraints, f) + } + }) } diff --git a/components/cli/vendor/github.com/moby/buildkit/client/workers.go b/components/cli/vendor/github.com/moby/buildkit/client/workers.go index b4ccb82d4c..2645a597ef 100644 --- a/components/cli/vendor/github.com/moby/buildkit/client/workers.go +++ b/components/cli/vendor/github.com/moby/buildkit/client/workers.go @@ -4,12 +4,15 @@ import ( "context" controlapi "github.com/moby/buildkit/api/services/control" + "github.com/moby/buildkit/solver/pb" + specs "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" ) type WorkerInfo struct { - ID string - Labels map[string]string + ID string + Labels map[string]string + Platforms []specs.Platform } func (c *Client) ListWorkers(ctx context.Context, opts ...ListWorkersOption) ([]*WorkerInfo, error) { @@ -28,8 +31,9 @@ func (c *Client) ListWorkers(ctx context.Context, opts ...ListWorkersOption) ([] for _, w := range resp.Record { wi = append(wi, &WorkerInfo{ - ID: w.ID, - Labels: w.Labels, + ID: w.ID, + Labels: w.Labels, + Platforms: toClientPlatforms(w.Platforms), }) } @@ -47,3 +51,17 @@ func WithWorkerFilter(f []string) ListWorkersOption { wi.Filter = f } } + +func toClientPlatforms(p []pb.Platform) []specs.Platform { + out := make([]specs.Platform, 0, len(p)) + for _, pp := range p { + out = append(out, specs.Platform{ + OS: pp.OS, + Architecture: pp.Architecture, + Variant: pp.Variant, + OSVersion: pp.OSVersion, + OSFeatures: pp.OSFeatures, + }) + } + return out +} diff --git a/components/cli/vendor/github.com/moby/buildkit/solver/pb/ops.pb.go b/components/cli/vendor/github.com/moby/buildkit/solver/pb/ops.pb.go index d6ac7ad9d6..5806eb7e6b 100644 --- a/components/cli/vendor/github.com/moby/buildkit/solver/pb/ops.pb.go +++ b/components/cli/vendor/github.com/moby/buildkit/solver/pb/ops.pb.go @@ -12,6 +12,7 @@ It has these top-level messages: Op + Platform Input ExecOp Meta @@ -25,7 +26,7 @@ OpMetadata ExportCache ProxyEnv - WorkerConstraint + WorkerConstraints Definition */ package pb @@ -50,6 +51,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package +// MountType defines a type of a mount from a supported set type MountType int32 const ( @@ -80,6 +82,34 @@ func (x MountType) String() string { } func (MountType) EnumDescriptor() ([]byte, []int) { return fileDescriptorOps, []int{0} } +// CacheSharingOpt defines different sharing modes for cache mount +type CacheSharingOpt int32 + +const ( + // SHARED cache mount can be used concurrently by multiple writers + CacheSharingOpt_SHARED CacheSharingOpt = 0 + // PRIVATE creates a new mount if there are multiple writers + CacheSharingOpt_PRIVATE CacheSharingOpt = 1 + // LOCKED pauses second writer until first one releases the mount + CacheSharingOpt_LOCKED CacheSharingOpt = 2 +) + +var CacheSharingOpt_name = map[int32]string{ + 0: "SHARED", + 1: "PRIVATE", + 2: "LOCKED", +} +var CacheSharingOpt_value = map[string]int32{ + "SHARED": 0, + "PRIVATE": 1, + "LOCKED": 2, +} + +func (x CacheSharingOpt) String() string { + return proto.EnumName(CacheSharingOpt_name, int32(x)) +} +func (CacheSharingOpt) EnumDescriptor() ([]byte, []int) { return fileDescriptorOps, []int{1} } + // Op represents a vertex of the LLB DAG. type Op struct { // inputs is a set of input edges. @@ -89,7 +119,9 @@ type Op struct { // *Op_Source // *Op_Copy // *Op_Build - Op isOp_Op `protobuf_oneof:"op"` + Op isOp_Op `protobuf_oneof:"op"` + Platform *Platform `protobuf:"bytes,10,opt,name=platform" json:"platform,omitempty"` + Constraints *WorkerConstraints `protobuf:"bytes,11,opt,name=constraints" json:"constraints,omitempty"` } func (m *Op) Reset() { *m = Op{} } @@ -163,6 +195,20 @@ func (m *Op) GetBuild() *BuildOp { return nil } +func (m *Op) GetPlatform() *Platform { + if m != nil { + return m.Platform + } + return nil +} + +func (m *Op) GetConstraints() *WorkerConstraints { + if m != nil { + return m.Constraints + } + return nil +} + // XXX_OneofFuncs is for the internal use of the proto package. func (*Op) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { return _Op_OneofMarshaler, _Op_OneofUnmarshaler, _Op_OneofSizer, []interface{}{ @@ -275,6 +321,55 @@ func _Op_OneofSizer(msg proto.Message) (n int) { return n } +// Platform is github.com/opencontainers/image-spec/specs-go/v1.Platform +type Platform struct { + Architecture string `protobuf:"bytes,1,opt,name=Architecture,proto3" json:"Architecture,omitempty"` + OS string `protobuf:"bytes,2,opt,name=OS,proto3" json:"OS,omitempty"` + Variant string `protobuf:"bytes,3,opt,name=Variant,proto3" json:"Variant,omitempty"` + OSVersion string `protobuf:"bytes,4,opt,name=OSVersion,proto3" json:"OSVersion,omitempty"` + OSFeatures []string `protobuf:"bytes,5,rep,name=OSFeatures" json:"OSFeatures,omitempty"` +} + +func (m *Platform) Reset() { *m = Platform{} } +func (m *Platform) String() string { return proto.CompactTextString(m) } +func (*Platform) ProtoMessage() {} +func (*Platform) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{1} } + +func (m *Platform) GetArchitecture() string { + if m != nil { + return m.Architecture + } + return "" +} + +func (m *Platform) GetOS() string { + if m != nil { + return m.OS + } + return "" +} + +func (m *Platform) GetVariant() string { + if m != nil { + return m.Variant + } + return "" +} + +func (m *Platform) GetOSVersion() string { + if m != nil { + return m.OSVersion + } + return "" +} + +func (m *Platform) GetOSFeatures() []string { + if m != nil { + return m.OSFeatures + } + return nil +} + // Input represents an input edge for an Op. type Input struct { // digest of the marshaled input Op @@ -286,7 +381,7 @@ type Input struct { func (m *Input) Reset() { *m = Input{} } func (m *Input) String() string { return proto.CompactTextString(m) } func (*Input) ProtoMessage() {} -func (*Input) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{1} } +func (*Input) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{2} } // ExecOp executes a command in a container. type ExecOp struct { @@ -297,7 +392,7 @@ type ExecOp struct { func (m *ExecOp) Reset() { *m = ExecOp{} } func (m *ExecOp) String() string { return proto.CompactTextString(m) } func (*ExecOp) ProtoMessage() {} -func (*ExecOp) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{2} } +func (*ExecOp) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{3} } func (m *ExecOp) GetMeta() *Meta { if m != nil { @@ -327,7 +422,7 @@ type Meta struct { func (m *Meta) Reset() { *m = Meta{} } func (m *Meta) String() string { return proto.CompactTextString(m) } func (*Meta) ProtoMessage() {} -func (*Meta) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{3} } +func (*Meta) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{4} } func (m *Meta) GetArgs() []string { if m != nil { @@ -378,7 +473,7 @@ type Mount struct { func (m *Mount) Reset() { *m = Mount{} } func (m *Mount) String() string { return proto.CompactTextString(m) } func (*Mount) ProtoMessage() {} -func (*Mount) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{4} } +func (*Mount) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{5} } func (m *Mount) GetSelector() string { if m != nil { @@ -415,14 +510,18 @@ func (m *Mount) GetCacheOpt() *CacheOpt { return nil } +// CacheOpt defines options specific to cache mounts type CacheOpt struct { + // ID is an optional namespace for the mount ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` + // Sharing is the sharing mode for the mount + Sharing CacheSharingOpt `protobuf:"varint,2,opt,name=sharing,proto3,enum=pb.CacheSharingOpt" json:"sharing,omitempty"` } func (m *CacheOpt) Reset() { *m = CacheOpt{} } func (m *CacheOpt) String() string { return proto.CompactTextString(m) } func (*CacheOpt) ProtoMessage() {} -func (*CacheOpt) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{5} } +func (*CacheOpt) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{6} } func (m *CacheOpt) GetID() string { if m != nil { @@ -431,6 +530,13 @@ func (m *CacheOpt) GetID() string { return "" } +func (m *CacheOpt) GetSharing() CacheSharingOpt { + if m != nil { + return m.Sharing + } + return CacheSharingOpt_SHARED +} + // CopyOp copies files across Ops. type CopyOp struct { Src []*CopySource `protobuf:"bytes,1,rep,name=src" json:"src,omitempty"` @@ -440,7 +546,7 @@ type CopyOp struct { func (m *CopyOp) Reset() { *m = CopyOp{} } func (m *CopyOp) String() string { return proto.CompactTextString(m) } func (*CopyOp) ProtoMessage() {} -func (*CopyOp) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{6} } +func (*CopyOp) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{7} } func (m *CopyOp) GetSrc() []*CopySource { if m != nil { @@ -465,7 +571,7 @@ type CopySource struct { func (m *CopySource) Reset() { *m = CopySource{} } func (m *CopySource) String() string { return proto.CompactTextString(m) } func (*CopySource) ProtoMessage() {} -func (*CopySource) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{7} } +func (*CopySource) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{8} } func (m *CopySource) GetSelector() string { if m != nil { @@ -486,7 +592,7 @@ type SourceOp struct { func (m *SourceOp) Reset() { *m = SourceOp{} } func (m *SourceOp) String() string { return proto.CompactTextString(m) } func (*SourceOp) ProtoMessage() {} -func (*SourceOp) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{8} } +func (*SourceOp) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{9} } func (m *SourceOp) GetIdentifier() string { if m != nil { @@ -513,7 +619,7 @@ type BuildOp struct { func (m *BuildOp) Reset() { *m = BuildOp{} } func (m *BuildOp) String() string { return proto.CompactTextString(m) } func (*BuildOp) ProtoMessage() {} -func (*BuildOp) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{9} } +func (*BuildOp) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{10} } func (m *BuildOp) GetInputs() map[string]*BuildInput { if m != nil { @@ -544,22 +650,23 @@ type BuildInput struct { func (m *BuildInput) Reset() { *m = BuildInput{} } func (m *BuildInput) String() string { return proto.CompactTextString(m) } func (*BuildInput) ProtoMessage() {} -func (*BuildInput) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{10} } +func (*BuildInput) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{11} } // OpMetadata is a per-vertex metadata entry, which can be defined for arbitrary Op vertex and overridable on the run time. type OpMetadata struct { // ignore_cache specifies to ignore the cache for this Op. IgnoreCache bool `protobuf:"varint,1,opt,name=ignore_cache,json=ignoreCache,proto3" json:"ignore_cache,omitempty"` // Description can be used for keeping any text fields that builder doesn't parse - Description map[string]string `protobuf:"bytes,2,rep,name=description" json:"description,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - WorkerConstraint *WorkerConstraint `protobuf:"bytes,3,opt,name=worker_constraint,json=workerConstraint" json:"worker_constraint,omitempty"` - ExportCache *ExportCache `protobuf:"bytes,4,opt,name=export_cache,json=exportCache" json:"export_cache,omitempty"` + Description map[string]string `protobuf:"bytes,2,rep,name=description" json:"description,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // index 3 reserved for WorkerConstraint in previous versions + // WorkerConstraint worker_constraint = 3; + ExportCache *ExportCache `protobuf:"bytes,4,opt,name=export_cache,json=exportCache" json:"export_cache,omitempty"` } func (m *OpMetadata) Reset() { *m = OpMetadata{} } func (m *OpMetadata) String() string { return proto.CompactTextString(m) } func (*OpMetadata) ProtoMessage() {} -func (*OpMetadata) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{11} } +func (*OpMetadata) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{12} } func (m *OpMetadata) GetIgnoreCache() bool { if m != nil { @@ -575,13 +682,6 @@ func (m *OpMetadata) GetDescription() map[string]string { return nil } -func (m *OpMetadata) GetWorkerConstraint() *WorkerConstraint { - if m != nil { - return m.WorkerConstraint - } - return nil -} - func (m *OpMetadata) GetExportCache() *ExportCache { if m != nil { return m.ExportCache @@ -596,7 +696,7 @@ type ExportCache struct { func (m *ExportCache) Reset() { *m = ExportCache{} } func (m *ExportCache) String() string { return proto.CompactTextString(m) } func (*ExportCache) ProtoMessage() {} -func (*ExportCache) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{12} } +func (*ExportCache) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{13} } func (m *ExportCache) GetValue() bool { if m != nil { @@ -615,7 +715,7 @@ type ProxyEnv struct { func (m *ProxyEnv) Reset() { *m = ProxyEnv{} } func (m *ProxyEnv) String() string { return proto.CompactTextString(m) } func (*ProxyEnv) ProtoMessage() {} -func (*ProxyEnv) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{13} } +func (*ProxyEnv) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{14} } func (m *ProxyEnv) GetHttpProxy() string { if m != nil { @@ -645,17 +745,17 @@ func (m *ProxyEnv) GetNoProxy() string { return "" } -// WorkerConstraint is experimental and likely to be changed. -type WorkerConstraint struct { +// WorkerConstraints defines conditions for the worker +type WorkerConstraints struct { Filter []string `protobuf:"bytes,1,rep,name=filter" json:"filter,omitempty"` } -func (m *WorkerConstraint) Reset() { *m = WorkerConstraint{} } -func (m *WorkerConstraint) String() string { return proto.CompactTextString(m) } -func (*WorkerConstraint) ProtoMessage() {} -func (*WorkerConstraint) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{14} } +func (m *WorkerConstraints) Reset() { *m = WorkerConstraints{} } +func (m *WorkerConstraints) String() string { return proto.CompactTextString(m) } +func (*WorkerConstraints) ProtoMessage() {} +func (*WorkerConstraints) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{15} } -func (m *WorkerConstraint) GetFilter() []string { +func (m *WorkerConstraints) GetFilter() []string { if m != nil { return m.Filter } @@ -674,7 +774,7 @@ type Definition struct { func (m *Definition) Reset() { *m = Definition{} } func (m *Definition) String() string { return proto.CompactTextString(m) } func (*Definition) ProtoMessage() {} -func (*Definition) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{15} } +func (*Definition) Descriptor() ([]byte, []int) { return fileDescriptorOps, []int{16} } func (m *Definition) GetDef() [][]byte { if m != nil { @@ -692,6 +792,7 @@ func (m *Definition) GetMetadata() map[github_com_opencontainers_go_digest.Diges func init() { proto.RegisterType((*Op)(nil), "pb.Op") + proto.RegisterType((*Platform)(nil), "pb.Platform") proto.RegisterType((*Input)(nil), "pb.Input") proto.RegisterType((*ExecOp)(nil), "pb.ExecOp") proto.RegisterType((*Meta)(nil), "pb.Meta") @@ -705,9 +806,10 @@ func init() { proto.RegisterType((*OpMetadata)(nil), "pb.OpMetadata") proto.RegisterType((*ExportCache)(nil), "pb.ExportCache") proto.RegisterType((*ProxyEnv)(nil), "pb.ProxyEnv") - proto.RegisterType((*WorkerConstraint)(nil), "pb.WorkerConstraint") + proto.RegisterType((*WorkerConstraints)(nil), "pb.WorkerConstraints") proto.RegisterType((*Definition)(nil), "pb.Definition") proto.RegisterEnum("pb.MountType", MountType_name, MountType_value) + proto.RegisterEnum("pb.CacheSharingOpt", CacheSharingOpt_name, CacheSharingOpt_value) } func (m *Op) Marshal() (dAtA []byte, err error) { size := m.Size() @@ -743,6 +845,26 @@ func (m *Op) MarshalTo(dAtA []byte) (int, error) { } i += nn1 } + if m.Platform != nil { + dAtA[i] = 0x52 + i++ + i = encodeVarintOps(dAtA, i, uint64(m.Platform.Size())) + n2, err := m.Platform.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if m.Constraints != nil { + dAtA[i] = 0x5a + i++ + i = encodeVarintOps(dAtA, i, uint64(m.Constraints.Size())) + n3, err := m.Constraints.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } return i, nil } @@ -752,11 +874,11 @@ func (m *Op_Exec) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x12 i++ i = encodeVarintOps(dAtA, i, uint64(m.Exec.Size())) - n2, err := m.Exec.MarshalTo(dAtA[i:]) + n4, err := m.Exec.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n2 + i += n4 } return i, nil } @@ -766,11 +888,11 @@ func (m *Op_Source) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x1a i++ i = encodeVarintOps(dAtA, i, uint64(m.Source.Size())) - n3, err := m.Source.MarshalTo(dAtA[i:]) + n5, err := m.Source.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n3 + i += n5 } return i, nil } @@ -780,11 +902,11 @@ func (m *Op_Copy) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x22 i++ i = encodeVarintOps(dAtA, i, uint64(m.Copy.Size())) - n4, err := m.Copy.MarshalTo(dAtA[i:]) + n6, err := m.Copy.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n4 + i += n6 } return i, nil } @@ -794,14 +916,71 @@ func (m *Op_Build) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x2a i++ i = encodeVarintOps(dAtA, i, uint64(m.Build.Size())) - n5, err := m.Build.MarshalTo(dAtA[i:]) + n7, err := m.Build.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n5 + i += n7 } return i, nil } +func (m *Platform) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Platform) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Architecture) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintOps(dAtA, i, uint64(len(m.Architecture))) + i += copy(dAtA[i:], m.Architecture) + } + if len(m.OS) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintOps(dAtA, i, uint64(len(m.OS))) + i += copy(dAtA[i:], m.OS) + } + if len(m.Variant) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintOps(dAtA, i, uint64(len(m.Variant))) + i += copy(dAtA[i:], m.Variant) + } + if len(m.OSVersion) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintOps(dAtA, i, uint64(len(m.OSVersion))) + i += copy(dAtA[i:], m.OSVersion) + } + if len(m.OSFeatures) > 0 { + for _, s := range m.OSFeatures { + dAtA[i] = 0x2a + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + return i, nil +} + func (m *Input) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -850,11 +1029,11 @@ func (m *ExecOp) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0xa i++ i = encodeVarintOps(dAtA, i, uint64(m.Meta.Size())) - n6, err := m.Meta.MarshalTo(dAtA[i:]) + n8, err := m.Meta.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n6 + i += n8 } if len(m.Mounts) > 0 { for _, msg := range m.Mounts { @@ -932,11 +1111,11 @@ func (m *Meta) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x2a i++ i = encodeVarintOps(dAtA, i, uint64(m.ProxyEnv.Size())) - n7, err := m.ProxyEnv.MarshalTo(dAtA[i:]) + n9, err := m.ProxyEnv.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n7 + i += n9 } return i, nil } @@ -999,11 +1178,11 @@ func (m *Mount) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x1 i++ i = encodeVarintOps(dAtA, i, uint64(m.CacheOpt.Size())) - n8, err := m.CacheOpt.MarshalTo(dAtA[i:]) + n10, err := m.CacheOpt.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n8 + i += n10 } return i, nil } @@ -1029,6 +1208,11 @@ func (m *CacheOpt) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintOps(dAtA, i, uint64(len(m.ID))) i += copy(dAtA[i:], m.ID) } + if m.Sharing != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintOps(dAtA, i, uint64(m.Sharing)) + } return i, nil } @@ -1178,11 +1362,11 @@ func (m *BuildOp) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x12 i++ i = encodeVarintOps(dAtA, i, uint64(v.Size())) - n9, err := v.MarshalTo(dAtA[i:]) + n11, err := v.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n9 + i += n11 } } } @@ -1190,11 +1374,11 @@ func (m *BuildOp) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x1a i++ i = encodeVarintOps(dAtA, i, uint64(m.Def.Size())) - n10, err := m.Def.MarshalTo(dAtA[i:]) + n12, err := m.Def.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n10 + i += n12 } if len(m.Attrs) > 0 { for k, _ := range m.Attrs { @@ -1281,25 +1465,15 @@ func (m *OpMetadata) MarshalTo(dAtA []byte) (int, error) { i += copy(dAtA[i:], v) } } - if m.WorkerConstraint != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintOps(dAtA, i, uint64(m.WorkerConstraint.Size())) - n11, err := m.WorkerConstraint.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n11 - } if m.ExportCache != nil { dAtA[i] = 0x22 i++ i = encodeVarintOps(dAtA, i, uint64(m.ExportCache.Size())) - n12, err := m.ExportCache.MarshalTo(dAtA[i:]) + n13, err := m.ExportCache.MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n12 + i += n13 } return i, nil } @@ -1374,7 +1548,7 @@ func (m *ProxyEnv) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func (m *WorkerConstraint) Marshal() (dAtA []byte, err error) { +func (m *WorkerConstraints) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -1384,7 +1558,7 @@ func (m *WorkerConstraint) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *WorkerConstraint) MarshalTo(dAtA []byte) (int, error) { +func (m *WorkerConstraints) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -1449,11 +1623,11 @@ func (m *Definition) MarshalTo(dAtA []byte) (int, error) { dAtA[i] = 0x12 i++ i = encodeVarintOps(dAtA, i, uint64((&v).Size())) - n13, err := (&v).MarshalTo(dAtA[i:]) + n14, err := (&v).MarshalTo(dAtA[i:]) if err != nil { return 0, err } - i += n13 + i += n14 } } return i, nil @@ -1480,6 +1654,14 @@ func (m *Op) Size() (n int) { if m.Op != nil { n += m.Op.Size() } + if m.Platform != nil { + l = m.Platform.Size() + n += 1 + l + sovOps(uint64(l)) + } + if m.Constraints != nil { + l = m.Constraints.Size() + n += 1 + l + sovOps(uint64(l)) + } return n } @@ -1519,6 +1701,34 @@ func (m *Op_Build) Size() (n int) { } return n } +func (m *Platform) Size() (n int) { + var l int + _ = l + l = len(m.Architecture) + if l > 0 { + n += 1 + l + sovOps(uint64(l)) + } + l = len(m.OS) + if l > 0 { + n += 1 + l + sovOps(uint64(l)) + } + l = len(m.Variant) + if l > 0 { + n += 1 + l + sovOps(uint64(l)) + } + l = len(m.OSVersion) + if l > 0 { + n += 1 + l + sovOps(uint64(l)) + } + if len(m.OSFeatures) > 0 { + for _, s := range m.OSFeatures { + l = len(s) + n += 1 + l + sovOps(uint64(l)) + } + } + return n +} + func (m *Input) Size() (n int) { var l int _ = l @@ -1615,6 +1825,9 @@ func (m *CacheOpt) Size() (n int) { if l > 0 { n += 1 + l + sovOps(uint64(l)) } + if m.Sharing != 0 { + n += 1 + sovOps(uint64(m.Sharing)) + } return n } @@ -1722,10 +1935,6 @@ func (m *OpMetadata) Size() (n int) { n += mapEntrySize + 1 + sovOps(uint64(mapEntrySize)) } } - if m.WorkerConstraint != nil { - l = m.WorkerConstraint.Size() - n += 1 + l + sovOps(uint64(l)) - } if m.ExportCache != nil { l = m.ExportCache.Size() n += 1 + l + sovOps(uint64(l)) @@ -1764,7 +1973,7 @@ func (m *ProxyEnv) Size() (n int) { return n } -func (m *WorkerConstraint) Size() (n int) { +func (m *WorkerConstraints) Size() (n int) { var l int _ = l if len(m.Filter) > 0 { @@ -1998,6 +2207,267 @@ func (m *Op) Unmarshal(dAtA []byte) error { } m.Op = &Op_Build{v} iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Platform", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOps + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOps + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Platform == nil { + m.Platform = &Platform{} + } + if err := m.Platform.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Constraints", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOps + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOps + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Constraints == nil { + m.Constraints = &WorkerConstraints{} + } + if err := m.Constraints.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOps(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthOps + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Platform) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOps + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Platform: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Platform: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Architecture", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOps + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOps + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Architecture = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OS", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOps + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOps + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OS = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Variant", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOps + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOps + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Variant = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OSVersion", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOps + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOps + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OSVersion = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OSFeatures", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOps + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOps + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OSFeatures = append(m.OSFeatures, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipOps(dAtA[iNdEx:]) @@ -2706,6 +3176,25 @@ func (m *CacheOpt) Unmarshal(dAtA []byte) error { } m.ID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Sharing", wireType) + } + m.Sharing = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOps + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Sharing |= (CacheSharingOpt(b) & 0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipOps(dAtA[iNdEx:]) @@ -3711,39 +4200,6 @@ func (m *OpMetadata) Unmarshal(dAtA []byte) error { } m.Description[mapkey] = mapvalue iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WorkerConstraint", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOps - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthOps - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.WorkerConstraint == nil { - m.WorkerConstraint = &WorkerConstraint{} - } - if err := m.WorkerConstraint.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ExportCache", wireType) @@ -4034,7 +4490,7 @@ func (m *ProxyEnv) Unmarshal(dAtA []byte) error { } return nil } -func (m *WorkerConstraint) Unmarshal(dAtA []byte) error { +func (m *WorkerConstraints) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4057,10 +4513,10 @@ func (m *WorkerConstraint) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: WorkerConstraint: wiretype end group for non-group") + return fmt.Errorf("proto: WorkerConstraints: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: WorkerConstraint: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: WorkerConstraints: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4423,72 +4879,81 @@ var ( func init() { proto.RegisterFile("ops.proto", fileDescriptorOps) } var fileDescriptorOps = []byte{ - // 1062 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xdd, 0x6e, 0x1b, 0xc5, - 0x17, 0xcf, 0xae, 0x3f, 0xb2, 0x7b, 0x36, 0xed, 0xdf, 0xff, 0x21, 0x2a, 0xc6, 0x94, 0xc4, 0x6c, - 0x11, 0x72, 0xd3, 0xc6, 0x91, 0x8c, 0x84, 0x2a, 0x2e, 0x2a, 0xe2, 0x0f, 0x14, 0x83, 0x42, 0xaa, - 0x49, 0x04, 0x97, 0x91, 0xbd, 0x1e, 0x3b, 0xab, 0x3a, 0x3b, 0xab, 0xdd, 0xd9, 0x24, 0xbe, 0x00, - 0x89, 0x3e, 0x01, 0x12, 0x4f, 0xc1, 0x43, 0xc0, 0x75, 0x2f, 0xb9, 0x85, 0x8b, 0x82, 0xc2, 0x8b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6, 0xda, 0x6f, 0x2f, 0xb6, 0x77, 0x56, 0x08, 0x91, 0xb1, - 0x88, 0x02, 0x19, 0xa9, 0x51, 0x18, 0x89, 0x24, 0xdd, 0x9b, 0xc9, 0x5d, 0x6d, 0xd2, 0xee, 0xd3, - 0x0f, 0x37, 0x1e, 0xd8, 0x7d, 0xa8, 0x84, 0xd1, 0x44, 0x5c, 0x51, 0xb2, 0xa5, 0xee, 0x5b, 0xc6, - 0x95, 0x77, 0x94, 0xa9, 0x38, 0x53, 0x43, 0x54, 0x71, 0x8d, 0xf0, 0x87, 0x50, 0xd5, 0x34, 0xb0, - 0xbb, 0x50, 0x3e, 0x17, 0x6a, 0x44, 0xcf, 0x7b, 0x1d, 0x07, 0x63, 0x3e, 0x14, 0x6a, 0xc4, 0x49, - 0x8a, 0x0c, 0x9f, 0xcb, 0x2c, 0x52, 0x69, 0xdd, 0x2e, 0x18, 0x3e, 0x44, 0x09, 0x37, 0x0a, 0xff, - 0x1b, 0x28, 0xa3, 0x01, 0x63, 0x50, 0x1e, 0x25, 0x33, 0x5d, 0x0a, 0x97, 0xd3, 0x99, 0xd5, 0xa0, - 0x24, 0xa2, 0x0b, 0xb2, 0x75, 0x39, 0x1e, 0x51, 0x12, 0x5c, 0x4e, 0x88, 0x6a, 0x97, 0xe3, 0x11, - 0xed, 0xb2, 0x54, 0x24, 0xc4, 0xab, 0xcb, 0xe9, 0xcc, 0xee, 0x83, 0x1b, 0x27, 0xf2, 0x6a, 0x71, - 0x8a, 0xd6, 0x95, 0xa2, 0x2c, 0x4f, 0x50, 0x38, 0x88, 0x2e, 0xb8, 0x13, 0x9b, 0x93, 0xff, 0x9d, - 0x0d, 0x15, 0x0a, 0x88, 0xb5, 0x30, 0xfd, 0x38, 0xd3, 0x4c, 0x96, 0xba, 0xcc, 0xa4, 0x0f, 0x44, - 0x74, 0x9e, 0x3d, 0x92, 0xde, 0x00, 0x27, 0x15, 0x73, 0x11, 0x28, 0x99, 0x10, 0x57, 0x2e,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0x8f, 0x0f, 0x4e, 0x6a, 0x16, 0x5b, 0x87, 0xd2, 0xf1, 0xf1, 0x41, 0xcd, 0x66, 0x2e, - 0x54, 0x7a, 0xfb, 0xbd, 0x83, 0x41, 0xad, 0x84, 0xc7, 0x93, 0xc3, 0x27, 0x9f, 0x1d, 0xd7, 0xca, - 0xdd, 0xda, 0xf3, 0xeb, 0x2d, 0xeb, 0x97, 0xeb, 0x2d, 0xeb, 0x8f, 0xeb, 0x2d, 0xeb, 0xfb, 0x3f, - 0xb7, 0xd6, 0xc6, 0x55, 0xfa, 0x17, 0xf4, 0xd1, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa8, 0x76, - 0x25, 0x54, 0x45, 0x09, 0x00, 0x00, + // 1203 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4d, 0x8f, 0x1b, 0x45, + 0x13, 0xde, 0x19, 0x7f, 0xcd, 0xd4, 0x6c, 0x36, 0x7e, 0x3b, 0x79, 0x83, 0x59, 0xc2, 0xae, 0x99, + 0x20, 0xe4, 0x7c, 0xac, 0x57, 0x32, 0x52, 0x88, 0x38, 0x44, 0xac, 0x3f, 0xa2, 0x35, 0x21, 0x38, + 0x6a, 0xaf, 0x96, 0x63, 0x34, 0x1e, 0xb7, 0xbd, 0xa3, 0x78, 0xa7, 0x47, 0x3d, 0xed, 0xb0, 0x3e, + 0x80, 0x44, 0x7e, 0x01, 0x12, 0x12, 0x77, 0x7e, 0x08, 0xf7, 0x1c, 0xb9, 0xc2, 0x21, 0xa0, 0x20, + 0xf1, 0x3b, 0x50, 0x75, 0xb7, 0x67, 0x66, 0x93, 0x20, 0x25, 0x82, 0x93, 0xbb, 0xab, 0x9e, 0x7a, + 0xba, 0xea, 0xe9, 0x9a, 0x6a, 0x83, 0xcb, 0x93, 0xb4, 0x9d, 0x08, 0x2e, 0x39, 0xb1, 0x93, 0xc9, + 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0x03, 0x08, + 0x81, 0x72, 0x20, 0xe6, 0xba, 0x0d, 0x5d, 0xaa, 0xd6, 0xa4, 0x0e, 0x25, 0x16, 0x3f, 0x51, 0xb1, + 0x2e, 0xc5, 0x25, 0x5a, 0xc2, 0xaf, 0xa7, 0x46, 0x4c, 0x5c, 0x62, 0xdc, 0x32, 0x65, 0xc2, 0x68, + 0xa8, 0xd6, 0xe4, 0x3a, 0xb8, 0x89, 0xe0, 0x67, 0xab, 0x47, 0x18, 0x5d, 0x29, 0x74, 0x08, 0x1a, + 0x07, 0xf1, 0x13, 0xea, 0x24, 0x66, 0xe5, 0x7f, 0x67, 0x43, 0x45, 0x25, 0x44, 0x5a, 0x58, 0x7e, + 0xb2, 0xd4, 0x4a, 0x96, 0xba, 0xc4, 0x94, 0x0f, 0x4a, 0xe8, 0xac, 0x7a, 0x14, 0x7d, 0x1b, 0x9c, + 0x94, 0x2d, 0x58, 0x28, 0xb9, 0x30, 0x77, 0x9d, 0xed, 0x31, 0x9d, 0x29, 0x5e, 0x87, 0xce, 0x50, + 0xad, 0xc9, 0x4d, 0xa8, 0x72, 0xa5, 0xa1, 0x4a, 0xf2, 0x1f, 0x94, 0x35, 0x10, 0x24, 0x17, 0x2c, + 0x98, 0xf2, 0x78, 0xb1, 0x52, 0xa9, 0x3b, 0x34, 0xdb, 0x93, 0x9b, 0xe0, 0x2a, 0xd5, 0x8e, 0x56, + 0x09, 0x6b, 0x54, 0x9b, 0x56, 0x6b, 0xab, 0x73, 0x21, 0x53, 0x14, 0x8d, 0x34, 0xf7, 0xe3, 0x57, + 0x12, 0x06, 0xe1, 0x09, 0x1b, 0x25, 0xb2, 0x71, 0x39, 0xd7, 0xa0, 0x67, 0x6c, 0x34, 0xf3, 0xfa, + 0x43, 0x70, 0xd6, 0x56, 0xec, 0xe0, 0x61, 0xdf, 0xf4, 0xb6, 0x3d, 0xec, 0x93, 0x3d, 0xa8, 0xa5, + 0x27, 0x81, 0x88, 0xe2, 0xb9, 0x2a, 0x75, 0xab, 0x73, 0x29, 0x23, 0x19, 0x6b, 0x3b, 0x72, 0xad, + 0x31, 0xfe, 0x5d, 0xa8, 0xea, 0x2f, 0x9a, 0x34, 0xa1, 0x94, 0x8a, 0xd0, 0x4c, 0x95, 0xad, 0xf5, + 0xa7, 0xae, 0x87, 0x02, 0x45, 0x57, 0x26, 0x95, 0x9d, 0x4b, 0xe5, 0x53, 0x80, 0x1c, 0xf6, 0xdf, + 0x5c, 0x89, 0xff, 0x83, 0x05, 0xce, 0x7a, 0x18, 0xe1, 0x97, 0x15, 0x4d, 0x59, 0x2c, 0xa3, 0x59, + 0xc4, 0x84, 0xa9, 0xb3, 0x60, 0x21, 0x7b, 0x50, 0x09, 0xa4, 0x14, 0xeb, 0x86, 0x7d, 0xa7, 0x38, + 0xc9, 0xda, 0x07, 0xe8, 0x19, 0xc4, 0x52, 0xac, 0xa8, 0x46, 0x6d, 0xdf, 0x01, 0xc8, 0x8d, 0xd8, + 0x9d, 0x8f, 0xd9, 0xca, 0xb0, 0xe2, 0x92, 0x5c, 0x86, 0xca, 0x93, 0x60, 0xb1, 0x64, 0x26, 0x29, + 0xbd, 0xf9, 0xd4, 0xbe, 0x63, 0xf9, 0x3f, 0xdb, 0x50, 0x33, 0x93, 0x8d, 0xdc, 0x82, 0x9a, 0x9a, + 0x6c, 0x26, 0xa3, 0xd7, 0x57, 0xba, 0x86, 0x90, 0xfd, 0x6c, 0x64, 0x17, 0x72, 0x34, 0x54, 0x7a, + 0x74, 0x9b, 0x1c, 0xf3, 0x01, 0x5e, 0x9a, 0xb2, 0x99, 0x99, 0xcd, 0xea, 0x2a, 0xfa, 0x6c, 0x16, + 0xc5, 0x91, 0x8c, 0x78, 0x4c, 0xd1, 0x45, 0x6e, 0xad, 0xab, 0x2e, 0x2b, 0xc6, 0x2b, 0x45, 0xc6, + 0x57, 0x8b, 0x1e, 0x82, 0x57, 0x38, 0xe6, 0x35, 0x55, 0x7f, 0x58, 0xac, 0xda, 0x1c, 0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xe7, 0xff, 0x6a, 0x01, 0xe4, 0xed, 0x8b, 0x8a, 0x60, 0x6f, 0x23, + 0x66, 0x53, 0xf7, 0xf2, 0x02, 0x9c, 0x53, 0x73, 0x2b, 0xe6, 0xae, 0xae, 0x9e, 0x6f, 0xf9, 0xf6, + 0xfa, 0xd2, 0x94, 0xa6, 0xfa, 0xc9, 0x7c, 0xfa, 0xfb, 0x5b, 0x3d, 0x99, 0xd9, 0x09, 0xdb, 0xf7, + 0xe1, 0xc2, 0x39, 0xba, 0x37, 0xfc, 0x1a, 0xf2, 0xce, 0x29, 0x5c, 0xd9, 0x8d, 0xcf, 0xc0, 0xcd, + 0x46, 0x39, 0x71, 0xa0, 0xdc, 0x1d, 0x7e, 0xd9, 0xaf, 0x6f, 0x10, 0x80, 0xea, 0x78, 0xd0, 0xa3, + 0x83, 0xa3, 0xba, 0x45, 0x6a, 0x50, 0x1a, 0x8f, 0x0f, 0xeb, 0x36, 0x71, 0xa1, 0xd2, 0x3b, 0xe8, + 0x1d, 0x0e, 0xea, 0x25, 0x5c, 0x1e, 0x3d, 0x78, 0x78, 0x6f, 0x5c, 0x2f, 0xdf, 0xb8, 0x0d, 0x17, + 0x5f, 0x9a, 0xcd, 0x2a, 0xfa, 0xf0, 0x80, 0x0e, 0x90, 0xc9, 0x83, 0xda, 0x43, 0x3a, 0x3c, 0x3e, + 0x38, 0x1a, 0xd4, 0x2d, 0x74, 0x7c, 0x31, 0xea, 0xdd, 0x1f, 0xf4, 0xeb, 0x76, 0xb7, 0xfe, 0xec, + 0xc5, 0x8e, 0xf5, 0xcb, 0x8b, 0x1d, 0xeb, 0x8f, 0x17, 0x3b, 0xd6, 0xf7, 0x7f, 0xee, 0x6c, 0x4c, + 0xaa, 0xea, 0x6f, 0xe2, 0xc7, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x42, 0x80, 0x11, 0x1b, 0x66, + 0x0a, 0x00, 0x00, } diff --git a/components/cli/vendor/github.com/moby/buildkit/solver/pb/ops.proto b/components/cli/vendor/github.com/moby/buildkit/solver/pb/ops.proto index 8b7af2d404..6f0a524805 100644 --- a/components/cli/vendor/github.com/moby/buildkit/solver/pb/ops.proto +++ b/components/cli/vendor/github.com/moby/buildkit/solver/pb/ops.proto @@ -15,7 +15,18 @@ message Op { SourceOp source = 3; CopyOp copy = 4; BuildOp build = 5; - } + } + 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 } // Input represents an input edge for an Op. @@ -54,6 +65,7 @@ message Mount { CacheOpt cacheOpt = 20; } +// MountType defines a type of a mount from a supported set enum MountType { BIND = 0; SECRET = 1; @@ -62,8 +74,22 @@ enum MountType { TMPFS = 4; } +// CacheOpt defines options specific to cache mounts message CacheOpt { + // ID is an optional namespace for the mount string ID = 1; + // 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; } // CopyOp copies files across Ops. @@ -106,8 +132,9 @@ message OpMetadata { // ignore_cache specifies to ignore the cache for this Op. bool ignore_cache = 1; // Description can be used for keeping any text fields that builder doesn't parse - map description = 2; - WorkerConstraint worker_constraint = 3; + map description = 2; + // index 3 reserved for WorkerConstraint in previous versions + // WorkerConstraint worker_constraint = 3; ExportCache export_cache = 4; } @@ -122,8 +149,8 @@ message ProxyEnv { string no_proxy = 4; } -// WorkerConstraint is experimental and likely to be changed. -message WorkerConstraint { +// WorkerConstraints defines conditions for the worker +message WorkerConstraints { repeated string filter = 1; // containerd-style filter } diff --git a/components/cli/vendor/github.com/moby/buildkit/util/progress/progressui/display.go b/components/cli/vendor/github.com/moby/buildkit/util/progress/progressui/display.go index fd7a8c23c3..0be544d42d 100644 --- a/components/cli/vendor/github.com/moby/buildkit/util/progress/progressui/display.go +++ b/components/cli/vendor/github.com/moby/buildkit/util/progress/progressui/display.go @@ -212,8 +212,9 @@ func (t *trace) update(s *client.SolveStatus) { if !ok { continue // shouldn't happen } + i := 0 complete := split(l.Data, byte('\n'), func(dt []byte) { - if v.logsPartial && len(v.logs) != 0 { + if v.logsPartial && len(v.logs) != 0 && i == 0 { v.logs[len(v.logs)-1] = append(v.logs[len(v.logs)-1], dt...) } else { ts := time.Duration(0) @@ -222,6 +223,7 @@ func (t *trace) update(s *client.SolveStatus) { } v.logs = append(v.logs, []byte(fmt.Sprintf("#%d %s %s", v.index, fmt.Sprintf("%#.4g", ts.Seconds())[:5], dt))) } + i++ }) v.logsPartial = !complete t.updates[v.Digest] = struct{}{} diff --git a/components/cli/vendor/github.com/moby/buildkit/vendor.conf b/components/cli/vendor/github.com/moby/buildkit/vendor.conf index e4068737a6..26d6a3b6d5 100644 --- a/components/cli/vendor/github.com/moby/buildkit/vendor.conf +++ b/components/cli/vendor/github.com/moby/buildkit/vendor.conf @@ -6,7 +6,7 @@ github.com/davecgh/go-spew v1.1.0 github.com/pmezard/go-difflib v1.0.0 golang.org/x/sys 314a259e304ff91bd6985da2a7149bbf91237993 -github.com/containerd/containerd 63522d9eaa5a0443d225642c4b6f4f5fdedf932b +github.com/containerd/containerd 08f7ee9828af1783dc98cc5cc1739e915697c667 github.com/containerd/typeurl f6943554a7e7e88b3c14aad190bf05932da84788 golang.org/x/sync 450f422ab23cf9881c94e2db30cac0eb1b7cf80c github.com/sirupsen/logrus v1.0.0 @@ -18,7 +18,7 @@ github.com/gogo/googleapis 08a7655d27152912db7aaf4f983275eaf8d128ef github.com/golang/protobuf v1.1.0 github.com/containerd/continuity d3c23511c1bf5851696cba83143d9cbcd666869b github.com/opencontainers/image-spec v1.0.1 -github.com/opencontainers/runc 0e561642f81e84ebd0b3afd6ec510c75a2ccb71b +github.com/opencontainers/runc ad0f5255060d36872be04de22f8731f38ef2d7b1 github.com/Microsoft/go-winio v0.4.7 github.com/containerd/fifo 3d5202aec260678c48179c56f40e6f38a095738c github.com/opencontainers/runtime-spec v1.0.1 @@ -63,5 +63,5 @@ github.com/opentracing-contrib/go-stdlib b1a47cfbdd7543e70e9ef3e73d0802ad306cc1c github.com/opencontainers/selinux 74a747aeaf2d66097b6908f572794f49f07dda2c # used by dockerfile tests -github.com/gotestyourself/gotestyourself cf3a5ab914a2efa8bc838d09f5918c1d44d029 +gotest.tools v2.1.0 github.com/google/go-cmp v0.2.0 diff --git a/components/cli/vendor/github.com/opencontainers/runc/libcontainer/nsenter/nsexec.c b/components/cli/vendor/github.com/opencontainers/runc/libcontainer/nsenter/nsexec.c index 2c69cee5d6..a4cd1399d9 100644 --- a/components/cli/vendor/github.com/opencontainers/runc/libcontainer/nsenter/nsexec.c +++ b/components/cli/vendor/github.com/opencontainers/runc/libcontainer/nsenter/nsexec.c @@ -505,7 +505,8 @@ void join_namespaces(char *nslist) ns->fd = fd; ns->ns = nsflag(namespace); - strncpy(ns->path, path, PATH_MAX); + strncpy(ns->path, path, PATH_MAX - 1); + ns->path[PATH_MAX - 1] = '\0'; } while ((namespace = strtok_r(NULL, ",", &saveptr)) != NULL); /* @@ -678,17 +679,15 @@ void nsexec(void) /* * Enable setgroups(2) if we've been asked to. But we also * have to explicitly disable setgroups(2) if we're - * creating a rootless container (this is required since - * Linux 3.19). + * creating a rootless container for single-entry mapping. + * i.e. config.is_setgroup == false. + * (this is required since Linux 3.19). + * + * For rootless multi-entry mapping, config.is_setgroup shall be true and + * newuidmap/newgidmap shall be used. */ - if (config.is_rootless && config.is_setgroup) { - kill(child, SIGKILL); - bail("cannot allow setgroup in an unprivileged user namespace setup"); - } - if (config.is_setgroup) - update_setgroups(child, SETGROUPS_ALLOW); - if (config.is_rootless) + if (config.is_rootless && !config.is_setgroup) update_setgroups(child, SETGROUPS_DENY); /* Set up mappings. */ @@ -809,25 +808,30 @@ void nsexec(void) if (config.namespaces) join_namespaces(config.namespaces); - /* - * Unshare all of the namespaces. Now, it should be noted that this - * ordering might break in the future (especially with rootless - * containers). But for now, it's not possible to split this into - * CLONE_NEWUSER + [the rest] because of some RHEL SELinux issues. - * - * Note that we don't merge this with clone() because there were - * some old kernel versions where clone(CLONE_PARENT | CLONE_NEWPID) - * was broken, so we'll just do it the long way anyway. - */ - if (unshare(config.cloneflags) < 0) - bail("failed to unshare namespaces"); - /* * Deal with user namespaces first. They are quite special, as they * affect our ability to unshare other namespaces and are used as * context for privilege checks. + * + * We don't unshare all namespaces in one go. The reason for this + * is that, while the kernel documentation may claim otherwise, + * there are certain cases where unsharing all namespaces at once + * will result in namespace objects being owned incorrectly. + * Ideally we should just fix these kernel bugs, but it's better to + * be safe than sorry, and fix them separately. + * + * A specific case of this is that the SELinux label of the + * internal kern-mount that mqueue uses will be incorrect if the + * UTS namespace is cloned before the USER namespace is mapped. + * I've also heard of similar problems with the network namespace + * in some scenarios. This also mirrors how LXC deals with this + * problem. */ if (config.cloneflags & CLONE_NEWUSER) { + if (unshare(CLONE_NEWUSER) < 0) + bail("failed to unshare user namespace"); + config.cloneflags &= ~CLONE_NEWUSER; + /* * We don't have the privileges to do any mapping here (see the * clone_parent rant). So signal our parent to hook us up. @@ -853,8 +857,21 @@ void nsexec(void) if (prctl(PR_SET_DUMPABLE, 0, 0, 0, 0) < 0) bail("failed to set process as dumpable"); } + + /* Become root in the namespace proper. */ + if (setresuid(0, 0, 0) < 0) + bail("failed to become root in user namespace"); } + /* + * Unshare all of the namespaces. Note that we don't merge this + * with clone() because there were some old kernel versions where + * clone(CLONE_PARENT | CLONE_NEWPID) was broken, so we'll just do + * it the long way. + */ + if (unshare(config.cloneflags) < 0) + bail("failed to unshare namespaces"); + /* * TODO: What about non-namespace clone flags that we're dropping here? * diff --git a/components/cli/vendor/github.com/opencontainers/runc/libcontainer/system/linux.go b/components/cli/vendor/github.com/opencontainers/runc/libcontainer/system/linux.go index 5f124cd8bb..a4ae8901ac 100644 --- a/components/cli/vendor/github.com/opencontainers/runc/libcontainer/system/linux.go +++ b/components/cli/vendor/github.com/opencontainers/runc/libcontainer/system/linux.go @@ -3,13 +3,12 @@ package system import ( - "bufio" - "fmt" "os" "os/exec" "syscall" // only for exec "unsafe" + "github.com/opencontainers/runc/libcontainer/user" "golang.org/x/sys/unix" ) @@ -102,34 +101,43 @@ func Setctty() error { } // RunningInUserNS detects whether we are currently running in a user namespace. -// Copied from github.com/lxc/lxd/shared/util.go +// Originally copied from github.com/lxc/lxd/shared/util.go func RunningInUserNS() bool { - file, err := os.Open("/proc/self/uid_map") + uidmap, err := user.CurrentProcessUIDMap() if err != nil { // This kernel-provided file only exists if user namespaces are supported return false } - defer file.Close() + return UIDMapInUserNS(uidmap) +} - buf := bufio.NewReader(file) - l, _, err := buf.ReadLine() - if err != nil { - return false - } - - line := string(l) - var a, b, c int64 - fmt.Sscanf(line, "%d %d %d", &a, &b, &c) +func UIDMapInUserNS(uidmap []user.IDMap) bool { /* * We assume we are in the initial user namespace if we have a full * range - 4294967295 uids starting at uid 0. */ - if a == 0 && b == 0 && c == 4294967295 { + if len(uidmap) == 1 && uidmap[0].ID == 0 && uidmap[0].ParentID == 0 && uidmap[0].Count == 4294967295 { return false } return true } +// GetParentNSeuid returns the euid within the parent user namespace +func GetParentNSeuid() int64 { + euid := int64(os.Geteuid()) + uidmap, err := user.CurrentProcessUIDMap() + if err != nil { + // This kernel-provided file only exists if user namespaces are supported + return euid + } + for _, um := range uidmap { + if um.ID <= euid && euid <= um.ID+um.Count-1 { + return um.ParentID + euid - um.ID + } + } + return euid +} + // SetSubreaper sets the value i as the subreaper setting for the calling process func SetSubreaper(i int) error { return unix.Prctl(PR_SET_CHILD_SUBREAPER, uintptr(i), 0, 0, 0) diff --git a/components/cli/vendor/github.com/opencontainers/runc/libcontainer/system/unsupported.go b/components/cli/vendor/github.com/opencontainers/runc/libcontainer/system/unsupported.go index e7cfd62b29..b94be74a66 100644 --- a/components/cli/vendor/github.com/opencontainers/runc/libcontainer/system/unsupported.go +++ b/components/cli/vendor/github.com/opencontainers/runc/libcontainer/system/unsupported.go @@ -2,8 +2,26 @@ package system +import ( + "os" + + "github.com/opencontainers/runc/libcontainer/user" +) + // RunningInUserNS is a stub for non-Linux systems // Always returns false func RunningInUserNS() bool { return false } + +// UIDMapInUserNS is a stub for non-Linux systems +// Always returns false +func UIDMapInUserNS(uidmap []user.IDMap) bool { + return false +} + +// GetParentNSeuid returns the euid within the parent user namespace +// Always returns os.Geteuid on non-linux +func GetParentNSeuid() int { + return os.Geteuid() +} diff --git a/components/cli/vendor/github.com/opencontainers/runc/libcontainer/user/lookup_unix.go b/components/cli/vendor/github.com/opencontainers/runc/libcontainer/user/lookup_unix.go index c45e300411..c1e634c949 100644 --- a/components/cli/vendor/github.com/opencontainers/runc/libcontainer/user/lookup_unix.go +++ b/components/cli/vendor/github.com/opencontainers/runc/libcontainer/user/lookup_unix.go @@ -114,3 +114,29 @@ func CurrentUser() (User, error) { func CurrentGroup() (Group, error) { return LookupGid(unix.Getgid()) } + +func CurrentUserSubUIDs() ([]SubID, error) { + u, err := CurrentUser() + if err != nil { + return nil, err + } + return ParseSubIDFileFilter("/etc/subuid", + func(entry SubID) bool { return entry.Name == u.Name }) +} + +func CurrentGroupSubGIDs() ([]SubID, error) { + g, err := CurrentGroup() + if err != nil { + return nil, err + } + return ParseSubIDFileFilter("/etc/subgid", + func(entry SubID) bool { return entry.Name == g.Name }) +} + +func CurrentProcessUIDMap() ([]IDMap, error) { + return ParseIDMapFile("/proc/self/uid_map") +} + +func CurrentProcessGIDMap() ([]IDMap, error) { + return ParseIDMapFile("/proc/self/gid_map") +} diff --git a/components/cli/vendor/github.com/opencontainers/runc/libcontainer/user/user.go b/components/cli/vendor/github.com/opencontainers/runc/libcontainer/user/user.go index 93414516ca..7b912bbf8b 100644 --- a/components/cli/vendor/github.com/opencontainers/runc/libcontainer/user/user.go +++ b/components/cli/vendor/github.com/opencontainers/runc/libcontainer/user/user.go @@ -75,12 +75,29 @@ func groupFromOS(g *user.Group) (Group, error) { return newGroup, nil } +// SubID represents an entry in /etc/sub{u,g}id +type SubID struct { + Name string + SubID int64 + Count int64 +} + +// IDMap represents an entry in /proc/PID/{u,g}id_map +type IDMap struct { + ID int64 + ParentID int64 + Count int64 +} + func parseLine(line string, v ...interface{}) { - if line == "" { + parseParts(strings.Split(line, ":"), v...) +} + +func parseParts(parts []string, v ...interface{}) { + if len(parts) == 0 { return } - parts := strings.Split(line, ":") for i, p := range parts { // Ignore cases where we don't have enough fields to populate the arguments. // Some configuration files like to misbehave. @@ -96,6 +113,8 @@ func parseLine(line string, v ...interface{}) { case *int: // "numbers", with conversion errors ignored because of some misbehaving configuration files. *e, _ = strconv.Atoi(p) + case *int64: + *e, _ = strconv.ParseInt(p, 10, 64) case *[]string: // Comma-separated lists. if p != "" { @@ -105,7 +124,7 @@ func parseLine(line string, v ...interface{}) { } default: // Someone goof'd when writing code using this function. Scream so they can hear us. - panic(fmt.Sprintf("parseLine only accepts {*string, *int, *[]string} as arguments! %#v is not a pointer!", e)) + panic(fmt.Sprintf("parseLine only accepts {*string, *int, *int64, *[]string} as arguments! %#v is not a pointer!", e)) } } } @@ -479,3 +498,111 @@ func GetAdditionalGroupsPath(additionalGroups []string, groupPath string) ([]int } return GetAdditionalGroups(additionalGroups, group) } + +func ParseSubIDFile(path string) ([]SubID, error) { + subid, err := os.Open(path) + if err != nil { + return nil, err + } + defer subid.Close() + return ParseSubID(subid) +} + +func ParseSubID(subid io.Reader) ([]SubID, error) { + return ParseSubIDFilter(subid, nil) +} + +func ParseSubIDFileFilter(path string, filter func(SubID) bool) ([]SubID, error) { + subid, err := os.Open(path) + if err != nil { + return nil, err + } + defer subid.Close() + return ParseSubIDFilter(subid, filter) +} + +func ParseSubIDFilter(r io.Reader, filter func(SubID) bool) ([]SubID, error) { + if r == nil { + return nil, fmt.Errorf("nil source for subid-formatted data") + } + + var ( + s = bufio.NewScanner(r) + out = []SubID{} + ) + + for s.Scan() { + if err := s.Err(); err != nil { + return nil, err + } + + line := strings.TrimSpace(s.Text()) + if line == "" { + continue + } + + // see: man 5 subuid + p := SubID{} + parseLine(line, &p.Name, &p.SubID, &p.Count) + + if filter == nil || filter(p) { + out = append(out, p) + } + } + + return out, nil +} + +func ParseIDMapFile(path string) ([]IDMap, error) { + r, err := os.Open(path) + if err != nil { + return nil, err + } + defer r.Close() + return ParseIDMap(r) +} + +func ParseIDMap(r io.Reader) ([]IDMap, error) { + return ParseIDMapFilter(r, nil) +} + +func ParseIDMapFileFilter(path string, filter func(IDMap) bool) ([]IDMap, error) { + r, err := os.Open(path) + if err != nil { + return nil, err + } + defer r.Close() + return ParseIDMapFilter(r, filter) +} + +func ParseIDMapFilter(r io.Reader, filter func(IDMap) bool) ([]IDMap, error) { + if r == nil { + return nil, fmt.Errorf("nil source for idmap-formatted data") + } + + var ( + s = bufio.NewScanner(r) + out = []IDMap{} + ) + + for s.Scan() { + if err := s.Err(); err != nil { + return nil, err + } + + line := strings.TrimSpace(s.Text()) + if line == "" { + continue + } + + // see: man 7 user_namespaces + p := IDMap{} + parseParts(strings.Fields(line), &p.ID, &p.ParentID, &p.Count) + + if filter == nil || filter(p) { + out = append(out, p) + } + } + + return out, nil +}