Skip to content

Commit

Permalink
Bump github.com/docker/docker to latest release (#1866)
Browse files Browse the repository at this point in the history
* Bump github.com/docker/docker to latest release

* Pin deps to docker/docker's requirements

fix build breakages
fix unit test
Trying to see whether am-i-in-a-container checks are broken for integration tests...
  • Loading branch information
imjasonh authored Jan 14, 2022
1 parent d587122 commit 7662469
Show file tree
Hide file tree
Showing 1,457 changed files with 103,979 additions and 40,384 deletions.
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

0 comments on commit 7662469

Please sign in to comment.