Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump github.com/docker/docker to latest release #1866

Merged
merged 2 commits into from
Jan 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
41 changes: 16 additions & 25 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,46 @@ module github.com/GoogleContainerTools/kaniko

go 1.14

// These match the docker/docker's dependencies configured in:
// https://github.com/moby/moby/blob/v20.10.12/vendor.conf
replace (
github.com/Azure/go-autorest => github.com/Azure/go-autorest v14.2.0+incompatible
github.com/containerd/containerd v1.4.0-0.20191014053712-acdcf13d5eaf => github.com/containerd/containerd v0.0.0-20191014053712-acdcf13d5eaf
github.com/docker/docker v1.14.0-0.20190319215453-e7b5f7dbe98c => github.com/docker/docker v0.0.0-20190319215453-e7b5f7dbe98c
github.com/tonistiigi/fsutil v0.0.0-20190819224149-3d2716dd0a4d => github.com/tonistiigi/fsutil v0.0.0-20191018213012-0f039a052ca1
github.com/moby/buildkit v0.9.3 => github.com/moby/buildkit v0.8.3
github.com/opencontainers/runc v1.0.3 => github.com/opencontainers/runc v1.0.0-rc92
)

require (
cloud.google.com/go/storage v1.8.0
github.com/Azure/azure-pipeline-go v0.2.2 // indirect
github.com/Azure/azure-storage-blob-go v0.8.0
github.com/aws/aws-sdk-go v1.31.6
github.com/coreos/etcd v3.3.13+incompatible // indirect
github.com/docker/docker v1.14.0-0.20190319215453-e7b5f7dbe98c
github.com/docker/go-metrics v0.0.0-20180209012529-399ea8c73916 // indirect
github.com/containerd/cgroups v1.0.2 // indirect
github.com/docker/docker v20.10.12+incompatible
github.com/docker/swarmkit v1.12.1-0.20180726190244-7567d47988d8 // indirect
github.com/genuinetools/bpfd v0.0.2-0.20190525234658-c12d8cd9aac8
github.com/go-git/go-billy/v5 v5.0.0
github.com/go-git/go-git/v5 v5.1.0
github.com/godbus/dbus/v5 v5.0.6 // indirect
github.com/golang/mock v1.4.3
github.com/google/go-cmp v0.5.2
github.com/google/go-cmp v0.5.6
github.com/google/go-containerregistry v0.4.1-0.20210128200529-19c2b639fab1
github.com/google/go-containerregistry/pkg/authn/k8schain v0.0.0-20210208222243-cbafe638a7a9
github.com/google/go-github v17.0.0+incompatible
github.com/google/go-querystring v1.0.0 // indirect
github.com/google/martian v2.1.1-0.20190517191504-25dcb96d9e51+incompatible // indirect
github.com/google/slowjam v1.0.0
github.com/hashicorp/go-memdb v0.0.0-20180223233045-1289e7fffe71 // indirect
github.com/hashicorp/go-uuid v1.0.1 // indirect
github.com/karrick/godirwalk v1.16.1
github.com/mattn/go-ieproxy v0.0.1 // indirect
github.com/mattn/go-shellwords v1.0.10 // indirect
github.com/minio/highwayhash v1.0.0
github.com/moby/buildkit v0.0.0-20191111154543-00bfbab0390c
github.com/opencontainers/runtime-spec v1.0.1 // indirect
github.com/opencontainers/selinux v1.0.0-rc1 // indirect
github.com/opentracing/opentracing-go v1.0.2 // indirect
github.com/moby/buildkit v0.9.3
github.com/moby/sys/mount v0.3.0 // indirect
github.com/moby/sys/symlink v0.2.0 // indirect
github.com/opencontainers/runc v1.0.3 // indirect
github.com/otiai10/copy v1.0.2
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.6.0
github.com/sirupsen/logrus v1.8.1
github.com/spf13/afero v1.2.2
github.com/spf13/cobra v1.0.0
github.com/spf13/pflag v1.0.5
github.com/tonistiigi/fsutil v0.0.0-20191018213012-0f039a052ca1 // indirect
github.com/vbatts/tar-split v0.10.2 // indirect
golang.org/x/net v0.0.0-20210119194325-5f4716e94777
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a
google.golang.org/api v0.25.0 // indirect
honnef.co/go/tools v0.0.1-2020.1.4 // indirect
k8s.io/code-generator v0.20.1 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
)
1,181 changes: 958 additions & 223 deletions go.sum

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions integration/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@ import (
// for debugging before returning an error. It can be run outside the context of a test.
func RunCommandWithoutTest(cmd *exec.Cmd) ([]byte, error) {
output, err := cmd.CombinedOutput()

return output, err
}

// RunCommand will run cmd and if it fails will output relevant info for debugging
// before it fails. It must be run within the context of a test t and if the command
// fails, it will the test. Returns the output from the command.
// fails, it will fail the test. Returns the output from the command.
func RunCommand(cmd *exec.Cmd, t *testing.T) []byte {
var stderr bytes.Buffer
cmd.Stderr = &stderr
Expand Down
4 changes: 3 additions & 1 deletion integration/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,9 @@ func buildKanikoImage(

dockerRunFlags = append(dockerRunFlags, ExecutorImage,
"-f", kanikoDockerfilePath,
"-d", kanikoImage)
"-d", kanikoImage,
"--force", // TODO: detection of whether kaniko is being run inside a container might be broken?
)
dockerRunFlags = append(dockerRunFlags, additionalFlags...)

kanikoCmd := exec.Command("docker", dockerRunFlags...)
Expand Down
1 change: 1 addition & 0 deletions integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,7 @@ func TestExitCodePropagation(t *testing.T) {
"-c", "dir:///workspace/",
"-f", "./Dockerfile_exit_code_propagation",
"--no-push",
"--force", // TODO: detection of whether kaniko is being run inside a container might be broken?
})...)

_, kanikoErr = RunCommandWithoutTest(dockerCmdWithKaniko)
Expand Down
12 changes: 7 additions & 5 deletions pkg/commands/arg.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ type ArgCommand struct {

// ExecuteCommand only needs to add this ARG key/value as seen
func (r *ArgCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error {
key, val, err := ParseArg(r.cmd.Key, r.cmd.Value, config.Env, buildArgs)
if err != nil {
return err
}
for _, arg := range r.cmd.Args {
key, val, err := ParseArg(arg.Key, arg.Value, config.Env, buildArgs)
if err != nil {
return err
}

buildArgs.AddArg(key, val)
buildArgs.AddArg(key, val)
}
return nil
}

Expand Down
8 changes: 5 additions & 3 deletions pkg/dockerfile/buildargs.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ func (b *BuildArgs) ReplacementEnvs(envs []string) []string {

// AddMetaArgs adds the supplied args map to b's allowedMetaArgs
func (b *BuildArgs) AddMetaArgs(metaArgs []instructions.ArgCommand) {
for _, arg := range metaArgs {
v := arg.Value
b.AddMetaArg(arg.Key, v)
for _, marg := range metaArgs {
for _, arg := range marg.Args {
v := arg.Value
b.AddMetaArg(arg.Key, v)
}
}
}
52 changes: 28 additions & 24 deletions pkg/dockerfile/dockerfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,19 @@ func Parse(b []byte) ([]instructions.Stage, []instructions.ArgCommand, error) {

// expandNestedArgs tries to resolve nested ARG value against the previously defined ARGs
func expandNested(metaArgs []instructions.ArgCommand, buildArgs []string) ([]instructions.ArgCommand, error) {
prevArgs := make([]string, 0)
for i := range metaArgs {
arg := metaArgs[i]
v := arg.Value
if v != nil {
val, err := util.ResolveEnvironmentReplacement(*v, append(prevArgs, buildArgs...), false)
if err != nil {
return nil, err
var prevArgs []string
for i, marg := range metaArgs {
for j, arg := range marg.Args {
v := arg.Value
if v != nil {
val, err := util.ResolveEnvironmentReplacement(*v, append(prevArgs, buildArgs...), false)
if err != nil {
return nil, err
}
prevArgs = append(prevArgs, arg.Key+"="+val)
arg.Value = &val
metaArgs[i].Args[j] = arg
}
prevArgs = append(prevArgs, arg.Key+"="+val)
arg.Value = &val
metaArgs[i] = arg
}
}
return metaArgs, nil
Expand All @@ -124,17 +125,18 @@ func expandNested(metaArgs []instructions.ArgCommand, buildArgs []string) ([]ins
// stripEnclosingQuotes removes quotes enclosing the value of each instructions.ArgCommand in a slice
// if the quotes are escaped it leaves them
func stripEnclosingQuotes(metaArgs []instructions.ArgCommand) ([]instructions.ArgCommand, error) {
for i := range metaArgs {
arg := metaArgs[i]
v := arg.Value
if v != nil {
val, err := extractValFromQuotes(*v)
if err != nil {
return nil, err
}
for i, marg := range metaArgs {
for j, arg := range marg.Args {
v := arg.Value
if v != nil {
val, err := extractValFromQuotes(*v)
if err != nil {
return nil, err
}

arg.Value = &val
metaArgs[i] = arg
arg.Value = &val
metaArgs[i].Args[j] = arg
}
}
}
return metaArgs, nil
Expand Down Expand Up @@ -322,9 +324,11 @@ func GetOnBuildInstructions(config *v1.Config, stageNameToIdx map[string]string)
// by default --build-arg overrides metaArgs except when --build-arg is empty
func unifyArgs(metaArgs []instructions.ArgCommand, buildArgs []string) []string {
argsMap := make(map[string]string)
for _, a := range metaArgs {
if a.Value != nil {
argsMap[a.Key] = *a.Value
for _, marg := range metaArgs {
for _, arg := range marg.Args {
if arg.Value != nil {
argsMap[arg.Key] = *arg.Value
}
}
}
splitter := "="
Expand Down
10 changes: 5 additions & 5 deletions pkg/dockerfile/dockerfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ func Test_ParseStages_ArgValueWithQuotes(t *testing.T) {
}

for i, expectedVal := range []string{"ubuntu:16.04", "bar", "Hello", "World", "Hello World"} {
if metaArgs[i].ValueString() != expectedVal {
t.Fatalf("expected metaArg %d val to be %s but was %s", i, expectedVal, metaArgs[i].ValueString())
if metaArgs[i].Args[0].ValueString() != expectedVal {
t.Fatalf("expected metaArg %d val to be %s but was %s", i, expectedVal, metaArgs[i].Args[0].ValueString())
}
}
}
Expand All @@ -89,7 +89,7 @@ func Test_stripEnclosingQuotes(t *testing.T) {

newArgCommand := func(key, val string) instructions.ArgCommand {
return instructions.ArgCommand{
KeyValuePairOptional: instructions.KeyValuePairOptional{Key: key, Value: &val},
Args: []instructions.KeyValuePairOptional{{Key: key, Value: &val}},
}
}

Expand Down Expand Up @@ -181,12 +181,12 @@ func Test_stripEnclosingQuotes(t *testing.T) {
}

for i := range out {
if expected[i] != out[i].ValueString() {
if expected[i] != out[i].Args[0].ValueString() {
t.Errorf(
"Expected arg at index %d to equal %v but instead equaled %v",
i,
expected[i],
out[i].ValueString())
out[i].Args[0].ValueString())
}
}
})
Expand Down
10 changes: 6 additions & 4 deletions pkg/executor/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -560,11 +560,13 @@ func CalculateDependencies(stages []config.KanikoStage, opts *config.KanikoOptio
return nil, err
}
case *instructions.ArgCommand:
k, v, err := commands.ParseArg(cmd.Key, cmd.Value, cfg.Config.Env, ba)
if err != nil {
return nil, err
for _, arg := range cmd.Args {
k, v, err := commands.ParseArg(arg.Key, arg.Value, cfg.Config.Env, ba)
if err != nil {
return nil, err
}
ba.AddArg(k, v)
}
ba.AddArg(k, v)
}
}
images = append(images, image)
Expand Down
6 changes: 4 additions & 2 deletions pkg/image/image_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ func RetrieveSourceImage(stage config.KanikoStage, opts *config.KanikoOptions) (
defer timing.DefaultRun.Stop(t)
var buildArgs []string

for _, arg := range stage.MetaArgs {
buildArgs = append(buildArgs, fmt.Sprintf("%s=%s", arg.Key, arg.ValueString()))
for _, marg := range stage.MetaArgs {
for _, arg := range marg.Args {
buildArgs = append(buildArgs, fmt.Sprintf("%s=%s", arg.Key, arg.ValueString()))
}
}
buildArgs = append(buildArgs, opts.BuildArgs...)
currentBaseName, err := util.ResolveEnvironmentReplacement(stage.BaseName, buildArgs, false)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 12 additions & 7 deletions vendor/github.com/Azure/go-autorest/autorest/sender.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions vendor/github.com/Azure/go-autorest/autorest/validation/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading