mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-08-18 17:55:57 +08:00
Compare commits
20 Commits
v0.13.0-rc
...
v0.13.1
Author | SHA1 | Date | |
---|---|---|---|
![]() |
788433953a | ||
![]() |
7e2460428d | ||
![]() |
3490181812 | ||
![]() |
19dbf2f7c4 | ||
![]() |
37b7ad1465 | ||
![]() |
2758919cf6 | ||
![]() |
911e346501 | ||
![]() |
46365ee32f | ||
![]() |
6430c9586a | ||
![]() |
0de5f1ce3b | ||
![]() |
0565a47ad4 | ||
![]() |
ab350f48d2 | ||
![]() |
1861c07eab | ||
![]() |
84913655a8 | ||
![]() |
9bce433154 | ||
![]() |
04f0fc5871 | ||
![]() |
e7da2b0686 | ||
![]() |
eab565afe7 | ||
![]() |
7d952441ea | ||
![]() |
835a6b1096 |
40
.github/workflows/docs-release.yml
vendored
40
.github/workflows/docs-release.yml
vendored
@@ -1,6 +1,11 @@
|
||||
name: docs-release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Git tag'
|
||||
required: true
|
||||
release:
|
||||
types:
|
||||
- released
|
||||
@@ -8,7 +13,7 @@ on:
|
||||
jobs:
|
||||
open-pr:
|
||||
runs-on: ubuntu-22.04
|
||||
if: ${{ github.event.release.prerelease != true && github.repository == 'docker/buildx' }}
|
||||
if: ${{ (github.event.release.prerelease != true || github.event.inputs.tag != '') && github.repository == 'docker/buildx' }}
|
||||
steps:
|
||||
-
|
||||
name: Checkout docs repo
|
||||
@@ -20,39 +25,48 @@ jobs:
|
||||
-
|
||||
name: Prepare
|
||||
run: |
|
||||
rm -rf ./_data/buildx/*
|
||||
rm -rf ./data/buildx/*
|
||||
rm -rf ./_vendor/github.com/docker/buildx
|
||||
if [ -n "${{ github.event.inputs.tag }}" ]; then
|
||||
echo "RELEASE_NAME=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
|
||||
else
|
||||
echo "RELEASE_NAME=${{ github.event.release.name }}" >> $GITHUB_ENV
|
||||
fi
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
-
|
||||
name: Build docs
|
||||
name: Generate yaml
|
||||
uses: docker/bake-action@v4
|
||||
with:
|
||||
source: ${{ github.server_url }}/${{ github.repository }}.git#${{ github.event.release.name }}
|
||||
source: ${{ github.server_url }}/${{ github.repository }}.git#${{ env.RELEASE_NAME }}
|
||||
targets: update-docs
|
||||
set: |
|
||||
*.output=/tmp/buildx-docs
|
||||
env:
|
||||
DOCS_FORMATS: yaml
|
||||
-
|
||||
name: Copy files
|
||||
name: Copy yaml
|
||||
run: |
|
||||
cp /tmp/buildx-docs/out/reference/*.yaml ./_data/buildx/
|
||||
cp /tmp/buildx-docs/out/reference/*.yaml ./data/buildx/
|
||||
-
|
||||
name: Commit changes
|
||||
run: |
|
||||
git add -A .
|
||||
name: Update vendor
|
||||
uses: docker/bake-action@v4
|
||||
with:
|
||||
targets: vendor
|
||||
set: |
|
||||
vendor.args.MODULE=github.com/docker/buildx@${{ env.RELEASE_NAME }}
|
||||
-
|
||||
name: Create PR on docs repo
|
||||
uses: peter-evans/create-pull-request@a4f52f8033a6168103c2538976c07b467e8163bc
|
||||
with:
|
||||
token: ${{ secrets.GHPAT_DOCS_DISPATCH }}
|
||||
push-to-fork: docker-tools-robot/docker.github.io
|
||||
commit-message: "build: update buildx reference to ${{ github.event.release.name }}"
|
||||
commit-message: "vendor: github.com/docker/buildx ${{ env.RELEASE_NAME }}"
|
||||
signoff: true
|
||||
branch: dispatch/buildx-ref-${{ github.event.release.name }}
|
||||
branch: dispatch/buildx-ref-${{ env.RELEASE_NAME }}
|
||||
delete-branch: true
|
||||
title: Update buildx reference to ${{ github.event.release.name }}
|
||||
title: Update buildx reference to ${{ env.RELEASE_NAME }}
|
||||
body: |
|
||||
Update the buildx reference documentation to keep in sync with the latest release `${{ github.event.release.name }}`
|
||||
Update the buildx reference documentation to keep in sync with the latest release `${{ env.RELEASE_NAME }}`
|
||||
draft: false
|
||||
|
@@ -259,6 +259,25 @@ func TestPushOverride(t *testing.T) {
|
||||
|
||||
require.Equal(t, 1, len(m["app"].Outputs))
|
||||
require.Equal(t, "type=image,push=true", m["app"].Outputs[0])
|
||||
|
||||
fp = File{
|
||||
Name: "docker-bake.hcl",
|
||||
Data: []byte(
|
||||
`target "foo" {
|
||||
output = [ "type=local,dest=out" ]
|
||||
}
|
||||
target "bar" {
|
||||
}`),
|
||||
}
|
||||
ctx = context.TODO()
|
||||
m, _, err = ReadTargets(ctx, []File{fp}, []string{"foo", "bar"}, []string{"*.push=true"}, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, 2, len(m))
|
||||
require.Equal(t, 1, len(m["foo"].Outputs))
|
||||
require.Equal(t, []string{"type=local,dest=out"}, m["foo"].Outputs)
|
||||
require.Equal(t, 1, len(m["bar"].Outputs))
|
||||
require.Equal(t, []string{"type=image,push=true"}, m["bar"].Outputs)
|
||||
}
|
||||
|
||||
func TestReadTargetsCompose(t *testing.T) {
|
||||
|
@@ -33,7 +33,7 @@ import (
|
||||
"github.com/docker/buildx/util/resolver"
|
||||
"github.com/docker/buildx/util/waitmap"
|
||||
"github.com/docker/cli/opts"
|
||||
"github.com/docker/docker/api/types"
|
||||
imagetypes "github.com/docker/docker/api/types/image"
|
||||
"github.com/docker/docker/builder/remotecontext/urlutil"
|
||||
"github.com/docker/docker/pkg/jsonmessage"
|
||||
"github.com/moby/buildkit/client"
|
||||
@@ -1002,7 +1002,7 @@ func pushWithMoby(ctx context.Context, d driver.Driver, name string, l progress.
|
||||
return err
|
||||
}
|
||||
|
||||
rc, err := api.ImagePush(ctx, name, types.ImagePushOptions{
|
||||
rc, err := api.ImagePush(ctx, name, imagetypes.PushOptions{
|
||||
RegistryAuth: creds,
|
||||
})
|
||||
if err != nil {
|
||||
|
@@ -142,7 +142,7 @@ func (b *Builder) LoadNodes(ctx context.Context, opts ...LoadNodesOption) (_ []N
|
||||
}
|
||||
}
|
||||
|
||||
d, err := driver.GetDriver(ctx, "buildx_buildkit_"+n.Name, factory, n.Endpoint, dockerapi, imageopt.Auth, kcc, n.BuildkitdFlags, n.Files, n.DriverOpts, n.Platforms, b.opts.contextPathHash, lno.dialMeta)
|
||||
d, err := driver.GetDriver(ctx, driver.BuilderName(n.Name), factory, n.Endpoint, dockerapi, imageopt.Auth, kcc, n.BuildkitdFlags, n.Files, n.DriverOpts, n.Platforms, b.opts.contextPathHash, lno.dialMeta)
|
||||
if err != nil {
|
||||
node.Err = err
|
||||
return nil
|
||||
|
@@ -72,11 +72,9 @@ func runBake(ctx context.Context, dockerCli command.Cli, targets []string, in ba
|
||||
|
||||
overrides := in.overrides
|
||||
if in.exportPush {
|
||||
if in.exportLoad {
|
||||
return errors.Errorf("push and load may not be set together at the moment")
|
||||
}
|
||||
overrides = append(overrides, "*.push=true")
|
||||
} else if in.exportLoad {
|
||||
}
|
||||
if in.exportLoad {
|
||||
overrides = append(overrides, "*.output=type=docker")
|
||||
}
|
||||
if cFlags.noCache != nil {
|
||||
|
@@ -99,38 +99,38 @@ func RunBuild(ctx context.Context, dockerCli command.Cli, in controllerapi.Build
|
||||
return nil, nil, err
|
||||
}
|
||||
if in.ExportPush {
|
||||
if in.ExportLoad {
|
||||
return nil, nil, errors.Errorf("push and load may not be set together at the moment")
|
||||
var pushUsed bool
|
||||
for i := range outputs {
|
||||
if outputs[i].Type == client.ExporterImage {
|
||||
outputs[i].Attrs["push"] = "true"
|
||||
pushUsed = true
|
||||
}
|
||||
}
|
||||
if len(outputs) == 0 {
|
||||
outputs = []client.ExportEntry{{
|
||||
Type: "image",
|
||||
if !pushUsed {
|
||||
outputs = append(outputs, client.ExportEntry{
|
||||
Type: client.ExporterImage,
|
||||
Attrs: map[string]string{
|
||||
"push": "true",
|
||||
},
|
||||
}}
|
||||
} else {
|
||||
switch outputs[0].Type {
|
||||
case "image":
|
||||
outputs[0].Attrs["push"] = "true"
|
||||
default:
|
||||
return nil, nil, errors.Errorf("push and %q output can't be used together", outputs[0].Type)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
if in.ExportLoad {
|
||||
if len(outputs) == 0 {
|
||||
outputs = []client.ExportEntry{{
|
||||
Type: "docker",
|
||||
Attrs: map[string]string{},
|
||||
}}
|
||||
} else {
|
||||
switch outputs[0].Type {
|
||||
case "docker":
|
||||
default:
|
||||
return nil, nil, errors.Errorf("load and %q output can't be used together", outputs[0].Type)
|
||||
var loadUsed bool
|
||||
for i := range outputs {
|
||||
if outputs[i].Type == client.ExporterDocker {
|
||||
if _, ok := outputs[i].Attrs["dest"]; !ok {
|
||||
loadUsed = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if !loadUsed {
|
||||
outputs = append(outputs, client.ExportEntry{
|
||||
Type: client.ExporterDocker,
|
||||
Attrs: map[string]string{},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
annotations, err := buildflags.ParseAnnotations(in.Annotations)
|
||||
|
@@ -152,7 +152,7 @@ Allow extra privileged entitlement. List of entitlements:
|
||||
|
||||
- `network.host` - Allows executions with host networking.
|
||||
- `security.insecure` - Allows executions without sandbox. See
|
||||
[related Dockerfile extensions](https://docs.docker.com/reference/dockerfile/#run---securitysandbox).
|
||||
[related Dockerfile extensions](https://docs.docker.com/reference/dockerfile/#run---security).
|
||||
|
||||
For entitlements to be enabled, the BuildKit daemon also needs to allow them
|
||||
with `--allow-insecure-entitlement` (see [`create --buildkitd-flags`](buildx_create.md#buildkitd-flags)).
|
||||
|
@@ -20,6 +20,7 @@ import (
|
||||
"github.com/docker/cli/opts"
|
||||
dockertypes "github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
imagetypes "github.com/docker/docker/api/types/image"
|
||||
"github.com/docker/docker/api/types/mount"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/docker/docker/api/types/system"
|
||||
@@ -95,7 +96,7 @@ func (d *Driver) create(ctx context.Context, l progress.SubLogger) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
rc, err := d.DockerAPI.ImageCreate(ctx, imageName, dockertypes.ImageCreateOptions{
|
||||
rc, err := d.DockerAPI.ImageCreate(ctx, imageName, imagetypes.CreateOptions{
|
||||
RegistryAuth: ra,
|
||||
})
|
||||
if err != nil {
|
||||
|
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"io"
|
||||
"net"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/buildx/store"
|
||||
"github.com/docker/buildx/util/progress"
|
||||
@@ -67,6 +68,19 @@ type Driver interface {
|
||||
Config() InitConfig
|
||||
}
|
||||
|
||||
const builderNamePrefix = "buildx_buildkit_"
|
||||
|
||||
func BuilderName(name string) string {
|
||||
return builderNamePrefix + name
|
||||
}
|
||||
|
||||
func ParseBuilderName(name string) (string, error) {
|
||||
if !strings.HasPrefix(name, builderNamePrefix) {
|
||||
return "", errors.Errorf("invalid builder name %q, must have %q prefix", name, builderNamePrefix)
|
||||
}
|
||||
return strings.TrimPrefix(name, builderNamePrefix), nil
|
||||
}
|
||||
|
||||
func Boot(ctx, clientContext context.Context, d *DriverHandle, pw progress.Writer) (*client.Client, error) {
|
||||
try := 0
|
||||
for {
|
||||
|
@@ -244,10 +244,10 @@ func (f *factory) AllowsInstances() bool {
|
||||
// eg. "buildx_buildkit_loving_mendeleev0" -> "loving-mendeleev0"
|
||||
func buildxNameToDeploymentName(bx string) (string, error) {
|
||||
// TODO: commands.util.go should not pass "buildx_buildkit_" prefix to drivers
|
||||
if !strings.HasPrefix(bx, "buildx_buildkit_") {
|
||||
return "", errors.Errorf("expected a string with \"buildx_buildkit_\", got %q", bx)
|
||||
s, err := driver.ParseBuilderName(bx)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
s := strings.TrimPrefix(bx, "buildx_buildkit_")
|
||||
s = strings.ReplaceAll(s, "_", "-")
|
||||
return s, nil
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ func TestFactory_processDriverOpts(t *testing.T) {
|
||||
}
|
||||
|
||||
cfg := driver.InitConfig{
|
||||
Name: "buildx_buildkit_test",
|
||||
Name: driver.BuilderName("test"),
|
||||
KubeClientConfig: &kcc,
|
||||
}
|
||||
f := factory{}
|
||||
|
@@ -13,6 +13,7 @@ import (
|
||||
util "github.com/docker/buildx/driver/remote/util"
|
||||
"github.com/docker/buildx/util/progress"
|
||||
"github.com/moby/buildkit/client"
|
||||
"github.com/moby/buildkit/client/connhelper"
|
||||
"github.com/moby/buildkit/util/tracing/detect"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
@@ -95,7 +96,16 @@ func (d *Driver) Client(ctx context.Context) (*client.Client, error) {
|
||||
}
|
||||
|
||||
func (d *Driver) Dial(ctx context.Context) (net.Conn, error) {
|
||||
network, addr, ok := strings.Cut(d.InitConfig.EndpointAddr, "://")
|
||||
addr := d.InitConfig.EndpointAddr
|
||||
ch, err := connhelper.GetConnectionHelper(addr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if ch != nil {
|
||||
return ch.ContextDialer(ctx, addr)
|
||||
}
|
||||
|
||||
network, addr, ok := strings.Cut(addr, "://")
|
||||
if !ok {
|
||||
return nil, errors.Errorf("invalid endpoint address: %s", d.InitConfig.EndpointAddr)
|
||||
}
|
||||
|
8
go.mod
8
go.mod
@@ -14,9 +14,9 @@ require (
|
||||
github.com/containerd/typeurl/v2 v2.1.1
|
||||
github.com/creack/pty v1.1.18
|
||||
github.com/distribution/reference v0.5.0
|
||||
github.com/docker/cli v25.0.3+incompatible
|
||||
github.com/docker/cli v26.0.0-rc1+incompatible
|
||||
github.com/docker/cli-docs-tool v0.7.0
|
||||
github.com/docker/docker v25.0.3+incompatible
|
||||
github.com/docker/docker v26.0.0-rc1+incompatible
|
||||
github.com/docker/go-units v0.5.0
|
||||
github.com/gofrs/flock v0.8.1
|
||||
github.com/gogo/protobuf v1.3.2
|
||||
@@ -25,7 +25,7 @@ require (
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/hashicorp/go-cty-funcs v0.0.0-20230405223818-a090f58aa992
|
||||
github.com/hashicorp/hcl/v2 v2.19.1
|
||||
github.com/moby/buildkit v0.13.0-rc3
|
||||
github.com/moby/buildkit v0.13.0
|
||||
github.com/moby/sys/mountinfo v0.7.1
|
||||
github.com/moby/sys/signal v0.7.0
|
||||
github.com/morikuni/aec v1.0.0
|
||||
@@ -140,7 +140,7 @@ require (
|
||||
github.com/secure-systems-lab/go-securesystemslib v0.4.0 // indirect
|
||||
github.com/shibumi/go-pathspec v1.3.0 // indirect
|
||||
github.com/theupdateframework/notary v0.7.0 // indirect
|
||||
github.com/tonistiigi/fsutil v0.0.0-20240223190444-7a889f53dbf6 // indirect
|
||||
github.com/tonistiigi/fsutil v0.0.0-20240301111122-7525a1af2bb5 // indirect
|
||||
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea // indirect
|
||||
github.com/tonistiigi/vt100 v0.0.0-20230623042737-f9a4f7ef6531 // indirect
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
|
||||
|
16
go.sum
16
go.sum
@@ -121,15 +121,15 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
|
||||
github.com/denisenkom/go-mssqldb v0.0.0-20191128021309-1d7a30a10f73/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
|
||||
github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0=
|
||||
github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
|
||||
github.com/docker/cli v25.0.3+incompatible h1:KLeNs7zws74oFuVhgZQ5ONGZiXUUdgsdy6/EsX/6284=
|
||||
github.com/docker/cli v25.0.3+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
|
||||
github.com/docker/cli v26.0.0-rc1+incompatible h1:PVxv2ySd8iZHoNfoAoKcnWSC/hKP2qMb806PWM34v50=
|
||||
github.com/docker/cli v26.0.0-rc1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
|
||||
github.com/docker/cli-docs-tool v0.7.0 h1:M2Da98Unz2kz3A5d4yeSGbhyOge2mfYSNjAFt01Rw0M=
|
||||
github.com/docker/cli-docs-tool v0.7.0/go.mod h1:zMjqTFCU361PRh8apiXzeAZ1Q/xupbIwTusYpzCXS/o=
|
||||
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||
github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8=
|
||||
github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||
github.com/docker/docker v25.0.3+incompatible h1:D5fy/lYmY7bvZa0XTZ5/UJPljor41F+vdyJG5luQLfQ=
|
||||
github.com/docker/docker v25.0.3+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||
github.com/docker/docker v26.0.0-rc1+incompatible h1:8Q4f+KSdA4hFc5SXcxthv1vR9HIoRwwjhBnMZL6IpkU=
|
||||
github.com/docker/docker v26.0.0-rc1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||
github.com/docker/docker-credential-helpers v0.8.0 h1:YQFtbBQb4VrpoPxhFuzEBPQ9E16qz5SpHLS+uswaCp8=
|
||||
github.com/docker/docker-credential-helpers v0.8.0/go.mod h1:UGFXcuoQ5TxPiB54nHOZ32AWRqQdECoh/Mg0AlEYb40=
|
||||
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0=
|
||||
@@ -311,8 +311,8 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua
|
||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
|
||||
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
|
||||
github.com/moby/buildkit v0.13.0-rc3 h1:Dns5Ixnv4OH1MyLZy7S4G2m+MLwp2YEqrPPzEzfw7Tw=
|
||||
github.com/moby/buildkit v0.13.0-rc3/go.mod h1:5pRtk7Wuv929XRIp9tqPdq07mrnBpXAUoOYYfOj0nhA=
|
||||
github.com/moby/buildkit v0.13.0 h1:reVR1Y+rbNIUQ9jf0Q1YZVH5a/nhOixZsl+HJ9qQEGI=
|
||||
github.com/moby/buildkit v0.13.0/go.mod h1:aNmNQKLBFYAOFuzQjR3VA27/FijlvtBD1pjNwTSN37k=
|
||||
github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=
|
||||
github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
|
||||
github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg=
|
||||
@@ -450,8 +450,8 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/theupdateframework/notary v0.7.0 h1:QyagRZ7wlSpjT5N2qQAh/pN+DVqgekv4DzbAiAiEL3c=
|
||||
github.com/theupdateframework/notary v0.7.0/go.mod h1:c9DRxcmhHmVLDay4/2fUYdISnHqbFDGRSlXPO0AhYWw=
|
||||
github.com/tonistiigi/fsutil v0.0.0-20240223190444-7a889f53dbf6 h1:v9u6pmdUkarXL/1S/6LGcG9wsiBLd9N/WyJq/Y9WPcg=
|
||||
github.com/tonistiigi/fsutil v0.0.0-20240223190444-7a889f53dbf6/go.mod h1:vbbYqJlnswsbJqWUcJN8fKtBhnEgldDrcagTgnBVKKM=
|
||||
github.com/tonistiigi/fsutil v0.0.0-20240301111122-7525a1af2bb5 h1:oZS8KCqAg62sxJkEq/Ppzqrb6EooqzWtL8Oaex7bc5c=
|
||||
github.com/tonistiigi/fsutil v0.0.0-20240301111122-7525a1af2bb5/go.mod h1:vbbYqJlnswsbJqWUcJN8fKtBhnEgldDrcagTgnBVKKM=
|
||||
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea h1:SXhTLE6pb6eld/v/cCndK0AMpt1wiVFb/YYmqB3/QG0=
|
||||
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea/go.mod h1:WPnis/6cRcDZSUvVmezrxJPkiO87ThFYsoUiMwWNDJk=
|
||||
github.com/tonistiigi/vt100 v0.0.0-20230623042737-f9a4f7ef6531 h1:Y/M5lygoNPKwVNLMPXgVfsRT40CSFKXCxuU8LoHySjs=
|
||||
|
160
tests/bake.go
160
tests/bake.go
@@ -2,13 +2,19 @@ package tests
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/containerd/continuity/fs/fstest"
|
||||
"github.com/docker/buildx/util/gitutil"
|
||||
"github.com/moby/buildkit/identity"
|
||||
"github.com/moby/buildkit/util/contentutil"
|
||||
"github.com/moby/buildkit/util/testutil"
|
||||
"github.com/moby/buildkit/util/testutil/integration"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -36,6 +42,8 @@ var bakeTests = []func(t *testing.T, sb integration.Sandbox){
|
||||
testBakeShmSize,
|
||||
testBakeUlimits,
|
||||
testBakeRefs,
|
||||
testBakeMultiExporters,
|
||||
testBakeLoadPush,
|
||||
}
|
||||
|
||||
func testBakeLocal(t *testing.T, sb integration.Sandbox) {
|
||||
@@ -631,3 +639,155 @@ target "default" {
|
||||
|
||||
require.NotEmpty(t, md.Default.BuildRef)
|
||||
}
|
||||
|
||||
func testBakeMultiExporters(t *testing.T, sb integration.Sandbox) {
|
||||
if sb.Name() != "docker" {
|
||||
t.Skip("skipping test for non-docker workers")
|
||||
}
|
||||
|
||||
registry, err := sb.NewRegistry()
|
||||
if errors.Is(err, integration.ErrRequirements) {
|
||||
t.Skip(err.Error())
|
||||
}
|
||||
require.NoError(t, err)
|
||||
|
||||
targetReg := registry + "/buildx/registry:latest"
|
||||
targetStore := "buildx:local-" + identity.NewID()
|
||||
|
||||
var builderName string
|
||||
t.Cleanup(func() {
|
||||
if builderName == "" {
|
||||
return
|
||||
}
|
||||
|
||||
cmd := dockerCmd(sb, withArgs("image", "rm", targetStore))
|
||||
cmd.Stderr = os.Stderr
|
||||
require.NoError(t, cmd.Run())
|
||||
|
||||
out, err := rmCmd(sb, withArgs(builderName))
|
||||
require.NoError(t, err, out)
|
||||
})
|
||||
|
||||
// TODO: use stable buildkit image when v0.13.0 released
|
||||
out, err := createCmd(sb, withArgs(
|
||||
"--driver", "docker-container",
|
||||
"--buildkitd-flags=--allow-insecure-entitlement=network.host",
|
||||
"--driver-opt", "network=host",
|
||||
"--driver-opt", "image=moby/buildkit:v0.13.0-rc3",
|
||||
))
|
||||
require.NoError(t, err, out)
|
||||
builderName = strings.TrimSpace(out)
|
||||
|
||||
dockerfile := []byte(`
|
||||
FROM scratch
|
||||
COPY foo /foo
|
||||
`)
|
||||
bakefile := []byte(`
|
||||
target "default" {
|
||||
}
|
||||
`)
|
||||
dir := tmpdir(
|
||||
t,
|
||||
fstest.CreateFile("docker-bake.hcl", bakefile, 0600),
|
||||
fstest.CreateFile("Dockerfile", dockerfile, 0600),
|
||||
fstest.CreateFile("foo", []byte("foo"), 0600),
|
||||
)
|
||||
|
||||
outputs := []string{
|
||||
"--set", fmt.Sprintf("*.output=type=image,name=%s,push=true", targetReg),
|
||||
"--set", fmt.Sprintf("*.output=type=docker,name=%s", targetStore),
|
||||
"--set", fmt.Sprintf("*.output=type=oci,dest=%s/result", dir),
|
||||
}
|
||||
cmd := buildxCmd(sb, withDir(dir), withArgs("bake"), withArgs(outputs...))
|
||||
cmd.Env = append(cmd.Env, "BUILDX_BUILDER="+builderName)
|
||||
outb, err := cmd.CombinedOutput()
|
||||
require.NoError(t, err, string(outb))
|
||||
|
||||
// test registry
|
||||
desc, provider, err := contentutil.ProviderFromRef(targetReg)
|
||||
require.NoError(t, err)
|
||||
_, err = testutil.ReadImages(sb.Context(), provider, desc)
|
||||
require.NoError(t, err)
|
||||
|
||||
// test docker store
|
||||
cmd = dockerCmd(sb, withArgs("image", "inspect", targetStore))
|
||||
cmd.Stderr = os.Stderr
|
||||
require.NoError(t, cmd.Run())
|
||||
|
||||
// test oci
|
||||
_, err = os.ReadFile(fmt.Sprintf("%s/result", dir))
|
||||
require.NoError(t, err)
|
||||
|
||||
// TODO: test metadata file when supported by multi exporters https://github.com/docker/buildx/issues/2181
|
||||
}
|
||||
|
||||
func testBakeLoadPush(t *testing.T, sb integration.Sandbox) {
|
||||
if sb.Name() != "docker" {
|
||||
t.Skip("skipping test for non-docker workers")
|
||||
}
|
||||
|
||||
registry, err := sb.NewRegistry()
|
||||
if errors.Is(err, integration.ErrRequirements) {
|
||||
t.Skip(err.Error())
|
||||
}
|
||||
require.NoError(t, err)
|
||||
|
||||
target := registry + "/buildx/registry:" + identity.NewID()
|
||||
|
||||
var builderName string
|
||||
t.Cleanup(func() {
|
||||
if builderName == "" {
|
||||
return
|
||||
}
|
||||
|
||||
cmd := dockerCmd(sb, withArgs("image", "rm", target))
|
||||
cmd.Stderr = os.Stderr
|
||||
require.NoError(t, cmd.Run())
|
||||
|
||||
out, err := rmCmd(sb, withArgs(builderName))
|
||||
require.NoError(t, err, out)
|
||||
})
|
||||
|
||||
// TODO: use stable buildkit image when v0.13.0 released
|
||||
out, err := createCmd(sb, withArgs(
|
||||
"--driver", "docker-container",
|
||||
"--buildkitd-flags=--allow-insecure-entitlement=network.host",
|
||||
"--driver-opt", "network=host",
|
||||
"--driver-opt", "image=moby/buildkit:v0.13.0-rc3",
|
||||
))
|
||||
require.NoError(t, err, out)
|
||||
builderName = strings.TrimSpace(out)
|
||||
|
||||
dockerfile := []byte(`
|
||||
FROM scratch
|
||||
COPY foo /foo
|
||||
`)
|
||||
bakefile := []byte(`
|
||||
target "default" {
|
||||
}
|
||||
`)
|
||||
dir := tmpdir(
|
||||
t,
|
||||
fstest.CreateFile("docker-bake.hcl", bakefile, 0600),
|
||||
fstest.CreateFile("Dockerfile", dockerfile, 0600),
|
||||
fstest.CreateFile("foo", []byte("foo"), 0600),
|
||||
)
|
||||
|
||||
cmd := buildxCmd(sb, withDir(dir), withArgs("bake", "--push", "--load", fmt.Sprintf("--set=*.tags=%s", target)))
|
||||
cmd.Env = append(cmd.Env, "BUILDX_BUILDER="+builderName)
|
||||
outb, err := cmd.CombinedOutput()
|
||||
require.NoError(t, err, string(outb))
|
||||
|
||||
// TODO: test registry when --load case fixed for bake (currently overrides --push)
|
||||
//desc, provider, err := contentutil.ProviderFromRef(target)
|
||||
//require.NoError(t, err)
|
||||
//_, err = testutil.ReadImages(sb.Context(), provider, desc)
|
||||
//require.NoError(t, err)
|
||||
|
||||
// test docker store
|
||||
cmd = dockerCmd(sb, withArgs("image", "inspect", target))
|
||||
cmd.Stderr = os.Stderr
|
||||
require.NoError(t, cmd.Run())
|
||||
|
||||
// TODO: test metadata file when supported by multi exporters https://github.com/docker/buildx/issues/2181
|
||||
}
|
||||
|
135
tests/build.go
135
tests/build.go
@@ -16,6 +16,7 @@ import (
|
||||
"github.com/containerd/containerd/platforms"
|
||||
"github.com/containerd/continuity/fs/fstest"
|
||||
"github.com/creack/pty"
|
||||
"github.com/moby/buildkit/identity"
|
||||
"github.com/moby/buildkit/util/appdefaults"
|
||||
"github.com/moby/buildkit/util/contentutil"
|
||||
"github.com/moby/buildkit/util/testutil"
|
||||
@@ -54,6 +55,8 @@ var buildTests = []func(t *testing.T, sb integration.Sandbox){
|
||||
testBuildShmSize,
|
||||
testBuildUlimit,
|
||||
testBuildRef,
|
||||
testBuildMultiExporters,
|
||||
testBuildLoadPush,
|
||||
}
|
||||
|
||||
func testBuild(t *testing.T, sb integration.Sandbox) {
|
||||
@@ -437,7 +440,7 @@ func testBuildNetworkModeBridge(t *testing.T, sb integration.Sandbox) {
|
||||
})
|
||||
|
||||
// TODO: use stable buildkit image when v0.13.0 released
|
||||
out, err := createCmd(sb, withArgs("--driver", "docker-container", "--buildkitd-flags=--oci-worker-net=bridge --allow-insecure-entitlement=network.host", "--driver-opt", "image=moby/buildkit:master"))
|
||||
out, err := createCmd(sb, withArgs("--driver", "docker-container", "--buildkitd-flags=--oci-worker-net=bridge --allow-insecure-entitlement=network.host", "--driver-opt", "image=moby/buildkit:v0.13.0-rc3"))
|
||||
require.NoError(t, err, out)
|
||||
builderName = strings.TrimSpace(out)
|
||||
|
||||
@@ -542,6 +545,136 @@ func testBuildRef(t *testing.T, sb integration.Sandbox) {
|
||||
require.NotEmpty(t, md.BuildRef)
|
||||
}
|
||||
|
||||
func testBuildMultiExporters(t *testing.T, sb integration.Sandbox) {
|
||||
if sb.Name() != "docker" {
|
||||
t.Skip("skipping test for non-docker workers")
|
||||
}
|
||||
|
||||
registry, err := sb.NewRegistry()
|
||||
if errors.Is(err, integration.ErrRequirements) {
|
||||
t.Skip(err.Error())
|
||||
}
|
||||
require.NoError(t, err)
|
||||
|
||||
targetReg := registry + "/buildx/registry:latest"
|
||||
targetStore := "buildx:local-" + identity.NewID()
|
||||
|
||||
var builderName string
|
||||
t.Cleanup(func() {
|
||||
if builderName == "" {
|
||||
return
|
||||
}
|
||||
|
||||
cmd := dockerCmd(sb, withArgs("image", "rm", targetStore))
|
||||
cmd.Stderr = os.Stderr
|
||||
require.NoError(t, cmd.Run())
|
||||
|
||||
out, err := rmCmd(sb, withArgs(builderName))
|
||||
require.NoError(t, err, out)
|
||||
})
|
||||
|
||||
// TODO: use stable buildkit image when v0.13.0 released
|
||||
out, err := createCmd(sb, withArgs(
|
||||
"--driver", "docker-container",
|
||||
"--buildkitd-flags=--allow-insecure-entitlement=network.host",
|
||||
"--driver-opt", "network=host",
|
||||
"--driver-opt", "image=moby/buildkit:v0.13.0-rc3",
|
||||
))
|
||||
require.NoError(t, err, out)
|
||||
builderName = strings.TrimSpace(out)
|
||||
|
||||
dir := createTestProject(t)
|
||||
|
||||
outputs := []string{
|
||||
"--output", fmt.Sprintf("type=image,name=%s,push=true", targetReg),
|
||||
"--output", fmt.Sprintf("type=docker,name=%s", targetStore),
|
||||
"--output", fmt.Sprintf("type=oci,dest=%s/result", dir),
|
||||
}
|
||||
cmd := buildxCmd(sb, withArgs("build"), withArgs(outputs...), withArgs(dir))
|
||||
cmd.Env = append(cmd.Env, "BUILDX_BUILDER="+builderName)
|
||||
outb, err := cmd.CombinedOutput()
|
||||
require.NoError(t, err, string(outb))
|
||||
|
||||
// test registry
|
||||
desc, provider, err := contentutil.ProviderFromRef(targetReg)
|
||||
require.NoError(t, err)
|
||||
_, err = testutil.ReadImages(sb.Context(), provider, desc)
|
||||
require.NoError(t, err)
|
||||
|
||||
// test docker store
|
||||
cmd = dockerCmd(sb, withArgs("image", "inspect", targetStore))
|
||||
cmd.Stderr = os.Stderr
|
||||
require.NoError(t, cmd.Run())
|
||||
|
||||
// test oci
|
||||
_, err = os.ReadFile(fmt.Sprintf("%s/result", dir))
|
||||
require.NoError(t, err)
|
||||
|
||||
// TODO: test metadata file when supported by multi exporters https://github.com/docker/buildx/issues/2181
|
||||
}
|
||||
|
||||
func testBuildLoadPush(t *testing.T, sb integration.Sandbox) {
|
||||
if sb.Name() != "docker" {
|
||||
t.Skip("skipping test for non-docker workers")
|
||||
}
|
||||
|
||||
registry, err := sb.NewRegistry()
|
||||
if errors.Is(err, integration.ErrRequirements) {
|
||||
t.Skip(err.Error())
|
||||
}
|
||||
require.NoError(t, err)
|
||||
|
||||
target := registry + "/buildx/registry:" + identity.NewID()
|
||||
|
||||
var builderName string
|
||||
t.Cleanup(func() {
|
||||
if builderName == "" {
|
||||
return
|
||||
}
|
||||
|
||||
cmd := dockerCmd(sb, withArgs("image", "rm", target))
|
||||
cmd.Stderr = os.Stderr
|
||||
require.NoError(t, cmd.Run())
|
||||
|
||||
out, err := rmCmd(sb, withArgs(builderName))
|
||||
require.NoError(t, err, out)
|
||||
})
|
||||
|
||||
// TODO: use stable buildkit image when v0.13.0 released
|
||||
out, err := createCmd(sb, withArgs(
|
||||
"--driver", "docker-container",
|
||||
"--buildkitd-flags=--allow-insecure-entitlement=network.host",
|
||||
"--driver-opt", "network=host",
|
||||
"--driver-opt", "image=moby/buildkit:v0.13.0-rc3",
|
||||
))
|
||||
require.NoError(t, err, out)
|
||||
builderName = strings.TrimSpace(out)
|
||||
|
||||
dir := createTestProject(t)
|
||||
|
||||
cmd := buildxCmd(sb, withArgs(
|
||||
"build", "--push", "--load",
|
||||
fmt.Sprintf("-t=%s", target),
|
||||
dir,
|
||||
))
|
||||
cmd.Env = append(cmd.Env, "BUILDX_BUILDER="+builderName)
|
||||
outb, err := cmd.CombinedOutput()
|
||||
require.NoError(t, err, string(outb))
|
||||
|
||||
// test registry
|
||||
desc, provider, err := contentutil.ProviderFromRef(target)
|
||||
require.NoError(t, err)
|
||||
_, err = testutil.ReadImages(sb.Context(), provider, desc)
|
||||
require.NoError(t, err)
|
||||
|
||||
// test docker store
|
||||
cmd = dockerCmd(sb, withArgs("image", "inspect", target))
|
||||
cmd.Stderr = os.Stderr
|
||||
require.NoError(t, cmd.Run())
|
||||
|
||||
// TODO: test metadata file when supported by multi exporters https://github.com/docker/buildx/issues/2181
|
||||
}
|
||||
|
||||
func createTestProject(t *testing.T) string {
|
||||
dockerfile := []byte(`
|
||||
FROM busybox:latest AS base
|
||||
|
@@ -1,9 +1,13 @@
|
||||
package tests
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/buildx/driver"
|
||||
"github.com/moby/buildkit/identity"
|
||||
"github.com/moby/buildkit/util/testutil/integration"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@@ -18,6 +22,7 @@ func createCmd(sb integration.Sandbox, opts ...cmdOpt) (string, error) {
|
||||
var createTests = []func(t *testing.T, sb integration.Sandbox){
|
||||
testCreateMemoryLimit,
|
||||
testCreateRestartAlways,
|
||||
testCreateRemoteContainer,
|
||||
}
|
||||
|
||||
func testCreateMemoryLimit(t *testing.T, sb integration.Sandbox) {
|
||||
@@ -57,3 +62,49 @@ func testCreateRestartAlways(t *testing.T, sb integration.Sandbox) {
|
||||
require.NoError(t, err, out)
|
||||
builderName = strings.TrimSpace(out)
|
||||
}
|
||||
|
||||
func testCreateRemoteContainer(t *testing.T, sb integration.Sandbox) {
|
||||
if sb.Name() != "docker" {
|
||||
t.Skip("skipping test for non-docker workers")
|
||||
}
|
||||
|
||||
ctnBuilderName := "ctn-builder-" + identity.NewID()
|
||||
remoteBuilderName := "remote-builder-" + identity.NewID()
|
||||
var hasCtnBuilder, hasRemoteBuilder bool
|
||||
t.Cleanup(func() {
|
||||
if hasCtnBuilder {
|
||||
out, err := rmCmd(sb, withArgs(ctnBuilderName))
|
||||
require.NoError(t, err, out)
|
||||
}
|
||||
if hasRemoteBuilder {
|
||||
out, err := rmCmd(sb, withArgs(remoteBuilderName))
|
||||
require.NoError(t, err, out)
|
||||
}
|
||||
})
|
||||
|
||||
out, err := createCmd(sb, withArgs("--driver", "docker-container", "--name", ctnBuilderName))
|
||||
require.NoError(t, err, out)
|
||||
hasCtnBuilder = true
|
||||
|
||||
out, err = inspectCmd(sb, withArgs("--bootstrap", ctnBuilderName))
|
||||
require.NoError(t, err, out)
|
||||
|
||||
cmd := dockerCmd(sb, withArgs("container", "inspect", fmt.Sprintf("%s0", driver.BuilderName(ctnBuilderName))))
|
||||
cmd.Stderr = os.Stderr
|
||||
require.NoError(t, cmd.Run())
|
||||
|
||||
out, err = createCmd(sb, withArgs("--driver", "remote", "--name", remoteBuilderName, fmt.Sprintf("docker-container://%s0", driver.BuilderName(ctnBuilderName))))
|
||||
require.NoError(t, err, out)
|
||||
hasRemoteBuilder = true
|
||||
|
||||
out, err = inspectCmd(sb, withArgs(remoteBuilderName))
|
||||
require.NoError(t, err, out)
|
||||
|
||||
for _, line := range strings.Split(out, "\n") {
|
||||
if v, ok := strings.CutPrefix(line, "Status:"); ok {
|
||||
require.Equal(t, strings.TrimSpace(v), "running")
|
||||
return
|
||||
}
|
||||
}
|
||||
require.Fail(t, "remote builder is not running")
|
||||
}
|
||||
|
14
vendor/github.com/docker/cli/cli-plugins/socket/socket.go
generated
vendored
14
vendor/github.com/docker/cli/cli-plugins/socket/socket.go
generated
vendored
@@ -1,12 +1,12 @@
|
||||
package socket
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"io"
|
||||
"net"
|
||||
"os"
|
||||
|
||||
"github.com/docker/distribution/uuid"
|
||||
)
|
||||
|
||||
// EnvKey represents the well-known environment variable used to pass the plugin being
|
||||
@@ -17,7 +17,7 @@ const EnvKey = "DOCKER_CLI_PLUGIN_SOCKET"
|
||||
// and update the conn pointer, and returns the listener for the socket (which the caller
|
||||
// is responsible for closing when it's no longer needed).
|
||||
func SetupConn(conn **net.UnixConn) (*net.UnixListener, error) {
|
||||
listener, err := listen("docker_cli_" + uuid.Generate().String())
|
||||
listener, err := listen("docker_cli_" + randomID())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -27,6 +27,14 @@ func SetupConn(conn **net.UnixConn) (*net.UnixListener, error) {
|
||||
return listener, nil
|
||||
}
|
||||
|
||||
func randomID() string {
|
||||
b := make([]byte, 16)
|
||||
if _, err := rand.Read(b); err != nil {
|
||||
panic(err) // This shouldn't happen
|
||||
}
|
||||
return hex.EncodeToString(b)
|
||||
}
|
||||
|
||||
func accept(listener *net.UnixListener, conn **net.UnixConn) {
|
||||
go func() {
|
||||
for {
|
||||
|
5
vendor/github.com/docker/cli/cli-plugins/socket/socket_nodarwin.go
generated
vendored
5
vendor/github.com/docker/cli/cli-plugins/socket/socket_nodarwin.go
generated
vendored
@@ -1,4 +1,4 @@
|
||||
//go:build !darwin
|
||||
//go:build !darwin && !openbsd
|
||||
|
||||
package socket
|
||||
|
||||
@@ -15,5 +15,6 @@ func listen(socketname string) (*net.UnixListener, error) {
|
||||
|
||||
func onAccept(conn *net.UnixConn, listener *net.UnixListener) {
|
||||
// do nothing
|
||||
// while on darwin we would unlink here; on non-darwin the socket is abstract and not present on the filesystem
|
||||
// while on darwin and OpenBSD we would unlink here;
|
||||
// on non-darwin the socket is abstract and not present on the filesystem
|
||||
}
|
||||
|
19
vendor/github.com/docker/cli/cli-plugins/socket/socket_openbsd.go
generated
vendored
Normal file
19
vendor/github.com/docker/cli/cli-plugins/socket/socket_openbsd.go
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
package socket
|
||||
|
||||
import (
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func listen(socketname string) (*net.UnixListener, error) {
|
||||
return net.ListenUnix("unix", &net.UnixAddr{
|
||||
Name: filepath.Join(os.TempDir(), socketname),
|
||||
Net: "unix",
|
||||
})
|
||||
}
|
||||
|
||||
func onAccept(conn *net.UnixConn, listener *net.UnixListener) {
|
||||
syscall.Unlink(listener.Addr().String())
|
||||
}
|
14
vendor/github.com/docker/cli/cli/command/cli_options.go
generated
vendored
14
vendor/github.com/docker/cli/cli/command/cli_options.go
generated
vendored
@@ -11,19 +11,11 @@ import (
|
||||
"github.com/moby/term"
|
||||
)
|
||||
|
||||
// CLIOption applies a modification on a DockerCli.
|
||||
// CLIOption is a functional argument to apply options to a [DockerCli]. These
|
||||
// options can be passed to [NewDockerCli] to initialize a new CLI, or
|
||||
// applied with [DockerCli.Initialize] or [DockerCli.Apply].
|
||||
type CLIOption func(cli *DockerCli) error
|
||||
|
||||
// DockerCliOption applies a modification on a DockerCli.
|
||||
//
|
||||
// Deprecated: use [CLIOption] instead.
|
||||
type DockerCliOption = CLIOption
|
||||
|
||||
// InitializeOpt is the type of the functional options passed to DockerCli.Initialize
|
||||
//
|
||||
// Deprecated: use [CLIOption] instead.
|
||||
type InitializeOpt = CLIOption
|
||||
|
||||
// WithStandardStreams sets a cli in, out and err streams with the standard streams.
|
||||
func WithStandardStreams() CLIOption {
|
||||
return func(cli *DockerCli) error {
|
||||
|
2
vendor/github.com/docker/cli/opts/mount.go
generated
vendored
2
vendor/github.com/docker/cli/opts/mount.go
generated
vendored
@@ -131,6 +131,8 @@ func (m *MountOpt) Set(value string) error {
|
||||
return fmt.Errorf("invalid value for %s: %s (must be \"enabled\", \"disabled\", \"writable\", or \"readonly\")",
|
||||
key, val)
|
||||
}
|
||||
case "volume-subpath":
|
||||
volumeOptions().Subpath = val
|
||||
case "volume-nocopy":
|
||||
volumeOptions().NoCopy, err = strconv.ParseBool(val)
|
||||
if err != nil {
|
||||
|
13
vendor/github.com/docker/docker/api/common.go
generated
vendored
13
vendor/github.com/docker/docker/api/common.go
generated
vendored
@@ -2,8 +2,17 @@ package api // import "github.com/docker/docker/api"
|
||||
|
||||
// Common constants for daemon and client.
|
||||
const (
|
||||
// DefaultVersion of Current REST API
|
||||
DefaultVersion = "1.44"
|
||||
// DefaultVersion of the current REST API.
|
||||
DefaultVersion = "1.45"
|
||||
|
||||
// MinSupportedAPIVersion is the minimum API version that can be supported
|
||||
// by the API server, specified as "major.minor". Note that the daemon
|
||||
// may be configured with a different minimum API version, as returned
|
||||
// in [github.com/docker/docker/api/types.Version.MinAPIVersion].
|
||||
//
|
||||
// API requests for API versions lower than the configured version produce
|
||||
// an error.
|
||||
MinSupportedAPIVersion = "1.24"
|
||||
|
||||
// NoBaseImageSpecifier is the symbol used by the FROM
|
||||
// command to specify that no base image is to be used.
|
||||
|
24
vendor/github.com/docker/docker/api/swagger.yaml
generated
vendored
24
vendor/github.com/docker/docker/api/swagger.yaml
generated
vendored
@@ -19,10 +19,10 @@ produces:
|
||||
consumes:
|
||||
- "application/json"
|
||||
- "text/plain"
|
||||
basePath: "/v1.44"
|
||||
basePath: "/v1.45"
|
||||
info:
|
||||
title: "Docker Engine API"
|
||||
version: "1.44"
|
||||
version: "1.45"
|
||||
x-logo:
|
||||
url: "https://docs.docker.com/assets/images/logo-docker-main.png"
|
||||
description: |
|
||||
@@ -55,8 +55,8 @@ info:
|
||||
the URL is not supported by the daemon, a HTTP `400 Bad Request` error message
|
||||
is returned.
|
||||
|
||||
If you omit the version-prefix, the current version of the API (v1.44) is used.
|
||||
For example, calling `/info` is the same as calling `/v1.44/info`. Using the
|
||||
If you omit the version-prefix, the current version of the API (v1.45) is used.
|
||||
For example, calling `/info` is the same as calling `/v1.45/info`. Using the
|
||||
API without a version-prefix is deprecated and will be removed in a future release.
|
||||
|
||||
Engine releases in the near future should support this version of the API,
|
||||
@@ -391,7 +391,11 @@ definitions:
|
||||
ReadOnlyNonRecursive:
|
||||
description: |
|
||||
Make the mount non-recursively read-only, but still leave the mount recursive
|
||||
(unless NonRecursive is set to true in conjunction).
|
||||
(unless NonRecursive is set to `true` in conjunction).
|
||||
|
||||
Addded in v1.44, before that version all read-only mounts were
|
||||
non-recursive by default. To match the previous behaviour this
|
||||
will default to `true` for clients on versions prior to v1.44.
|
||||
type: "boolean"
|
||||
default: false
|
||||
ReadOnlyForceRecursive:
|
||||
@@ -423,6 +427,10 @@ definitions:
|
||||
type: "object"
|
||||
additionalProperties:
|
||||
type: "string"
|
||||
Subpath:
|
||||
description: "Source path inside the volume. Must be relative without any back traversals."
|
||||
type: "string"
|
||||
example: "dir-inside-volume/subdirectory"
|
||||
TmpfsOptions:
|
||||
description: "Optional configuration for the `tmpfs` type."
|
||||
type: "object"
|
||||
@@ -1743,8 +1751,12 @@ definitions:
|
||||
description: |
|
||||
Date and time at which the image was created, formatted in
|
||||
[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.
|
||||
|
||||
This information is only available if present in the image,
|
||||
and omitted otherwise.
|
||||
type: "string"
|
||||
x-nullable: false
|
||||
format: "dateTime"
|
||||
x-nullable: true
|
||||
example: "2022-02-04T21:20:12.497794809Z"
|
||||
Container:
|
||||
description: |
|
||||
|
47
vendor/github.com/docker/docker/api/types/client.go
generated
vendored
47
vendor/github.com/docker/docker/api/types/client.go
generated
vendored
@@ -157,42 +157,12 @@ type ImageBuildResponse struct {
|
||||
OSType string
|
||||
}
|
||||
|
||||
// ImageCreateOptions holds information to create images.
|
||||
type ImageCreateOptions struct {
|
||||
RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry.
|
||||
Platform string // Platform is the target platform of the image if it needs to be pulled from the registry.
|
||||
}
|
||||
|
||||
// ImageImportSource holds source information for ImageImport
|
||||
type ImageImportSource struct {
|
||||
Source io.Reader // Source is the data to send to the server to create this image from. You must set SourceName to "-" to leverage this.
|
||||
SourceName string // SourceName is the name of the image to pull. Set to "-" to leverage the Source attribute.
|
||||
}
|
||||
|
||||
// ImageImportOptions holds information to import images from the client host.
|
||||
type ImageImportOptions struct {
|
||||
Tag string // Tag is the name to tag this image with. This attribute is deprecated.
|
||||
Message string // Message is the message to tag the image with
|
||||
Changes []string // Changes are the raw changes to apply to this image
|
||||
Platform string // Platform is the target platform of the image
|
||||
}
|
||||
|
||||
// ImageListOptions holds parameters to list images with.
|
||||
type ImageListOptions struct {
|
||||
// All controls whether all images in the graph are filtered, or just
|
||||
// the heads.
|
||||
All bool
|
||||
|
||||
// Filters is a JSON-encoded set of filter arguments.
|
||||
Filters filters.Args
|
||||
|
||||
// SharedSize indicates whether the shared size of images should be computed.
|
||||
SharedSize bool
|
||||
|
||||
// ContainerCount indicates whether container count should be computed.
|
||||
ContainerCount bool
|
||||
}
|
||||
|
||||
// ImageLoadResponse returns information to the client about a load process.
|
||||
type ImageLoadResponse struct {
|
||||
// Body must be closed to avoid a resource leak
|
||||
@@ -200,14 +170,6 @@ type ImageLoadResponse struct {
|
||||
JSON bool
|
||||
}
|
||||
|
||||
// ImagePullOptions holds information to pull images.
|
||||
type ImagePullOptions struct {
|
||||
All bool
|
||||
RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry
|
||||
PrivilegeFunc RequestPrivilegeFunc
|
||||
Platform string
|
||||
}
|
||||
|
||||
// RequestPrivilegeFunc is a function interface that
|
||||
// clients can supply to retry operations after
|
||||
// getting an authorization error.
|
||||
@@ -216,15 +178,6 @@ type ImagePullOptions struct {
|
||||
// if the privilege request fails.
|
||||
type RequestPrivilegeFunc func() (string, error)
|
||||
|
||||
// ImagePushOptions holds information to push images.
|
||||
type ImagePushOptions ImagePullOptions
|
||||
|
||||
// ImageRemoveOptions holds parameters to remove images.
|
||||
type ImageRemoveOptions struct {
|
||||
Force bool
|
||||
PruneChildren bool
|
||||
}
|
||||
|
||||
// ImageSearchOptions holds parameters to search images with.
|
||||
type ImageSearchOptions struct {
|
||||
RegistryAuth string
|
||||
|
2
vendor/github.com/docker/docker/api/types/container/config.go
generated
vendored
2
vendor/github.com/docker/docker/api/types/container/config.go
generated
vendored
@@ -5,8 +5,8 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types/strslice"
|
||||
dockerspec "github.com/docker/docker/image/spec/specs-go/v1"
|
||||
"github.com/docker/go-connections/nat"
|
||||
dockerspec "github.com/moby/docker-image-spec/specs-go/v1"
|
||||
)
|
||||
|
||||
// MinimumDuration puts a minimum on user configured duration.
|
||||
|
58
vendor/github.com/docker/docker/api/types/image/opts.go
generated
vendored
58
vendor/github.com/docker/docker/api/types/image/opts.go
generated
vendored
@@ -1,9 +1,57 @@
|
||||
package image
|
||||
|
||||
import ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
import "github.com/docker/docker/api/types/filters"
|
||||
|
||||
// GetImageOpts holds parameters to inspect an image.
|
||||
type GetImageOpts struct {
|
||||
Platform *ocispec.Platform
|
||||
Details bool
|
||||
// ImportOptions holds information to import images from the client host.
|
||||
type ImportOptions struct {
|
||||
Tag string // Tag is the name to tag this image with. This attribute is deprecated.
|
||||
Message string // Message is the message to tag the image with
|
||||
Changes []string // Changes are the raw changes to apply to this image
|
||||
Platform string // Platform is the target platform of the image
|
||||
}
|
||||
|
||||
// CreateOptions holds information to create images.
|
||||
type CreateOptions struct {
|
||||
RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry.
|
||||
Platform string // Platform is the target platform of the image if it needs to be pulled from the registry.
|
||||
}
|
||||
|
||||
// PullOptions holds information to pull images.
|
||||
type PullOptions struct {
|
||||
All bool
|
||||
RegistryAuth string // RegistryAuth is the base64 encoded credentials for the registry
|
||||
|
||||
// PrivilegeFunc is a function that clients can supply to retry operations
|
||||
// after getting an authorization error. This function returns the registry
|
||||
// authentication header value in base64 encoded format, or an error if the
|
||||
// privilege request fails.
|
||||
//
|
||||
// Also see [github.com/docker/docker/api/types.RequestPrivilegeFunc].
|
||||
PrivilegeFunc func() (string, error)
|
||||
Platform string
|
||||
}
|
||||
|
||||
// PushOptions holds information to push images.
|
||||
type PushOptions PullOptions
|
||||
|
||||
// ListOptions holds parameters to list images with.
|
||||
type ListOptions struct {
|
||||
// All controls whether all images in the graph are filtered, or just
|
||||
// the heads.
|
||||
All bool
|
||||
|
||||
// Filters is a JSON-encoded set of filter arguments.
|
||||
Filters filters.Args
|
||||
|
||||
// SharedSize indicates whether the shared size of images should be computed.
|
||||
SharedSize bool
|
||||
|
||||
// ContainerCount indicates whether container count should be computed.
|
||||
ContainerCount bool
|
||||
}
|
||||
|
||||
// RemoveOptions holds parameters to remove images.
|
||||
type RemoveOptions struct {
|
||||
Force bool
|
||||
PruneChildren bool
|
||||
}
|
||||
|
1
vendor/github.com/docker/docker/api/types/mount/mount.go
generated
vendored
1
vendor/github.com/docker/docker/api/types/mount/mount.go
generated
vendored
@@ -96,6 +96,7 @@ type BindOptions struct {
|
||||
type VolumeOptions struct {
|
||||
NoCopy bool `json:",omitempty"`
|
||||
Labels map[string]string `json:",omitempty"`
|
||||
Subpath string `json:",omitempty"`
|
||||
DriverConfig *Driver `json:",omitempty"`
|
||||
}
|
||||
|
||||
|
5
vendor/github.com/docker/docker/api/types/types.go
generated
vendored
5
vendor/github.com/docker/docker/api/types/types.go
generated
vendored
@@ -72,7 +72,10 @@ type ImageInspect struct {
|
||||
|
||||
// Created is the date and time at which the image was created, formatted in
|
||||
// RFC 3339 nano-seconds (time.RFC3339Nano).
|
||||
Created string
|
||||
//
|
||||
// This information is only available if present in the image,
|
||||
// and omitted otherwise.
|
||||
Created string `json:",omitempty"`
|
||||
|
||||
// Container is the ID of the container that was used to create the image.
|
||||
//
|
||||
|
139
vendor/github.com/docker/docker/api/types/types_deprecated.go
generated
vendored
139
vendor/github.com/docker/docker/api/types/types_deprecated.go
generated
vendored
@@ -1,138 +1,35 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"github.com/docker/docker/api/types/checkpoint"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/api/types/image"
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
"github.com/docker/docker/api/types/system"
|
||||
)
|
||||
|
||||
// CheckpointCreateOptions holds parameters to create a checkpoint from a container.
|
||||
// ImageImportOptions holds information to import images from the client host.
|
||||
//
|
||||
// Deprecated: use [checkpoint.CreateOptions].
|
||||
type CheckpointCreateOptions = checkpoint.CreateOptions
|
||||
// Deprecated: use [image.ImportOptions].
|
||||
type ImageImportOptions = image.ImportOptions
|
||||
|
||||
// CheckpointListOptions holds parameters to list checkpoints for a container
|
||||
// ImageCreateOptions holds information to create images.
|
||||
//
|
||||
// Deprecated: use [checkpoint.ListOptions].
|
||||
type CheckpointListOptions = checkpoint.ListOptions
|
||||
// Deprecated: use [image.CreateOptions].
|
||||
type ImageCreateOptions = image.CreateOptions
|
||||
|
||||
// CheckpointDeleteOptions holds parameters to delete a checkpoint from a container
|
||||
// ImagePullOptions holds information to pull images.
|
||||
//
|
||||
// Deprecated: use [checkpoint.DeleteOptions].
|
||||
type CheckpointDeleteOptions = checkpoint.DeleteOptions
|
||||
// Deprecated: use [image.PullOptions].
|
||||
type ImagePullOptions = image.PullOptions
|
||||
|
||||
// Checkpoint represents the details of a checkpoint when listing endpoints.
|
||||
// ImagePushOptions holds information to push images.
|
||||
//
|
||||
// Deprecated: use [checkpoint.Summary].
|
||||
type Checkpoint = checkpoint.Summary
|
||||
// Deprecated: use [image.PushOptions].
|
||||
type ImagePushOptions = image.PushOptions
|
||||
|
||||
// Info contains response of Engine API:
|
||||
// GET "/info"
|
||||
// ImageListOptions holds parameters to list images with.
|
||||
//
|
||||
// Deprecated: use [system.Info].
|
||||
type Info = system.Info
|
||||
// Deprecated: use [image.ListOptions].
|
||||
type ImageListOptions = image.ListOptions
|
||||
|
||||
// Commit holds the Git-commit (SHA1) that a binary was built from, as reported
|
||||
// in the version-string of external tools, such as containerd, or runC.
|
||||
// ImageRemoveOptions holds parameters to remove images.
|
||||
//
|
||||
// Deprecated: use [system.Commit].
|
||||
type Commit = system.Commit
|
||||
|
||||
// PluginsInfo is a temp struct holding Plugins name
|
||||
// registered with docker daemon. It is used by [system.Info] struct
|
||||
//
|
||||
// Deprecated: use [system.PluginsInfo].
|
||||
type PluginsInfo = system.PluginsInfo
|
||||
|
||||
// NetworkAddressPool is a temp struct used by [system.Info] struct.
|
||||
//
|
||||
// Deprecated: use [system.NetworkAddressPool].
|
||||
type NetworkAddressPool = system.NetworkAddressPool
|
||||
|
||||
// Runtime describes an OCI runtime.
|
||||
//
|
||||
// Deprecated: use [system.Runtime].
|
||||
type Runtime = system.Runtime
|
||||
|
||||
// SecurityOpt contains the name and options of a security option.
|
||||
//
|
||||
// Deprecated: use [system.SecurityOpt].
|
||||
type SecurityOpt = system.SecurityOpt
|
||||
|
||||
// KeyValue holds a key/value pair.
|
||||
//
|
||||
// Deprecated: use [system.KeyValue].
|
||||
type KeyValue = system.KeyValue
|
||||
|
||||
// ImageDeleteResponseItem image delete response item.
|
||||
//
|
||||
// Deprecated: use [image.DeleteResponse].
|
||||
type ImageDeleteResponseItem = image.DeleteResponse
|
||||
|
||||
// ImageSummary image summary.
|
||||
//
|
||||
// Deprecated: use [image.Summary].
|
||||
type ImageSummary = image.Summary
|
||||
|
||||
// ImageMetadata contains engine-local data about the image.
|
||||
//
|
||||
// Deprecated: use [image.Metadata].
|
||||
type ImageMetadata = image.Metadata
|
||||
|
||||
// ServiceCreateResponse contains the information returned to a client
|
||||
// on the creation of a new service.
|
||||
//
|
||||
// Deprecated: use [swarm.ServiceCreateResponse].
|
||||
type ServiceCreateResponse = swarm.ServiceCreateResponse
|
||||
|
||||
// ServiceUpdateResponse service update response.
|
||||
//
|
||||
// Deprecated: use [swarm.ServiceUpdateResponse].
|
||||
type ServiceUpdateResponse = swarm.ServiceUpdateResponse
|
||||
|
||||
// ContainerStartOptions holds parameters to start containers.
|
||||
//
|
||||
// Deprecated: use [container.StartOptions].
|
||||
type ContainerStartOptions = container.StartOptions
|
||||
|
||||
// ResizeOptions holds parameters to resize a TTY.
|
||||
// It can be used to resize container TTYs and
|
||||
// exec process TTYs too.
|
||||
//
|
||||
// Deprecated: use [container.ResizeOptions].
|
||||
type ResizeOptions = container.ResizeOptions
|
||||
|
||||
// ContainerAttachOptions holds parameters to attach to a container.
|
||||
//
|
||||
// Deprecated: use [container.AttachOptions].
|
||||
type ContainerAttachOptions = container.AttachOptions
|
||||
|
||||
// ContainerCommitOptions holds parameters to commit changes into a container.
|
||||
//
|
||||
// Deprecated: use [container.CommitOptions].
|
||||
type ContainerCommitOptions = container.CommitOptions
|
||||
|
||||
// ContainerListOptions holds parameters to list containers with.
|
||||
//
|
||||
// Deprecated: use [container.ListOptions].
|
||||
type ContainerListOptions = container.ListOptions
|
||||
|
||||
// ContainerLogsOptions holds parameters to filter logs with.
|
||||
//
|
||||
// Deprecated: use [container.LogsOptions].
|
||||
type ContainerLogsOptions = container.LogsOptions
|
||||
|
||||
// ContainerRemoveOptions holds parameters to remove containers.
|
||||
//
|
||||
// Deprecated: use [container.RemoveOptions].
|
||||
type ContainerRemoveOptions = container.RemoveOptions
|
||||
|
||||
// DecodeSecurityOptions decodes a security options string slice to a type safe
|
||||
// [system.SecurityOpt].
|
||||
//
|
||||
// Deprecated: use [system.DecodeSecurityOptions].
|
||||
func DecodeSecurityOptions(opts []string) ([]system.SecurityOpt, error) {
|
||||
return system.DecodeSecurityOptions(opts)
|
||||
}
|
||||
// Deprecated: use [image.RemoveOptions].
|
||||
type ImageRemoveOptions = image.RemoveOptions
|
||||
|
14
vendor/github.com/docker/docker/api/types/versions/README.md
generated
vendored
14
vendor/github.com/docker/docker/api/types/versions/README.md
generated
vendored
@@ -1,14 +0,0 @@
|
||||
# Legacy API type versions
|
||||
|
||||
This package includes types for legacy API versions. The stable version of the API types live in `api/types/*.go`.
|
||||
|
||||
Consider moving a type here when you need to keep backwards compatibility in the API. This legacy types are organized by the latest API version they appear in. For instance, types in the `v1p19` package are valid for API versions below or equal `1.19`. Types in the `v1p20` package are valid for the API version `1.20`, since the versions below that will use the legacy types in `v1p19`.
|
||||
|
||||
## Package name conventions
|
||||
|
||||
The package name convention is to use `v` as a prefix for the version number and `p`(patch) as a separator. We use this nomenclature due to a few restrictions in the Go package name convention:
|
||||
|
||||
1. We cannot use `.` because it's interpreted by the language, think of `v1.20.CallFunction`.
|
||||
2. We cannot use `_` because golint complains about it. The code is actually valid, but it looks probably more weird: `v1_20.CallFunction`.
|
||||
|
||||
For instance, if you want to modify a type that was available in the version `1.21` of the API but it will have different fields in the version `1.22`, you want to create a new package under `api/types/versions/v1p21`.
|
8
vendor/github.com/docker/docker/client/distribution_inspect.go
generated
vendored
8
vendor/github.com/docker/docker/client/distribution_inspect.go
generated
vendored
@@ -10,11 +10,11 @@ import (
|
||||
)
|
||||
|
||||
// DistributionInspect returns the image digest with the full manifest.
|
||||
func (cli *Client) DistributionInspect(ctx context.Context, image, encodedRegistryAuth string) (registry.DistributionInspect, error) {
|
||||
func (cli *Client) DistributionInspect(ctx context.Context, imageRef, encodedRegistryAuth string) (registry.DistributionInspect, error) {
|
||||
// Contact the registry to retrieve digest and platform information
|
||||
var distributionInspect registry.DistributionInspect
|
||||
if image == "" {
|
||||
return distributionInspect, objectNotFoundError{object: "distribution", id: image}
|
||||
if imageRef == "" {
|
||||
return distributionInspect, objectNotFoundError{object: "distribution", id: imageRef}
|
||||
}
|
||||
|
||||
if err := cli.NewVersionError(ctx, "1.30", "distribution inspect"); err != nil {
|
||||
@@ -28,7 +28,7 @@ func (cli *Client) DistributionInspect(ctx context.Context, image, encodedRegist
|
||||
}
|
||||
}
|
||||
|
||||
resp, err := cli.get(ctx, "/distribution/"+image+"/json", url.Values{}, headers)
|
||||
resp, err := cli.get(ctx, "/distribution/"+imageRef+"/json", url.Values{}, headers)
|
||||
defer ensureReaderClosed(resp)
|
||||
if err != nil {
|
||||
return distributionInspect, err
|
||||
|
4
vendor/github.com/docker/docker/client/image_create.go
generated
vendored
4
vendor/github.com/docker/docker/client/image_create.go
generated
vendored
@@ -8,13 +8,13 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/distribution/reference"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/image"
|
||||
"github.com/docker/docker/api/types/registry"
|
||||
)
|
||||
|
||||
// ImageCreate creates a new image based on the parent options.
|
||||
// It returns the JSON content in the response body.
|
||||
func (cli *Client) ImageCreate(ctx context.Context, parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error) {
|
||||
func (cli *Client) ImageCreate(ctx context.Context, parentReference string, options image.CreateOptions) (io.ReadCloser, error) {
|
||||
ref, err := reference.ParseNormalizedNamed(parentReference)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
3
vendor/github.com/docker/docker/client/image_import.go
generated
vendored
3
vendor/github.com/docker/docker/client/image_import.go
generated
vendored
@@ -8,11 +8,12 @@ import (
|
||||
|
||||
"github.com/distribution/reference"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/image"
|
||||
)
|
||||
|
||||
// ImageImport creates a new image based on the source options.
|
||||
// It returns the JSON content in the response body.
|
||||
func (cli *Client) ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error) {
|
||||
func (cli *Client) ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error) {
|
||||
if ref != "" {
|
||||
// Check if the given image name can be resolved
|
||||
if _, err := reference.ParseNormalizedNamed(ref); err != nil {
|
||||
|
3
vendor/github.com/docker/docker/client/image_list.go
generated
vendored
3
vendor/github.com/docker/docker/client/image_list.go
generated
vendored
@@ -5,14 +5,13 @@ import (
|
||||
"encoding/json"
|
||||
"net/url"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/docker/docker/api/types/image"
|
||||
"github.com/docker/docker/api/types/versions"
|
||||
)
|
||||
|
||||
// ImageList returns a list of images in the docker host.
|
||||
func (cli *Client) ImageList(ctx context.Context, options types.ImageListOptions) ([]image.Summary, error) {
|
||||
func (cli *Client) ImageList(ctx context.Context, options image.ListOptions) ([]image.Summary, error) {
|
||||
// Make sure we negotiated (if the client is configured to do so),
|
||||
// as code below contains API-version specific handling of options.
|
||||
//
|
||||
|
4
vendor/github.com/docker/docker/client/image_pull.go
generated
vendored
4
vendor/github.com/docker/docker/client/image_pull.go
generated
vendored
@@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/distribution/reference"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/image"
|
||||
"github.com/docker/docker/errdefs"
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
// FIXME(vdemeester): there is currently used in a few way in docker/docker
|
||||
// - if not in trusted content, ref is used to pass the whole reference, and tag is empty
|
||||
// - if in trusted content, ref is used to pass the reference name, and tag for the digest
|
||||
func (cli *Client) ImagePull(ctx context.Context, refStr string, options types.ImagePullOptions) (io.ReadCloser, error) {
|
||||
func (cli *Client) ImagePull(ctx context.Context, refStr string, options image.PullOptions) (io.ReadCloser, error) {
|
||||
ref, err := reference.ParseNormalizedNamed(refStr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
4
vendor/github.com/docker/docker/client/image_push.go
generated
vendored
4
vendor/github.com/docker/docker/client/image_push.go
generated
vendored
@@ -8,7 +8,7 @@ import (
|
||||
"net/url"
|
||||
|
||||
"github.com/distribution/reference"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/image"
|
||||
"github.com/docker/docker/api/types/registry"
|
||||
"github.com/docker/docker/errdefs"
|
||||
)
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
// It executes the privileged function if the operation is unauthorized
|
||||
// and it tries one more time.
|
||||
// It's up to the caller to handle the io.ReadCloser and close it properly.
|
||||
func (cli *Client) ImagePush(ctx context.Context, image string, options types.ImagePushOptions) (io.ReadCloser, error) {
|
||||
func (cli *Client) ImagePush(ctx context.Context, image string, options image.PushOptions) (io.ReadCloser, error) {
|
||||
ref, err := reference.ParseNormalizedNamed(image)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
3
vendor/github.com/docker/docker/client/image_remove.go
generated
vendored
3
vendor/github.com/docker/docker/client/image_remove.go
generated
vendored
@@ -5,12 +5,11 @@ import (
|
||||
"encoding/json"
|
||||
"net/url"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/image"
|
||||
)
|
||||
|
||||
// ImageRemove removes an image from the docker host.
|
||||
func (cli *Client) ImageRemove(ctx context.Context, imageID string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error) {
|
||||
func (cli *Client) ImageRemove(ctx context.Context, imageID string, options image.RemoveOptions) ([]image.DeleteResponse, error) {
|
||||
query := url.Values{}
|
||||
|
||||
if options.Force {
|
||||
|
12
vendor/github.com/docker/docker/client/interface.go
generated
vendored
12
vendor/github.com/docker/docker/client/interface.go
generated
vendored
@@ -90,15 +90,15 @@ type ImageAPIClient interface {
|
||||
ImageBuild(ctx context.Context, context io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error)
|
||||
BuildCachePrune(ctx context.Context, opts types.BuildCachePruneOptions) (*types.BuildCachePruneReport, error)
|
||||
BuildCancel(ctx context.Context, id string) error
|
||||
ImageCreate(ctx context.Context, parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error)
|
||||
ImageCreate(ctx context.Context, parentReference string, options image.CreateOptions) (io.ReadCloser, error)
|
||||
ImageHistory(ctx context.Context, image string) ([]image.HistoryResponseItem, error)
|
||||
ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error)
|
||||
ImageImport(ctx context.Context, source types.ImageImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error)
|
||||
ImageInspectWithRaw(ctx context.Context, image string) (types.ImageInspect, []byte, error)
|
||||
ImageList(ctx context.Context, options types.ImageListOptions) ([]image.Summary, error)
|
||||
ImageList(ctx context.Context, options image.ListOptions) ([]image.Summary, error)
|
||||
ImageLoad(ctx context.Context, input io.Reader, quiet bool) (types.ImageLoadResponse, error)
|
||||
ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error)
|
||||
ImagePush(ctx context.Context, ref string, options types.ImagePushOptions) (io.ReadCloser, error)
|
||||
ImageRemove(ctx context.Context, image string, options types.ImageRemoveOptions) ([]image.DeleteResponse, error)
|
||||
ImagePull(ctx context.Context, ref string, options image.PullOptions) (io.ReadCloser, error)
|
||||
ImagePush(ctx context.Context, ref string, options image.PushOptions) (io.ReadCloser, error)
|
||||
ImageRemove(ctx context.Context, image string, options image.RemoveOptions) ([]image.DeleteResponse, error)
|
||||
ImageSearch(ctx context.Context, term string, options types.ImageSearchOptions) ([]registry.SearchResult, error)
|
||||
ImageSave(ctx context.Context, images []string) (io.ReadCloser, error)
|
||||
ImageTag(ctx context.Context, image, ref string) error
|
||||
|
54
vendor/github.com/docker/docker/image/spec/specs-go/v1/image.go
generated
vendored
54
vendor/github.com/docker/docker/image/spec/specs-go/v1/image.go
generated
vendored
@@ -1,54 +0,0 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
)
|
||||
|
||||
const DockerOCIImageMediaType = "application/vnd.docker.container.image.v1+json"
|
||||
|
||||
// DockerOCIImage is a ocispec.Image extended with Docker specific Config.
|
||||
type DockerOCIImage struct {
|
||||
ocispec.Image
|
||||
|
||||
// Shadow ocispec.Image.Config
|
||||
Config DockerOCIImageConfig `json:"config,omitempty"`
|
||||
}
|
||||
|
||||
// DockerOCIImageConfig is a ocispec.ImageConfig extended with Docker specific fields.
|
||||
type DockerOCIImageConfig struct {
|
||||
ocispec.ImageConfig
|
||||
|
||||
DockerOCIImageConfigExt
|
||||
}
|
||||
|
||||
// DockerOCIImageConfigExt contains Docker-specific fields in DockerImageConfig.
|
||||
type DockerOCIImageConfigExt struct {
|
||||
Healthcheck *HealthcheckConfig `json:",omitempty"` // Healthcheck describes how to check the container is healthy
|
||||
|
||||
OnBuild []string `json:",omitempty"` // ONBUILD metadata that were defined on the image Dockerfile
|
||||
Shell []string `json:",omitempty"` // Shell for shell-form of RUN, CMD, ENTRYPOINT
|
||||
}
|
||||
|
||||
// HealthcheckConfig holds configuration settings for the HEALTHCHECK feature.
|
||||
type HealthcheckConfig struct {
|
||||
// Test is the test to perform to check that the container is healthy.
|
||||
// An empty slice means to inherit the default.
|
||||
// The options are:
|
||||
// {} : inherit healthcheck
|
||||
// {"NONE"} : disable healthcheck
|
||||
// {"CMD", args...} : exec arguments directly
|
||||
// {"CMD-SHELL", command} : run command with system's default shell
|
||||
Test []string `json:",omitempty"`
|
||||
|
||||
// Zero means to inherit. Durations are expressed as integer nanoseconds.
|
||||
Interval time.Duration `json:",omitempty"` // Interval is the time to wait between checks.
|
||||
Timeout time.Duration `json:",omitempty"` // Timeout is the time to wait before considering the check to have hung.
|
||||
StartPeriod time.Duration `json:",omitempty"` // The start period for the container to initialize before the retries starts to count down.
|
||||
StartInterval time.Duration `json:",omitempty"` // The interval to attempt healthchecks at during the start period
|
||||
|
||||
// Retries is the number of consecutive failures needed to consider a container as unhealthy.
|
||||
// Zero means inherit.
|
||||
Retries int `json:",omitempty"`
|
||||
}
|
16
vendor/github.com/docker/docker/pkg/homedir/homedir.go
generated
vendored
16
vendor/github.com/docker/docker/pkg/homedir/homedir.go
generated
vendored
@@ -6,14 +6,6 @@ import (
|
||||
"runtime"
|
||||
)
|
||||
|
||||
// Key returns the env var name for the user's home dir based on
|
||||
// the platform being run on.
|
||||
//
|
||||
// Deprecated: this function is no longer used, and will be removed in the next release.
|
||||
func Key() string {
|
||||
return envKeyName
|
||||
}
|
||||
|
||||
// Get returns the home directory of the current user with the help of
|
||||
// environment variables depending on the target operating system.
|
||||
// Returned path should be used with "path/filepath" to form new paths.
|
||||
@@ -34,11 +26,3 @@ func Get() string {
|
||||
}
|
||||
return home
|
||||
}
|
||||
|
||||
// GetShortcutString returns the string that is shortcut to user's home directory
|
||||
// in the native shell of the platform running on.
|
||||
//
|
||||
// Deprecated: this function is no longer used, and will be removed in the next release.
|
||||
func GetShortcutString() string {
|
||||
return homeShortCut
|
||||
}
|
||||
|
8
vendor/github.com/docker/docker/pkg/homedir/homedir_unix.go
generated
vendored
8
vendor/github.com/docker/docker/pkg/homedir/homedir_unix.go
generated
vendored
@@ -1,8 +0,0 @@
|
||||
//go:build !windows
|
||||
|
||||
package homedir // import "github.com/docker/docker/pkg/homedir"
|
||||
|
||||
const (
|
||||
envKeyName = "HOME"
|
||||
homeShortCut = "~"
|
||||
)
|
6
vendor/github.com/docker/docker/pkg/homedir/homedir_windows.go
generated
vendored
6
vendor/github.com/docker/docker/pkg/homedir/homedir_windows.go
generated
vendored
@@ -1,6 +0,0 @@
|
||||
package homedir // import "github.com/docker/docker/pkg/homedir"
|
||||
|
||||
const (
|
||||
envKeyName = "USERPROFILE"
|
||||
homeShortCut = "%USERPROFILE%" // be careful while using in format functions
|
||||
)
|
19
vendor/github.com/docker/docker/pkg/system/image_os_deprecated.go
generated
vendored
19
vendor/github.com/docker/docker/pkg/system/image_os_deprecated.go
generated
vendored
@@ -1,19 +0,0 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"runtime"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// ErrNotSupportedOperatingSystem means the operating system is not supported.
|
||||
//
|
||||
// Deprecated: use [github.com/docker/docker/image.CheckOS] and check the error returned.
|
||||
var ErrNotSupportedOperatingSystem = errors.New("operating system is not supported")
|
||||
|
||||
// IsOSSupported determines if an operating system is supported by the host.
|
||||
//
|
||||
// Deprecated: use [github.com/docker/docker/image.CheckOS] and check the error returned.
|
||||
func IsOSSupported(os string) bool {
|
||||
return strings.EqualFold(runtime.GOOS, os)
|
||||
}
|
2
vendor/github.com/moby/buildkit/util/system/path.go
generated
vendored
2
vendor/github.com/moby/buildkit/util/system/path.go
generated
vendored
@@ -27,7 +27,7 @@ func DefaultPathEnv(os string) string {
|
||||
|
||||
// NormalizePath cleans the path based on the operating system the path is meant for.
|
||||
// It takes into account a potential parent path, and will join the path to the parent
|
||||
// if the path is relative. Additionally, it will apply the folliwing rules:
|
||||
// if the path is relative. Additionally, it will apply the following rules:
|
||||
// - always return an absolute path
|
||||
// - always strip drive letters for Windows paths
|
||||
// - optionally keep the trailing slashes on paths
|
||||
|
17
vendor/github.com/tonistiigi/fsutil/send.go
generated
vendored
17
vendor/github.com/tonistiigi/fsutil/send.go
generated
vendored
@@ -43,13 +43,14 @@ type sendHandle struct {
|
||||
}
|
||||
|
||||
type sender struct {
|
||||
conn Stream
|
||||
fs FS
|
||||
files map[uint32]string
|
||||
mu sync.RWMutex
|
||||
progressCb func(int, bool)
|
||||
progressCurrent int
|
||||
sendpipeline chan *sendHandle
|
||||
conn Stream
|
||||
fs FS
|
||||
files map[uint32]string
|
||||
mu sync.RWMutex
|
||||
progressCb func(int, bool)
|
||||
progressCurrent int
|
||||
progressCurrentMu sync.Mutex
|
||||
sendpipeline chan *sendHandle
|
||||
}
|
||||
|
||||
func (s *sender) run(ctx context.Context) error {
|
||||
@@ -112,6 +113,8 @@ func (s *sender) run(ctx context.Context) error {
|
||||
|
||||
func (s *sender) updateProgress(size int, last bool) {
|
||||
if s.progressCb != nil {
|
||||
s.progressCurrentMu.Lock()
|
||||
defer s.progressCurrentMu.Unlock()
|
||||
s.progressCurrent += size
|
||||
s.progressCb(s.progressCurrent, last)
|
||||
}
|
||||
|
9
vendor/modules.txt
vendored
9
vendor/modules.txt
vendored
@@ -215,7 +215,7 @@ github.com/davecgh/go-spew/spew
|
||||
# github.com/distribution/reference v0.5.0
|
||||
## explicit; go 1.20
|
||||
github.com/distribution/reference
|
||||
# github.com/docker/cli v25.0.3+incompatible
|
||||
# github.com/docker/cli v26.0.0-rc1+incompatible
|
||||
## explicit
|
||||
github.com/docker/cli/cli
|
||||
github.com/docker/cli/cli-plugins/manager
|
||||
@@ -268,7 +268,7 @@ github.com/docker/distribution/registry/client/transport
|
||||
github.com/docker/distribution/registry/storage/cache
|
||||
github.com/docker/distribution/registry/storage/cache/memory
|
||||
github.com/docker/distribution/uuid
|
||||
# github.com/docker/docker v25.0.3+incompatible
|
||||
# github.com/docker/docker v26.0.0-rc1+incompatible
|
||||
## explicit
|
||||
github.com/docker/docker/api
|
||||
github.com/docker/docker/api/types
|
||||
@@ -291,7 +291,6 @@ github.com/docker/docker/api/types/volume
|
||||
github.com/docker/docker/builder/remotecontext/urlutil
|
||||
github.com/docker/docker/client
|
||||
github.com/docker/docker/errdefs
|
||||
github.com/docker/docker/image/spec/specs-go/v1
|
||||
github.com/docker/docker/internal/multierror
|
||||
github.com/docker/docker/pkg/archive
|
||||
github.com/docker/docker/pkg/homedir
|
||||
@@ -513,7 +512,7 @@ github.com/mitchellh/mapstructure
|
||||
# github.com/mitchellh/reflectwalk v1.0.2
|
||||
## explicit
|
||||
github.com/mitchellh/reflectwalk
|
||||
# github.com/moby/buildkit v0.13.0-rc3
|
||||
# github.com/moby/buildkit v0.13.0
|
||||
## explicit; go 1.21
|
||||
github.com/moby/buildkit/api/services/control
|
||||
github.com/moby/buildkit/api/types
|
||||
@@ -707,7 +706,7 @@ github.com/theupdateframework/notary/tuf/data
|
||||
github.com/theupdateframework/notary/tuf/signed
|
||||
github.com/theupdateframework/notary/tuf/utils
|
||||
github.com/theupdateframework/notary/tuf/validation
|
||||
# github.com/tonistiigi/fsutil v0.0.0-20240223190444-7a889f53dbf6
|
||||
# github.com/tonistiigi/fsutil v0.0.0-20240301111122-7525a1af2bb5
|
||||
## explicit; go 1.20
|
||||
github.com/tonistiigi/fsutil
|
||||
github.com/tonistiigi/fsutil/types
|
||||
|
Reference in New Issue
Block a user