Skip to content
This repository has been archived by the owner on Jan 20, 2021. It is now read-only.

Adding recent changes, --devices cli, Argon container policy for desktop #3

Merged
merged 172 commits into from Jul 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
172 commits
Select commit Hold shift + click to select a range
174cf22
MSFT:17850093:fix docker to use registry policy rather than product s…
asherkariv Jun 27, 2018
7da52be
Make 'process isolation policy' 3 options: default, allow, deny
asherkariv Jun 29, 2018
d96c00f
Fix fd leak on attach
cpuguy83 May 31, 2018
0161aa3
Refactor and cleanup the intermediate container creation
arm64b Jun 1, 2018
7d1eccd
Added network package to integration/internal to refactor integration…
adshmh Jun 2, 2018
ba7be43
refactored integration tests under integration/network/macvlan to use…
adshmh Jun 2, 2018
9306549
Add support for `init` on services
vdemeester Jun 1, 2018
a7baf68
use unique names for resources in create service integration tests
adshmh Jun 7, 2018
524ccb9
Close readclosers returned by DecompressStream
yosifkit Jul 22, 2017
e729e4e
Add image metrics for push and pull
dnephin Jun 7, 2018
9f08dbc
Fix panic on daemon restart with running plugin
cpuguy83 Apr 20, 2018
0422118
When id is empty for overlay2/overlay, do not remove the directories.
fanjiyun Jan 30, 2018
e77d5c6
Allow vim be case insensitive for D in dockerfile
kunaltyagi Jun 8, 2018
8d58863
Clean up in TestNegotiateAPIVersionEmpty
johnstep Jun 8, 2018
81a0573
Fix race condition between exec start and resize
zq-david-wang Jun 8, 2018
8704756
Fix link to Docker Toolbox
francescomari Jun 8, 2018
28d54cb
Use stdlib TLS dialer
cpuguy83 Mar 23, 2018
4f60e71
vendor: update containerd to 63522d9
tonistiigi Jun 9, 2018
0ae9d10
bump libnetwork to 19279f0492417475b6bfbd0aa529f73e8f178fb5
thaJeztah Jun 9, 2018
1727940
refactor delete network integration tests to use network package
adshmh Jun 9, 2018
91427f6
Dockerfile*: bump Go to 1.10.3
unclejack Jun 10, 2018
fc94f7e
vendor: add buildkit dependency
tonistiigi Jun 9, 2018
1231e65
daemon: access to distribution internals
tonistiigi Apr 17, 2018
0ab1107
layer: relax graphdriver ID format
tonistiigi Apr 17, 2018
0c25158
builder: snapshotter and exporter
tonistiigi Apr 16, 2018
f9662d2
builder: experimental buildkit base
tonistiigi Apr 17, 2018
628f4ff
builder: add graceful cancellation endpoint
tonistiigi Apr 19, 2018
d138b4a
builder: add cache-from support to buildkit
tonistiigi Apr 20, 2018
c6d8fbd
builder: adapter update after vendor update
tonistiigi May 14, 2018
ce8fe5e
builder: produce duplicate cache keys on pull
tonistiigi May 14, 2018
27f356f
builder: export build cache records
tonistiigi May 15, 2018
7c500f7
builder: add usage to snapshotter adapter
tonistiigi May 15, 2018
6b21e39
builder: expand prune to buildkit
tonistiigi May 15, 2018
f0fd0e5
builder: fixes after rebase
tonistiigi May 15, 2018
039bcde
builder: patch incomplete download handling
tonistiigi May 17, 2018
effec22
builder: add support for building from tarball
tonistiigi May 18, 2018
0e3315c
builder: fix compiling with buildkit on windows and integration tests
May 15, 2018
98b9ac8
builder: pass DOCKER_BUILDKIT to enable buildkit in tests
May 16, 2018
316e110
builder: Add TODOBuildkit test requirement, specifically for TestBuil…
May 16, 2018
70a4fb8
builder: have TestBuildDockerignoringBadExclusion pass with buildkit
May 17, 2018
406b2e2
builder: protect early progress writes
tonistiigi May 18, 2018
6f11a6c
builder: add support for separate upload-request
tonistiigi May 19, 2018
12d6471
builder: enable gateway through syntax directive
tonistiigi May 19, 2018
b456945
builder: support for images without layers
tonistiigi May 23, 2018
90ea058
integration-cli: fix health test
tonistiigi May 23, 2018
7a6cd76
builder: lint fixes
tonistiigi May 23, 2018
3100931
builder: move tagging to exporter
tonistiigi May 25, 2018
dd21813
builder: fix cancellation context issue
tonistiigi May 25, 2018
38ab1f4
builder: notify output buffering on body close
tonistiigi May 25, 2018
2d3467b
api: update godoc
tonistiigi May 25, 2018
1ff16b4
builder: more experimental/windows validation
tonistiigi May 25, 2018
a68bff0
builder: correct output buffering order
tonistiigi May 26, 2018
414cc19
integration-cli: fix error message for non-buildkit
tonistiigi May 26, 2018
1c91d66
vendor: update runc for helper packages
tonistiigi Jun 4, 2018
3fc1db4
Add support for schema 1 pull
dmcgowan Jun 6, 2018
148b3db
builder: override history dates from ref metadata
tonistiigi Jun 8, 2018
87f9496
builder: updates for newer containerd
tonistiigi Jun 9, 2018
bdb08f0
builder: update ID of trace messages
tonistiigi Jun 9, 2018
05db2c9
Upgrade imdario/mergo to v0.3.5
vdemeester Jun 11, 2018
267c67b
refactored network integration tests under integration/network/servic…
adshmh Jun 12, 2018
6f3f0f2
Replace gotestyourself by gotest.tools
vdemeester Jun 8, 2018
1b85e5b
Update tests to use gotest.tools 👼
vdemeester Jun 11, 2018
a4e30a1
Fix link anchors in CONTRIBUTING.md
yui-knk Jun 13, 2018
fe0ef31
create service integration tests use network package
adshmh Jun 13, 2018
8d2ea44
Don't fail to start daemon if builder source is not available
Jun 13, 2018
4eb01f1
migrate TestAPINetworkCreateDelete from integration-cli/ to integration/
adshmh Jun 15, 2018
de9dd65
Fix compilation on 32 bit systems
seemethere Jun 15, 2018
5551796
Updated path to be consistent w/ current Windows build process
Benjamin28 Jun 15, 2018
e57ee29
lcow: Allow the client to add or remove capabilities
jstarks Jun 15, 2018
e2d87e1
lcow: Allow the client to add device cgroup rules
jstarks Jun 15, 2018
d8437f5
refactor ipvlan network integration tests to use network.Create
adshmh Jun 8, 2018
4ad77bd
fix build on OpenBSD by defining Self()
Mischi Jun 16, 2018
89d4089
Update to containerd v1.1.1-rc.1
thaJeztah Jun 19, 2018
3811b39
Fix TestDaemonNoSpaceLeftOnDeviceError
thaJeztah Jun 19, 2018
2841cbf
Whitelist syscalls linked to CAP_SYS_NICE in default seccomp profile
nvcastet Jun 8, 2018
45545f2
Update overlay2 to use naive diff for changes
dmcgowan Jun 19, 2018
0b1c25d
Fix flaky test TestServiceGet
katakonst Jun 20, 2018
b978271
refactored remaining macvlan integration tests to use network package…
adshmh Jun 14, 2018
f132f55
refactor network inspect integration tests to use network package
adshmh Jun 11, 2018
02826b9
Just satisfying my OCD - fixed comment spacing and removed a hidden c…
MartinMuzatko Jun 22, 2018
5c1fd92
Fix a small spacing issue
yongtang Jun 24, 2018
fe86cde
add integration test guidelines
AntaresS Jun 8, 2018
7d13884
LCOW: Auto-select OS
Feb 23, 2018
ea13f8c
Initial support for OCI multi-platform image
arm64b Jun 26, 2018
a2765fa
refactored integration/service/network integration tests to use netwo…
adshmh Jun 16, 2018
e257609
Update comments about `InitRouter`
yui-knk Jun 26, 2018
3198e86
vendor: update buildkit to cce2080ddb
tonistiigi Jun 26, 2018
d338f39
builder: buildkit rebase update
tonistiigi Jun 26, 2018
ebf28ab
api: fix platform type
tonistiigi Jun 26, 2018
7393bbc
add unique names to integration/network/service_test.go
LotusFenn Jun 27, 2018
6cc525c
vendor: update containerd to 08f7ee98
tonistiigi Jun 27, 2018
bfc185e
LCOW: lazycontext: Use correct lstat, fix archive check
Jun 27, 2018
042dadc
Update containerd to v1.1.1-rc.2
dmcgowan Jun 27, 2018
43eea05
distribution: fix passing platform struct to puller
tonistiigi Jun 26, 2018
64f30c4
builder: update platform support to puller
tonistiigi Jun 26, 2018
73bb2d9
system: add back lcow validation function
tonistiigi Jun 27, 2018
bb6d090
distribution: remove custom matcher code
tonistiigi Jun 27, 2018
39cf89c
Move network conversions out of API router
cpuguy83 May 23, 2018
a194168
Update Microsoft/go-winio to 0.4.8
thaJeztah Jun 28, 2018
e912359
Register OCI image media types
dmcgowan Jun 28, 2018
a5200d6
LCOW: Prefer Windows over Linux in a manifest list
johnstep Jun 29, 2018
cef57cd
Re-add support for a custom .bashrc file in build env
albers Jun 29, 2018
1190350
bump libnetwork to 430c00a
ctelfer Jun 29, 2018
bd00e4c
Pass endpoint to the CloudWatch Logs logging driver
haikuoliu Jun 29, 2018
0ecff60
Update tests w/ new libnetwork contraints
ctelfer Jun 29, 2018
068fcdc
Fix bindmount autocreate race
cpuguy83 Jul 2, 2018
a8eb2e0
Update documents of `dispatchAdd`
yui-knk Jul 2, 2018
960f7c1
Update documents of `Detect`
yui-knk Jul 3, 2018
9a4ea20
Adds a few more names to the name generator.
debayande May 26, 2018
1da95f8
bump libnetwork to b0186632
ctelfer Jun 6, 2018
f44eab7
Update moby to use scalable-lb libnetwork APIs
ctelfer Apr 19, 2018
9592b5f
builder: return image ID in API when using buildkit
Jun 11, 2018
e6c3696
builder: do not send duplicate status for completed jobs
tonistiigi Jul 3, 2018
7ac8eff
vendor: update buildkit to 9acf51e491
tonistiigi Jul 3, 2018
2c7f6dd
api: Change Platform field back to string (temporary workaround)
Jul 3, 2018
bd399f9
add vim-plug setting
ianchen-tw Jul 4, 2018
2e3eda2
update fsnotify to v1.4.7
thaJeztah Jul 4, 2018
af80903
Update cloudflare/cfssl to 1.3.2
thaJeztah Jul 4, 2018
012e233
Migrate some ipcmode tests to integration
yongtang Jul 4, 2018
24428fc
Replaced "--update-cache" argument with "--no-cache" in apk call to r…
Jul 4, 2018
7361ef3
Removed the "-i -t" arguments from the smoke test calling printf (the…
Jul 5, 2018
e5cbcaa
Add /proc/acpi to masked paths
runcom Jul 5, 2018
c538361
Bump swarmkit to include task reaper fixes and more metrics.
cyli Jul 5, 2018
7bff534
Bump libnetwork to 3ac297bc
ctelfer Jul 6, 2018
20fbc66
vendor: update containerd to b41633746
tonistiigi Jul 6, 2018
7002a94
Get err type in removeNetworks() w/ errors.Cause()
ctelfer Jul 6, 2018
f887e5f
Ensure RUN instruction to run without Healthcheck
yui-knk Jul 8, 2018
436202e
Fix typo on test.md
storykim Jul 8, 2018
415f8c8
Pass log-level to containerd
thaJeztah Jul 9, 2018
2b089ce
Bump libnetwork to d00ceed44cc447c77f25cdf5d59e83163bdcb4c9
thaJeztah Jul 9, 2018
ad6d700
Bump containerd daemon to v1.1.1
cpuguy83 Jul 9, 2018
4ef4252
builder: fix duplicate calls to mountable
tonistiigi Jul 10, 2018
e47c26d
Bump gometalinter to v2.0.6
kolyshkin Jul 4, 2018
70fa449
daemon/*.go: fix some Wrap[f]/Warn[f] errors
thaJeztah Jul 11, 2018
256a651
Compile fix
kolyshkin Jul 5, 2018
e434c51
aufs: fix Wrapf args
kolyshkin Jul 5, 2018
65db0ed
loggerutils: build fixes, improve errors
kolyshkin Jul 5, 2018
35d4a8c
Fix ineffassign linting
thaJeztah Jul 9, 2018
087c346
Fix golint issues
thaJeztah Jul 9, 2018
b8553d6
Fix error string in docker CLI test
msabansal Jul 12, 2018
27e84ff
lcow: fix debug in startServiceVMIfNotRunning()
kolyshkin Jul 11, 2018
623f65b
vendor: update continuity to 0377f7d767206
kolyshkin Jul 12, 2018
c888170
Remove stray uses of "golang.org/x/net/context"
thaJeztah Jul 13, 2018
692dca5
Fix API template to not use "golang.org/x/net/context"
thaJeztah Jul 13, 2018
108dc77
Refactor daemon.info to reduce cyclomatic complexity
thaJeztah Jul 13, 2018
8c2d532
Unexport daemon.FillPlatformInfo
thaJeztah Jul 13, 2018
1d9e0c7
Fix golint warning on generated "volume" types
thaJeztah Jul 13, 2018
c3abcc9
Fix flakyness in TestDockerNetworkInternalMode
Jul 13, 2018
4d976d9
moved integration tests from docker_cli_config_create_test.go to inte…
adshmh Jul 13, 2018
a8eba65
Return error if basename is expanded to blank
yui-knk Jul 5, 2018
1b411b6
Bump containerd daemon to v1.1.2
thaJeztah Jul 16, 2018
a955f0f
vendor: buildkit to 98f1604134f945d48538ffca0e18662337b4a850
Jul 11, 2018
eec247d
builder: set buildkit's exported product variable via PRODUCT
Jul 11, 2018
2e42b75
validate: please vet
Jul 11, 2018
ce39278
Fix flaky TestExternalGraphDriver/pull test
thaJeztah Jul 17, 2018
db9603e
Use constant for task runtime value
thaJeztah Jul 17, 2018
25b0252
Update swarmkit to 68266392a176434d282760d2d6d0ab4c68edcae6
thaJeztah Jul 17, 2018
d1d5e4f
pkg/tarsum: fix unit test for Go 1.11+
kolyshkin Jul 11, 2018
465131f
vendor: bump google/certificate-transparency-go to 1.0.20
kolyshkin Jul 11, 2018
f8fb914
Add osusergo build tar for static binaries
kolyshkin Jul 19, 2018
a4f0a1e
Adds LinuxMetadata support by default on Windows
jterry75 Jul 23, 2018
f960698
Add --device support for Windows
jterry75 Jul 16, 2018
859b73c
Dont submit
jterry75 Jul 23, 2018
965050c
Initial check-in for Docker Windows\ARM32
asherkariv Jun 8, 2018
c694cf9
MSFT:17850093:fix docker to use registry policy rather than product s…
asherkariv Jun 27, 2018
b52b834
Make 'process isolation policy' 3 options: default, allow, deny
asherkariv Jun 29, 2018
775bae0
Fixing process isolation policy enforcement
asherkariv Jul 24, 2018
865c344
Rebase merge conflict resdue
asherkariv Jul 24, 2018
3fad6a5
Merge conflict error fix
asherkariv Jul 24, 2018
9c6d126
Merge branch 'user/askariv/proc-isolation-ctl' of https://github.com/…
asherkariv Jul 24, 2018
ea4c4f3
Tabs fix
asherkariv Jul 24, 2018
c2be1f9
Typo fix in GetProcessIsolationPolicy()
asherkariv Jul 25, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Expand Up @@ -8,7 +8,7 @@ process](docs/contributing/).

This page contains information about reporting issues as well as some tips and
guidelines useful to experienced open source contributors. Finally, make sure
you read our [community guidelines](#docker-community-guidelines) before you
you read our [community guidelines](#moby-community-guidelines) before you
start participating.

## Topics
Expand All @@ -17,7 +17,7 @@ start participating.
* [Design and Cleanup Proposals](#design-and-cleanup-proposals)
* [Reporting Issues](#reporting-other-issues)
* [Quick Contribution Tips and Guidelines](#quick-contribution-tips-and-guidelines)
* [Community Guidelines](#docker-community-guidelines)
* [Community Guidelines](#moby-community-guidelines)

## Reporting security issues

Expand Down
6 changes: 4 additions & 2 deletions Dockerfile
Expand Up @@ -24,10 +24,10 @@
# the case. Therefore, you don't have to disable it anymore.
#

FROM golang:1.10.2 AS base
FROM golang:1.10.3 AS base
# FIXME(vdemeester) this is kept for other script depending on it to not fail right away
# Remove this once the other scripts uses something else to detect the version
ENV GO_VERSION 1.10.2
ENV GO_VERSION 1.10.3
# allow replacing httpredir or deb mirror
ARG APT_MIRROR=deb.debian.org
RUN sed -ri "s/(httpredir|deb).debian.org/$APT_MIRROR/g" /etc/apt/sources.list
Expand Down Expand Up @@ -170,6 +170,8 @@ RUN PREFIX=/build/ ./install.sh $INSTALL_BINARY_NAME
FROM runtime-dev AS dev
RUN groupadd -r docker
RUN useradd --create-home --gid docker unprivilegeduser
# Let us use a .bashrc file
RUN ln -sfv /go/src/github.com/docker/docker/.bashrc ~/.bashrc
# Activate bash completion and include Docker's completion if mounted with DOCKER_BASH_COMPLETION_PATH
RUN echo "source /usr/share/bash-completion/bash_completion" >> /etc/bash.bashrc
RUN ln -s /usr/local/completion/bash/docker /etc/bash_completion.d/docker
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.e2e
@@ -1,5 +1,5 @@
## Step 1: Build tests
FROM golang:1.10.2-alpine3.7 as builder
FROM golang:1.10.3-alpine3.7 as builder

RUN apk add --update \
bash \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.simple
Expand Up @@ -42,7 +42,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
# will need updating, to avoid errors. Ping #docker-maintainers on IRC
# with a heads-up.
# IMPORTANT: When updating this please note that stdlib archive/tar pkg is vendored
ENV GO_VERSION 1.10.2
ENV GO_VERSION 1.10.3
RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" \
| tar -xzC /usr/local
ENV PATH /go/bin:/usr/local/go/bin:$PATH
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.windows
Expand Up @@ -161,7 +161,7 @@ SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPref
# Environment variable notes:
# - GO_VERSION must be consistent with 'Dockerfile' used by Linux.
# - FROM_DOCKERFILE is used for detection of building within a container.
ENV GO_VERSION=1.10.2 `
ENV GO_VERSION=1.10.3 `
GIT_VERSION=2.11.1 `
GOPATH=C:\go `
FROM_DOCKERFILE=1
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Expand Up @@ -31,6 +31,7 @@ DOCKER_ENVS := \
-e DOCKER_BUILD_ARGS \
-e DOCKER_BUILD_GOGC \
-e DOCKER_BUILD_PKGS \
-e DOCKER_BUILDKIT \
-e DOCKER_BASH_COMPLETION_PATH \
-e DOCKER_CLI_PATH \
-e DOCKER_DEBUG \
Expand All @@ -55,7 +56,8 @@ DOCKER_ENVS := \
-e https_proxy \
-e no_proxy \
-e VERSION \
-e PLATFORM
-e PLATFORM \
-e PRODUCT
# note: we _cannot_ add "-e DOCKER_BUILDTAGS" here because even if it's unset in the shell, that would shadow the "ENV DOCKER_BUILDTAGS" set in our Dockerfile, which is very important for our official builds

# to allow `make BIND_DIR=. shell` or `make BIND_DIR= test`
Expand Down
22 changes: 20 additions & 2 deletions TESTING.md
Expand Up @@ -8,11 +8,11 @@ questions you may have as an aspiring Moby contributor.
Moby has two test suites (and one legacy test suite):

* Unit tests - use standard `go test` and
[gotestyourself/assert](https://godoc.org/github.com/gotestyourself/gotestyourself/assert) assertions. They are located in
[gotest.tools/assert](https://godoc.org/gotest.tools/assert) assertions. They are located in
the package they test. Unit tests should be fast and test only their own
package.
* API integration tests - use standard `go test` and
[gotestyourself/assert](https://godoc.org/github.com/gotestyourself/gotestyourself/assert) assertions. They are located in
[gotest.tools/assert](https://godoc.org/gotest.tools/assert) assertions. They are located in
`./integration/<component>` directories, where `component` is: container,
image, volume, etc. These tests perform HTTP requests to an API endpoint and
check the HTTP response and daemon state after the call.
Expand Down Expand Up @@ -47,6 +47,24 @@ Bugs fixes should include a unit test case which exercises the bug.
A bug fix may also include new assertions in an existing integration tests for the
API endpoint.

### Integration tests environment considerations

When adding new tests or modifying existing test under `integration/`, testing
environment should be properly considered. `skip.If` from
[gotest.tools/skip](https://godoc.org/gotest.tools/skip) can be used to make the
test run conditionally. Full testing environment conditions can be found at
[environment.go](https://github.com/moby/moby/blob/cb37987ee11655ed6bbef663d245e55922354c68/internal/test/environment/environment.go)

Here is a quick example. If the test needs to interact with a docker daemon on
the same host, the following condition should be checked within the test code

```go
skip.If(t, testEnv.IsRemoteDaemon())
// your integration test code
```

If a remote daemon is detected, the test will be skipped.

## Running tests

To run the unit test suite:
Expand Down
72 changes: 59 additions & 13 deletions api/server/backend/build/backend.go
Expand Up @@ -8,10 +8,12 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/builder"
buildkit "github.com/docker/docker/builder/builder-next"
"github.com/docker/docker/builder/fscache"
"github.com/docker/docker/image"
"github.com/docker/docker/pkg/stringid"
"github.com/pkg/errors"
"golang.org/x/sync/errgroup"
)

// ImageComponent provides an interface for working with images
Expand All @@ -30,24 +32,39 @@ type Backend struct {
builder Builder
fsCache *fscache.FSCache
imageComponent ImageComponent
buildkit *buildkit.Builder
}

// NewBackend creates a new build backend from components
func NewBackend(components ImageComponent, builder Builder, fsCache *fscache.FSCache) (*Backend, error) {
return &Backend{imageComponent: components, builder: builder, fsCache: fsCache}, nil
func NewBackend(components ImageComponent, builder Builder, fsCache *fscache.FSCache, buildkit *buildkit.Builder) (*Backend, error) {
return &Backend{imageComponent: components, builder: builder, fsCache: fsCache, buildkit: buildkit}, nil
}

// Build builds an image from a Source
func (b *Backend) Build(ctx context.Context, config backend.BuildConfig) (string, error) {
options := config.Options
useBuildKit := options.Version == types.BuilderBuildKit

tagger, err := NewTagger(b.imageComponent, config.ProgressWriter.StdoutFormatter, options.Tags)
if err != nil {
return "", err
}

build, err := b.builder.Build(ctx, config)
if err != nil {
return "", err
var build *builder.Result
if useBuildKit {
build, err = b.buildkit.Build(ctx, config)
if err != nil {
return "", err
}
} else {
build, err = b.builder.Build(ctx, config)
if err != nil {
return "", err
}
}

if build == nil {
return "", nil
}

var imageID = build.ImageID
Expand All @@ -56,25 +73,54 @@ func (b *Backend) Build(ctx context.Context, config backend.BuildConfig) (string
return "", err
}
if config.ProgressWriter.AuxFormatter != nil {
if err = config.ProgressWriter.AuxFormatter.Emit(types.BuildResult{ID: imageID}); err != nil {
if err = config.ProgressWriter.AuxFormatter.Emit("moby.image.id", types.BuildResult{ID: imageID}); err != nil {
return "", err
}
}
}

stdout := config.ProgressWriter.StdoutFormatter
fmt.Fprintf(stdout, "Successfully built %s\n", stringid.TruncateID(imageID))
err = tagger.TagImages(image.ID(imageID))
if !useBuildKit {
stdout := config.ProgressWriter.StdoutFormatter
fmt.Fprintf(stdout, "Successfully built %s\n", stringid.TruncateID(imageID))
err = tagger.TagImages(image.ID(imageID))
}
return imageID, err
}

// PruneCache removes all cached build sources
func (b *Backend) PruneCache(ctx context.Context) (*types.BuildCachePruneReport, error) {
size, err := b.fsCache.Prune(ctx)
if err != nil {
return nil, errors.Wrap(err, "failed to prune build cache")
eg, ctx := errgroup.WithContext(ctx)

var fsCacheSize uint64
eg.Go(func() error {
var err error
fsCacheSize, err = b.fsCache.Prune(ctx)
if err != nil {
return errors.Wrap(err, "failed to prune fscache")
}
return nil
})

var buildCacheSize int64
eg.Go(func() error {
var err error
buildCacheSize, err = b.buildkit.Prune(ctx)
if err != nil {
return errors.Wrap(err, "failed to prune build cache")
}
return nil
})

if err := eg.Wait(); err != nil {
return nil, err
}
return &types.BuildCachePruneReport{SpaceReclaimed: size}, nil

return &types.BuildCachePruneReport{SpaceReclaimed: fsCacheSize + uint64(buildCacheSize)}, nil
}

// Cancel cancels the build by ID
func (b *Backend) Cancel(ctx context.Context, id string) error {
return b.buildkit.Cancel(ctx, id)
}

func squashBuild(build *builder.Result, imageComponent ImageComponent) (string, error) {
Expand Down
4 changes: 2 additions & 2 deletions api/server/middleware/debug_test.go
Expand Up @@ -3,8 +3,8 @@ package middleware // import "github.com/docker/docker/api/server/middleware"
import (
"testing"

"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)

func TestMaskSecretKeys(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions api/server/middleware/version_test.go
Expand Up @@ -8,8 +8,8 @@ import (
"testing"

"github.com/docker/docker/api/server/httputils"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)

func TestVersionMiddlewareVersion(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions api/server/router/build/backend.go
Expand Up @@ -15,6 +15,8 @@ type Backend interface {

// Prune build cache
PruneCache(context.Context) (*types.BuildCachePruneReport, error)

Cancel(context.Context, string) error
}

type experimentalProvider interface {
Expand Down
1 change: 1 addition & 0 deletions api/server/router/build/build.go
Expand Up @@ -25,5 +25,6 @@ func (r *buildRouter) initRoutes() {
r.routes = []router.Route{
router.NewPostRoute("/build", r.postBuild, router.WithCancel),
router.NewPostRoute("/build/prune", r.postPrune, router.WithCancel),
router.NewPostRoute("/build/cancel", r.postCancel),
}
}