Skip to content

Commit 129ab99

Browse files
authored
Merge pull request docker#6011 from thaJeztah/bump_archive
vendor: github.com/moby/go-archive v0.1.0
2 parents 59a723b + e7a091e commit 129ab99

File tree

24 files changed

+573
-469
lines changed

24 files changed

+573
-469
lines changed

cli/command/container/cp_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/docker/cli/internal/test"
1212
"github.com/docker/docker/api/types/container"
1313
"github.com/moby/go-archive"
14+
"github.com/moby/go-archive/compression"
1415
"gotest.tools/v3/assert"
1516
is "gotest.tools/v3/assert/cmp"
1617
"gotest.tools/v3/fs"
@@ -74,7 +75,7 @@ func TestRunCopyFromContainerToFilesystem(t *testing.T) {
7475
cli := test.NewFakeCli(&fakeClient{
7576
containerCopyFromFunc: func(ctr, srcPath string) (io.ReadCloser, container.PathStat, error) {
7677
assert.Check(t, is.Equal("container", ctr))
77-
readCloser, err := archive.Tar(srcDir.Path(), archive.Uncompressed)
78+
readCloser, err := archive.Tar(srcDir.Path(), compression.None)
7879
return readCloser, container.PathStat{}, err
7980
},
8081
})

cli/command/image/build/context.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"github.com/docker/docker/pkg/streamformatter"
2121
"github.com/docker/docker/pkg/stringid"
2222
"github.com/moby/go-archive"
23+
"github.com/moby/go-archive/compression"
2324
"github.com/moby/patternmatcher"
2425
"github.com/pkg/errors"
2526
)
@@ -163,7 +164,7 @@ func GetContextFromReader(rc io.ReadCloser, dockerfileName string) (out io.ReadC
163164
return nil, "", err
164165
}
165166

166-
tarArchive, err := archive.Tar(dockerfileDir, archive.Uncompressed)
167+
tarArchive, err := archive.Tar(dockerfileDir, compression.None)
167168
if err != nil {
168169
return nil, "", err
169170
}
@@ -178,8 +179,7 @@ func GetContextFromReader(rc io.ReadCloser, dockerfileName string) (out io.ReadC
178179
// IsArchive checks for the magic bytes of a tar or any supported compression
179180
// algorithm.
180181
func IsArchive(header []byte) bool {
181-
compression := archive.DetectCompression(header)
182-
if compression != archive.Uncompressed {
182+
if compression.Detect(header) != compression.None {
183183
return true
184184
}
185185
r := tar.NewReader(bytes.NewBuffer(header))
@@ -427,7 +427,7 @@ func Compress(buildCtx io.ReadCloser) (io.ReadCloser, error) {
427427
pipeReader, pipeWriter := io.Pipe()
428428

429429
go func() {
430-
compressWriter, err := archive.CompressStream(pipeWriter, archive.Gzip)
430+
compressWriter, err := compression.CompressStream(pipeWriter, archive.Gzip)
431431
if err != nil {
432432
pipeWriter.CloseWithError(err)
433433
}

cli/command/image/build/context_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"testing"
1212

1313
"github.com/moby/go-archive"
14+
"github.com/moby/go-archive/compression"
1415
"github.com/moby/patternmatcher"
1516
"gotest.tools/v3/assert"
1617
is "gotest.tools/v3/assert/cmp"
@@ -165,7 +166,7 @@ func TestGetContextFromReaderTar(t *testing.T) {
165166
contextDir := createTestTempDir(t)
166167
createTestTempFile(t, contextDir, DefaultDockerfileName, dockerfileContents)
167168

168-
tarStream, err := archive.Tar(contextDir, archive.Uncompressed)
169+
tarStream, err := archive.Tar(contextDir, compression.None)
169170
assert.NilError(t, err)
170171

171172
tarArchive, relDockerfile, err := GetContextFromReader(tarStream, DefaultDockerfileName)

cli/command/image/build_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"github.com/docker/cli/internal/test"
1616
"github.com/docker/docker/api/types"
1717
"github.com/google/go-cmp/cmp"
18-
"github.com/moby/go-archive"
18+
"github.com/moby/go-archive/compression"
1919
"gotest.tools/v3/assert"
2020
"gotest.tools/v3/fs"
2121
"gotest.tools/v3/skip"
@@ -54,7 +54,7 @@ func TestRunBuildDockerfileFromStdinWithCompress(t *testing.T) {
5454
assert.DeepEqual(t, expected, fakeBuild.filenames(t))
5555

5656
header := buffer.Bytes()[:10]
57-
assert.Equal(t, archive.Gzip, archive.DetectCompression(header))
57+
assert.Equal(t, compression.Gzip, compression.Detect(header))
5858
}
5959

6060
func TestRunBuildResetsUidAndGidInContext(t *testing.T) {

cli/command/plugin/create.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/docker/cli/cli/command/completion"
1414
"github.com/docker/docker/api/types"
1515
"github.com/moby/go-archive"
16+
"github.com/moby/go-archive/compression"
1617
"github.com/pkg/errors"
1718
"github.com/sirupsen/logrus"
1819
"github.com/spf13/cobra"
@@ -99,14 +100,14 @@ func runCreate(ctx context.Context, dockerCli command.Cli, options pluginCreateO
99100
return err
100101
}
101102

102-
compression := archive.Uncompressed
103+
comp := compression.None
103104
if options.compress {
104105
logrus.Debugf("compression enabled")
105-
compression = archive.Gzip
106+
comp = compression.Gzip
106107
}
107108

108109
createCtx, err := archive.TarWithOptions(absContextDir, &archive.TarOptions{
109-
Compression: compression,
110+
Compression: comp,
110111
})
111112
if err != nil {
112113
return err

vendor.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ require (
2626
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
2727
github.com/google/uuid v1.6.0
2828
github.com/mattn/go-runewidth v0.0.16
29-
github.com/moby/go-archive v0.0.0-20250404171912-21f3f3385ab7
29+
github.com/moby/go-archive v0.1.0
3030
github.com/moby/patternmatcher v0.6.0
3131
github.com/moby/swarmkit/v2 v2.0.0-20250103191802-8c1959736554
3232
github.com/moby/sys/atomicwriter v0.1.0

vendor.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ github.com/mitchellh/mapstructure v1.0.0 h1:vVpGvMXJPqSDh2VYHF7gsfQj8Ncx+Xw5Y1KH
165165
github.com/mitchellh/mapstructure v1.0.0/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
166166
github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=
167167
github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
168-
github.com/moby/go-archive v0.0.0-20250404171912-21f3f3385ab7 h1:CWAY9uG9JhmLmnM7T64+bV0C9IraDrvxEwXq1HJ7hhk=
169-
github.com/moby/go-archive v0.0.0-20250404171912-21f3f3385ab7/go.mod h1:G9B+YoujNohJmrIYFBpSd54GTUB4lt9S+xVQvsJyFuo=
168+
github.com/moby/go-archive v0.1.0 h1:Kk/5rdW/g+H8NHdJW2gsXyZ7UnzvJNOy6VKJqueWdcQ=
169+
github.com/moby/go-archive v0.1.0/go.mod h1:G9B+YoujNohJmrIYFBpSd54GTUB4lt9S+xVQvsJyFuo=
170170
github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk=
171171
github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc=
172172
github.com/moby/swarmkit/v2 v2.0.0-20250103191802-8c1959736554 h1:DMHJbgyNZWyrPKYjCYt2IxEO7KA0eSd4fo6KQsv2W84=

vendor/github.com/moby/go-archive/.gitattributes

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/moby/go-archive/.gitignore

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/moby/go-archive/.golangci.yml

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)