mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Compare commits
13 Commits
fbf3ed25f8
...
08440b6ee8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
08440b6ee8 | ||
|
|
b0e62060b0 | ||
|
|
515dbc8c71 | ||
|
|
adf3073cb6 | ||
|
|
8b2c317218 | ||
|
|
3eca177282 | ||
|
|
c4f4c6765e | ||
|
|
f942bce11a | ||
|
|
a1f7fff7a9 | ||
|
|
0e600c7fc4 | ||
|
|
734bb626e4 | ||
|
|
5eaae6db52 | ||
|
|
8ebb104e36 |
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
"github.com/moby/go-archive"
|
||||
"github.com/moby/go-archive/chrootarchive"
|
||||
"github.com/moby/go-archive/compression"
|
||||
containertypes "github.com/moby/moby/api/types/container"
|
||||
"github.com/moby/moby/api/types/events"
|
||||
"github.com/moby/moby/v2/daemon/container"
|
||||
@@ -278,7 +279,7 @@ func (daemon *Daemon) containerCopy(container *container.Container, resource str
|
||||
filter = []string{f}
|
||||
}
|
||||
archv, err := chrootarchive.Tar(basePath, &archive.TarOptions{
|
||||
Compression: archive.Uncompressed,
|
||||
Compression: compression.None,
|
||||
IncludeFiles: filter,
|
||||
}, container.BaseFS)
|
||||
if err != nil {
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
|
||||
"github.com/moby/buildkit/frontend/dockerfile/instructions"
|
||||
"github.com/moby/go-archive"
|
||||
"github.com/moby/go-archive/compression"
|
||||
"github.com/moby/moby/v2/daemon/builder/remotecontext"
|
||||
"github.com/moby/sys/reexec"
|
||||
"gotest.tools/v3/assert"
|
||||
@@ -105,7 +106,7 @@ func TestDispatch(t *testing.T) {
|
||||
createTestTempFile(t, contextDir, filename, content, 0o777)
|
||||
}
|
||||
|
||||
tarStream, err := archive.Tar(contextDir, archive.Uncompressed)
|
||||
tarStream, err := archive.Tar(contextDir, compression.None)
|
||||
if err != nil {
|
||||
t.Fatalf("Error when creating tar stream: %s", err)
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/moby/go-archive"
|
||||
"github.com/moby/go-archive/compression"
|
||||
"github.com/moby/moby/api/types/container"
|
||||
"github.com/moby/moby/api/types/network"
|
||||
"github.com/moby/moby/v2/daemon/builder"
|
||||
@@ -61,7 +62,7 @@ func readAndCheckDockerfile(t *testing.T, testName, contextDir, dockerfilePath,
|
||||
if runtime.GOOS != "windows" {
|
||||
skip.If(t, os.Getuid() != 0, "skipping test that requires root")
|
||||
}
|
||||
tarStream, err := archive.Tar(contextDir, archive.Uncompressed)
|
||||
tarStream, err := archive.Tar(contextDir, compression.None)
|
||||
assert.NilError(t, err)
|
||||
|
||||
defer func() {
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
"github.com/containerd/log"
|
||||
"github.com/moby/go-archive"
|
||||
"github.com/moby/go-archive/compression"
|
||||
"github.com/moby/moby/v2/daemon/builder"
|
||||
"github.com/moby/moby/v2/daemon/builder/remotecontext/git"
|
||||
)
|
||||
@@ -17,7 +18,7 @@ func MakeGitContext(gitURL string) (builder.Source, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
c, err := archive.Tar(root, archive.Uncompressed)
|
||||
c, err := archive.Tar(root, compression.None)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/moby/go-archive"
|
||||
"github.com/moby/go-archive/compression"
|
||||
"github.com/moby/moby/v2/daemon/builder"
|
||||
"github.com/moby/sys/reexec"
|
||||
"github.com/pkg/errors"
|
||||
@@ -128,7 +129,7 @@ func TestRemoveDirectory(t *testing.T) {
|
||||
|
||||
func makeTestArchiveContext(t *testing.T, dir string) builder.Source {
|
||||
skip.If(t, os.Getuid() != 0, "skipping test that requires root")
|
||||
tarStream, err := archive.Tar(dir, archive.Uncompressed)
|
||||
tarStream, err := archive.Tar(dir, compression.None)
|
||||
if err != nil {
|
||||
t.Fatalf("error: %s", err)
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
cerrdefs "github.com/containerd/errdefs"
|
||||
"github.com/containerd/platforms"
|
||||
"github.com/moby/go-archive"
|
||||
"github.com/moby/go-archive/compression"
|
||||
"github.com/moby/moby/v2/daemon/server/imagebackend"
|
||||
"github.com/moby/moby/v2/internal/testutil/labelstore"
|
||||
"github.com/moby/moby/v2/internal/testutil/specialimage"
|
||||
@@ -39,7 +40,7 @@ func TestImageLoad(t *testing.T) {
|
||||
imgSvc.defaultPlatformOverride = platforms.Only(linuxAmd64)
|
||||
|
||||
tryLoad := func(ctx context.Context, t *testing.T, dir string, platformList []ocispec.Platform) error {
|
||||
tarRc, err := archive.Tar(dir, archive.Uncompressed)
|
||||
tarRc, err := archive.Tar(dir, compression.None)
|
||||
assert.NilError(t, err)
|
||||
defer tarRc.Close()
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/containerd/log"
|
||||
"github.com/moby/go-archive"
|
||||
"github.com/moby/go-archive/chrootarchive"
|
||||
"github.com/moby/go-archive/compression"
|
||||
"github.com/moby/moby/api/types/events"
|
||||
"github.com/moby/moby/v2/daemon/container"
|
||||
"github.com/moby/moby/v2/errdefs"
|
||||
@@ -65,7 +66,7 @@ func (daemon *Daemon) containerExport(ctx context.Context, ctr *container.Contai
|
||||
}()
|
||||
|
||||
archv, err := chrootarchive.Tar(basefs, &archive.TarOptions{
|
||||
Compression: archive.Uncompressed,
|
||||
Compression: compression.None,
|
||||
IDMap: daemon.idMapping,
|
||||
}, basefs)
|
||||
if err != nil {
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/containerd/log"
|
||||
"github.com/moby/go-archive"
|
||||
"github.com/moby/go-archive/chrootarchive"
|
||||
"github.com/moby/go-archive/compression"
|
||||
"github.com/moby/moby/v2/pkg/ioutils"
|
||||
"github.com/moby/sys/user"
|
||||
)
|
||||
@@ -64,7 +65,7 @@ func (gdw *NaiveDiffDriver) Diff(id, parent string) (arch io.ReadCloser, retErr
|
||||
}()
|
||||
|
||||
if parent == "" {
|
||||
tarArchive, err := archive.Tar(layerFs, archive.Uncompressed)
|
||||
tarArchive, err := archive.Tar(layerFs, compression.None)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import (
|
||||
"github.com/docker/go-units"
|
||||
"github.com/moby/go-archive"
|
||||
"github.com/moby/go-archive/chrootarchive"
|
||||
"github.com/moby/go-archive/compression"
|
||||
"github.com/moby/locker"
|
||||
"github.com/moby/moby/v2/daemon/graphdriver"
|
||||
"github.com/moby/moby/v2/daemon/graphdriver/overlayutils"
|
||||
@@ -721,7 +722,7 @@ func (d *Driver) Diff(id, parent string) (io.ReadCloser, error) {
|
||||
diffPath := d.getDiffPath(id)
|
||||
logger.Debugf("Tar with options on %s", diffPath)
|
||||
return archive.TarWithOptions(diffPath, &archive.TarOptions{
|
||||
Compression: archive.Uncompressed,
|
||||
Compression: compression.None,
|
||||
IDMap: d.idMap,
|
||||
WhiteoutFormat: archive.OverlayWhiteoutFormat,
|
||||
})
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
"github.com/distribution/reference"
|
||||
"github.com/docker/distribution"
|
||||
"github.com/moby/go-archive"
|
||||
"github.com/moby/go-archive/compression"
|
||||
"github.com/moby/moby/api/types/events"
|
||||
"github.com/moby/moby/v2/daemon/internal/image"
|
||||
v1 "github.com/moby/moby/v2/daemon/internal/image/v1"
|
||||
@@ -395,7 +396,7 @@ func (s *saveSession) writeTar(ctx context.Context, tempDir string, outStream io
|
||||
ctx, span := tracing.StartSpan(ctx, "writeTar")
|
||||
defer span.End()
|
||||
|
||||
fs, err := archive.Tar(tempDir, archive.Uncompressed)
|
||||
fs, err := archive.Tar(tempDir, compression.None)
|
||||
if err != nil {
|
||||
span.SetStatus(err)
|
||||
return err
|
||||
|
||||
@@ -535,6 +535,9 @@ func (ls *layerStore) CreateRWLayer(name string, parent ChainID, opts *CreateRWL
|
||||
return nil, err
|
||||
}
|
||||
if err := ls.saveMount(m); err != nil {
|
||||
if removeErr := ls.driver.Remove(m.mountID); removeErr != nil {
|
||||
log.G(context.TODO()).WithFields(log.Fields{"mount-id": m.mountID, "error": removeErr}).Error("Failed to clean up RW layer after mount save failure")
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -645,7 +648,7 @@ func (ls *layerStore) saveMount(mount *mountedLayer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ls *layerStore) initMount(graphID, parent, mountLabel string, initFunc MountInit, storageOpt map[string]string) (string, error) {
|
||||
func (ls *layerStore) initMount(graphID, parent, mountLabel string, initFunc MountInit, storageOpt map[string]string) (_ string, retErr error) {
|
||||
// Use "<graph-id>-init" to maintain compatibility with graph drivers
|
||||
// which are expecting this layer with this special name. If all
|
||||
// graph drivers can be updated to not rely on knowing about this layer
|
||||
@@ -660,6 +663,16 @@ func (ls *layerStore) initMount(graphID, parent, mountLabel string, initFunc Mou
|
||||
if err := ls.driver.CreateReadWrite(initID, parent, createOpts); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// Clean up init layer if any subsequent operation fails
|
||||
defer func() {
|
||||
if retErr != nil {
|
||||
if err := ls.driver.Remove(initID); err != nil {
|
||||
log.G(context.TODO()).WithFields(log.Fields{"init-id": initID, "error": err}).Error("Failed to clean up init layer after error")
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
p, err := ls.driver.Get(initID, "")
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
|
||||
"github.com/containerd/continuity/driver"
|
||||
"github.com/moby/go-archive"
|
||||
"github.com/moby/go-archive/compression"
|
||||
"github.com/moby/moby/v2/daemon/graphdriver"
|
||||
"github.com/moby/moby/v2/daemon/graphdriver/vfs"
|
||||
"github.com/moby/moby/v2/daemon/internal/stringid"
|
||||
@@ -587,7 +588,7 @@ func tarFromFiles(files ...FileApplier) ([]byte, error) {
|
||||
}
|
||||
}
|
||||
|
||||
r, err := archive.Tar(td, archive.Uncompressed)
|
||||
r, err := archive.Tar(td, compression.None)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -251,9 +251,14 @@ func deleteEpFromResolverImpl(
|
||||
}
|
||||
|
||||
func findHNSEp(ip4, ip6 *net.IPNet, hnsEndpoints []hcsshim.HNSEndpoint) *hcsshim.HNSEndpoint {
|
||||
if ip4 == nil && ip6 == nil {
|
||||
return nil
|
||||
}
|
||||
for _, hnsEp := range hnsEndpoints {
|
||||
if (hnsEp.IPAddress != nil && hnsEp.IPAddress.Equal(ip4.IP)) ||
|
||||
(hnsEp.IPv6Address != nil && hnsEp.IPv6Address.Equal(ip6.IP)) {
|
||||
if ip4 != nil && hnsEp.IPAddress != nil && hnsEp.IPAddress.Equal(ip4.IP) {
|
||||
return &hnsEp
|
||||
}
|
||||
if ip6 != nil && hnsEp.IPv6Address != nil && hnsEp.IPv6Address.Equal(ip6.IP) {
|
||||
return &hnsEp
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package daemon
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -259,10 +260,11 @@ func (daemon *Daemon) registerMountPoints(ctr *container.Container, defaultReadO
|
||||
StorageOpt: ctr.HostConfig.StorageOpt,
|
||||
}
|
||||
|
||||
// Include the destination in the layer name to make it unique for each mount point and container.
|
||||
// Hash the source and destination to create a safe, unique identifier for each mount point and container.
|
||||
// This makes sure that the same image can be mounted multiple times with different destinations.
|
||||
// Hex encode the destination to create a safe, unique identifier
|
||||
layerName := hex.EncodeToString([]byte(ctr.ID + ",src=" + mp.Source + ",dst=" + mp.Destination))
|
||||
// We hash it so that the snapshot name is friendly to the underlying filesystem and doesn't exceed path length limits.
|
||||
destHash := sha256.Sum256([]byte(ctr.ID + "-src=" + mp.Source + "-dst=" + mp.Destination))
|
||||
layerName := hex.EncodeToString(destHash[:])
|
||||
layer, err := daemon.imageService.CreateLayerFromImage(img, layerName, rwLayerOpts)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
2
go.mod
2
go.mod
@@ -56,7 +56,7 @@ require (
|
||||
github.com/miekg/dns v1.1.66
|
||||
github.com/mistifyio/go-zfs/v3 v3.1.0
|
||||
github.com/mitchellh/copystructure v1.2.0
|
||||
github.com/moby/buildkit v0.26.2
|
||||
github.com/moby/buildkit v0.26.3
|
||||
github.com/moby/docker-image-spec v1.3.1
|
||||
github.com/moby/go-archive v0.1.0
|
||||
github.com/moby/ipvs v1.1.0
|
||||
|
||||
4
go.sum
4
go.sum
@@ -417,8 +417,8 @@ github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:F
|
||||
github.com/mitchellh/mapstructure v0.0.0-20170523030023-d0303fe80992/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
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.26.2 h1:EIh5j0gzRsCZmQzvgNNWzSDbuKqwUIiBH7ssqLv8RU8=
|
||||
github.com/moby/buildkit v0.26.2/go.mod h1:ylDa7IqzVJgLdi/wO7H1qLREFQpmhFbw2fbn4yoTw40=
|
||||
github.com/moby/buildkit v0.26.3 h1:D+ruZVAk/3ipRq5XRxBH9/DIFpRjSlTtMbghT5gQP9g=
|
||||
github.com/moby/buildkit v0.26.3/go.mod h1:4T4wJzQS4kYWIfFRjsbJry4QoxDBjK+UGOEOs1izL7w=
|
||||
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/go-archive v0.1.0 h1:Kk/5rdW/g+H8NHdJW2gsXyZ7UnzvJNOy6VKJqueWdcQ=
|
||||
|
||||
@@ -2024,11 +2024,11 @@ CMD ["cat", "/foo"]`),
|
||||
}
|
||||
|
||||
func (s *DockerCLIBuildSuite) TestBuildContextTarGzip(c *testing.T) {
|
||||
testContextTar(c, archive.Gzip)
|
||||
testContextTar(c, compression.Gzip)
|
||||
}
|
||||
|
||||
func (s *DockerCLIBuildSuite) TestBuildContextTarNoCompression(c *testing.T) {
|
||||
testContextTar(c, archive.Uncompressed)
|
||||
testContextTar(c, compression.None)
|
||||
}
|
||||
|
||||
func (s *DockerCLIBuildSuite) TestBuildNoContext(c *testing.T) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/moby/go-archive"
|
||||
"github.com/moby/go-archive/compression"
|
||||
"github.com/moby/moby/api/types/events"
|
||||
plugintypes "github.com/moby/moby/api/types/plugin"
|
||||
"github.com/moby/moby/api/types/registry"
|
||||
@@ -209,7 +210,7 @@ func makePluginBundle(inPath string, opts ...CreateOpt) (io.ReadCloser, error) {
|
||||
if err := archive.NewDefaultArchiver().CopyFileWithTar(cfg.binPath, filepath.Join(inPath, "rootfs", p.Entrypoint[0])); err != nil {
|
||||
return nil, errors.Wrap(err, "error copying plugin binary to rootfs path")
|
||||
}
|
||||
tar, err := archive.Tar(inPath, archive.Uncompressed)
|
||||
tar, err := archive.Tar(inPath, compression.None)
|
||||
return tar, errors.Wrap(err, "error making plugin archive")
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/distribution/reference"
|
||||
"github.com/google/uuid"
|
||||
"github.com/moby/go-archive"
|
||||
"github.com/moby/go-archive/compression"
|
||||
"github.com/opencontainers/go-digest"
|
||||
"github.com/opencontainers/image-spec/specs-go"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
@@ -137,7 +138,7 @@ func fileArchive(dir string, name string, content []byte) (io.ReadCloser, error)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return archive.Tar(tmp, archive.Uncompressed)
|
||||
return archive.Tar(tmp, compression.None)
|
||||
}
|
||||
|
||||
func writeLayerWithOneFile(dir string, filename string, content []byte) (ocispec.Descriptor, error) {
|
||||
|
||||
77
vendor/github.com/moby/buildkit/frontend/gateway/gateway.go
generated
vendored
77
vendor/github.com/moby/buildkit/frontend/gateway/gateway.go
generated
vendored
@@ -653,43 +653,7 @@ func (lbf *llbBridgeForwarder) ResolveSourceMeta(ctx context.Context, req *pb.Re
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
r := &pb.ResolveSourceMetaResponse{
|
||||
Source: resp.Op,
|
||||
}
|
||||
|
||||
if resp.Image != nil {
|
||||
r.Image = &pb.ResolveSourceImageResponse{
|
||||
Digest: string(resp.Image.Digest),
|
||||
Config: resp.Image.Config,
|
||||
}
|
||||
if resp.Image.AttestationChain != nil {
|
||||
r.Image.AttestationChain = toPBAttestationChain(resp.Image.AttestationChain)
|
||||
}
|
||||
}
|
||||
if resp.Git != nil {
|
||||
r.Git = &pb.ResolveSourceGitResponse{
|
||||
Checksum: resp.Git.Checksum,
|
||||
Ref: resp.Git.Ref,
|
||||
CommitChecksum: resp.Git.CommitChecksum,
|
||||
CommitObject: resp.Git.CommitObject,
|
||||
TagObject: resp.Git.TagObject,
|
||||
}
|
||||
}
|
||||
if resp.HTTP != nil {
|
||||
var lastModified *timestamp.Timestamp
|
||||
if resp.HTTP.LastModified != nil {
|
||||
lastModified = ×tamp.Timestamp{
|
||||
Seconds: resp.HTTP.LastModified.Unix(),
|
||||
}
|
||||
}
|
||||
r.HTTP = &pb.ResolveSourceHTTPResponse{
|
||||
Checksum: resp.HTTP.Digest.String(),
|
||||
Filename: resp.HTTP.Filename,
|
||||
LastModified: lastModified,
|
||||
}
|
||||
}
|
||||
return r, nil
|
||||
return ToPBResolveSourceMetaResponse(resp), nil
|
||||
}
|
||||
|
||||
func (lbf *llbBridgeForwarder) ResolveImageConfig(ctx context.Context, req *pb.ResolveImageConfigRequest) (*pb.ResolveImageConfigResponse, error) {
|
||||
@@ -1705,6 +1669,45 @@ func getCaps(label string) map[string]struct{} {
|
||||
return out
|
||||
}
|
||||
|
||||
func ToPBResolveSourceMetaResponse(in *sourceresolver.MetaResponse) *pb.ResolveSourceMetaResponse {
|
||||
r := &pb.ResolveSourceMetaResponse{
|
||||
Source: in.Op,
|
||||
}
|
||||
|
||||
if in.Image != nil {
|
||||
r.Image = &pb.ResolveSourceImageResponse{
|
||||
Digest: string(in.Image.Digest),
|
||||
Config: in.Image.Config,
|
||||
}
|
||||
if in.Image.AttestationChain != nil {
|
||||
r.Image.AttestationChain = toPBAttestationChain(in.Image.AttestationChain)
|
||||
}
|
||||
}
|
||||
if in.Git != nil {
|
||||
r.Git = &pb.ResolveSourceGitResponse{
|
||||
Checksum: in.Git.Checksum,
|
||||
Ref: in.Git.Ref,
|
||||
CommitChecksum: in.Git.CommitChecksum,
|
||||
CommitObject: in.Git.CommitObject,
|
||||
TagObject: in.Git.TagObject,
|
||||
}
|
||||
}
|
||||
if in.HTTP != nil {
|
||||
var lastModified *timestamp.Timestamp
|
||||
if in.HTTP.LastModified != nil {
|
||||
lastModified = ×tamp.Timestamp{
|
||||
Seconds: in.HTTP.LastModified.Unix(),
|
||||
}
|
||||
}
|
||||
r.HTTP = &pb.ResolveSourceHTTPResponse{
|
||||
Checksum: in.HTTP.Digest.String(),
|
||||
Filename: in.HTTP.Filename,
|
||||
LastModified: lastModified,
|
||||
}
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
func toPBAttestationChain(ac *sourceresolver.AttestationChain) *pb.AttestationChain {
|
||||
if ac == nil {
|
||||
return nil
|
||||
|
||||
26
vendor/github.com/moby/buildkit/solver/llbsolver/policy.go
generated
vendored
26
vendor/github.com/moby/buildkit/solver/llbsolver/policy.go
generated
vendored
@@ -5,6 +5,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/moby/buildkit/client/llb/sourceresolver"
|
||||
"github.com/moby/buildkit/frontend/gateway"
|
||||
gatewaypb "github.com/moby/buildkit/frontend/gateway/pb"
|
||||
"github.com/moby/buildkit/solver/pb"
|
||||
"github.com/moby/buildkit/sourcepolicy"
|
||||
@@ -88,19 +89,26 @@ func (p *policyEvaluator) Evaluate(ctx context.Context, op *pb.Op) (bool, error)
|
||||
Platform: toOCIPlatform(metareq.Platform),
|
||||
}
|
||||
}
|
||||
|
||||
if metareq.Image != nil {
|
||||
if op.ImageOpt == nil {
|
||||
op.ImageOpt = &sourceresolver.ResolveImageOpt{}
|
||||
}
|
||||
op.ImageOpt.NoConfig = metareq.Image.NoConfig
|
||||
op.ImageOpt.AttestationChain = metareq.Image.AttestationChain
|
||||
}
|
||||
|
||||
if metareq.Git != nil {
|
||||
op.GitOpt = &sourceresolver.ResolveGitOpt{
|
||||
ReturnObject: metareq.Git.ReturnObject,
|
||||
}
|
||||
}
|
||||
|
||||
resp, err := p.resolveSourceMetadata(ctx, metareq.Source, op, false)
|
||||
if err != nil {
|
||||
return false, errors.Wrap(err, "error resolving source metadata from policy request")
|
||||
}
|
||||
req.Source = &gatewaypb.ResolveSourceMetaResponse{
|
||||
Source: resp.Op,
|
||||
}
|
||||
if resp.Image != nil {
|
||||
req.Source.Image = &gatewaypb.ResolveSourceImageResponse{
|
||||
Digest: resp.Image.Digest.String(),
|
||||
Config: resp.Image.Config,
|
||||
}
|
||||
}
|
||||
req.Source = gateway.ToPBResolveSourceMetaResponse(resp)
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@@ -838,7 +838,7 @@ github.com/mitchellh/hashstructure/v2
|
||||
# github.com/mitchellh/reflectwalk v1.0.2
|
||||
## explicit
|
||||
github.com/mitchellh/reflectwalk
|
||||
# github.com/moby/buildkit v0.26.2
|
||||
# github.com/moby/buildkit v0.26.3
|
||||
## explicit; go 1.24.3
|
||||
github.com/moby/buildkit/api/services/control
|
||||
github.com/moby/buildkit/api/types
|
||||
|
||||
Reference in New Issue
Block a user