mirror of
https://github.com/GoogleContainerTools/kaniko
synced 2026-10-18 08:33:04 +02:00
Upgrade docker (#2440)
* somehow now the only thing that doesnt work is devices.Device Signed-off-by: Joe Kimmel <jkimmel@vmware.com> * this gets rid of all the compiler errors in the vendored code Signed-off-by: Joe Kimmel <jkimmel@vmware.com> * fixed some things but a bunch of tests and maybe some compiler steps are still failing Signed-off-by: Joe Kimmel <jkimmel@vmware.com> * all the things i figured out how to fix so far Signed-off-by: Joe Kimmel <jkimmel@vmware.com> * guess i had to redo go mods after rebasing again Signed-off-by: Joe Kimmel <jkimmel@vmware.com> * update docker constants to be SHOUTY CASE now Signed-off-by: Joe Kimmel <jkimmel@vmware.com> * include DestPath in resolveEnv Signed-off-by: Joe Kimmel <jkimmel@vmware.com> * fix one mistake in Docker lib upgrade and some typos/deprecations in the file Signed-off-by: Joe Kimmel <jkimmel@vmware.com> * last changes (hopefully) to update to new docker libs Signed-off-by: Joe Kimmel <jkimmel@vmware.com> --------- Signed-off-by: Joe Kimmel <jkimmel@vmware.com>
This commit is contained in:
@@ -575,11 +575,11 @@ func CalculateDependencies(stages []config.KanikoStage, opts *config.KanikoOptio
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
resolved, err := util.ResolveEnvironmentReplacementList(cmd.SourcesAndDest, ba.ReplacementEnvs(cfg.Config.Env), true)
|
||||
resolved, err := util.ResolveEnvironmentReplacementList(cmd.SourcesAndDest.SourcePaths, ba.ReplacementEnvs(cfg.Config.Env), true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
depGraph[i] = append(depGraph[i], resolved[0:len(resolved)-1]...)
|
||||
depGraph[i] = append(depGraph[i], resolved...)
|
||||
}
|
||||
case *instructions.EnvCommand:
|
||||
if err := util.UpdateConfigEnv(cmd.Env, &cfg.Config, ba.ReplacementEnvs(cfg.Config.Env)); err != nil {
|
||||
|
||||
+13
-16
@@ -369,8 +369,8 @@ COPY --from=second /bar /bat
|
||||
initializeConfig = tt.args.mockInitConfig
|
||||
}
|
||||
|
||||
f, _ := ioutil.TempFile("", "")
|
||||
ioutil.WriteFile(f.Name(), []byte(tt.args.dockerfile), 0755)
|
||||
f, _ := os.CreateTemp("", "")
|
||||
os.WriteFile(f.Name(), []byte(tt.args.dockerfile), 0755)
|
||||
opts := &config.KanikoOptions{
|
||||
DockerfilePath: f.Name(),
|
||||
CustomPlatform: platforms.Format(platforms.Normalize(platforms.DefaultSpec())),
|
||||
@@ -898,17 +898,16 @@ func Test_stageBuilder_build(t *testing.T) {
|
||||
}
|
||||
copyCommandCacheKey := hash
|
||||
dockerFile := fmt.Sprintf(`
|
||||
FROM ubuntu:16.04
|
||||
COPY %s foo.txt
|
||||
`, filename)
|
||||
f, _ := ioutil.TempFile("", "")
|
||||
ioutil.WriteFile(f.Name(), []byte(dockerFile), 0755)
|
||||
FROM ubuntu:16.04
|
||||
COPY %s foo.txt
|
||||
`, filename)
|
||||
f, _ := os.CreateTemp("", "")
|
||||
os.WriteFile(f.Name(), []byte(dockerFile), 0755)
|
||||
opts := &config.KanikoOptions{
|
||||
DockerfilePath: f.Name(),
|
||||
Cache: true,
|
||||
CacheCopyLayers: true,
|
||||
}
|
||||
|
||||
testStages, metaArgs, err := dockerfile.ParseStages(opts)
|
||||
if err != nil {
|
||||
t.Errorf("Failed to parse test dockerfile to stages: %s", err)
|
||||
@@ -968,8 +967,8 @@ COPY %s foo.txt
|
||||
FROM ubuntu:16.04
|
||||
COPY %s foo.txt
|
||||
`, filename)
|
||||
f, _ := ioutil.TempFile("", "")
|
||||
ioutil.WriteFile(f.Name(), []byte(dockerFile), 0755)
|
||||
f, _ := os.CreateTemp("", "")
|
||||
os.WriteFile(f.Name(), []byte(dockerFile), 0755)
|
||||
opts := &config.KanikoOptions{
|
||||
DockerfilePath: f.Name(),
|
||||
Cache: true,
|
||||
@@ -1047,8 +1046,8 @@ FROM ubuntu:16.04
|
||||
RUN foobar
|
||||
COPY %s bar.txt
|
||||
`, filename)
|
||||
f, _ := ioutil.TempFile("", "")
|
||||
ioutil.WriteFile(f.Name(), []byte(dockerFile), 0755)
|
||||
f, _ := os.CreateTemp("", "")
|
||||
os.WriteFile(f.Name(), []byte(dockerFile), 0755)
|
||||
opts := &config.KanikoOptions{
|
||||
DockerfilePath: f.Name(),
|
||||
}
|
||||
@@ -1122,7 +1121,7 @@ COPY %s bar.txt
|
||||
RUN foobar
|
||||
`, filename)
|
||||
f, _ := ioutil.TempFile("", "")
|
||||
ioutil.WriteFile(f.Name(), []byte(dockerFile), 0755)
|
||||
os.WriteFile(f.Name(), []byte(dockerFile), 0755)
|
||||
opts := &config.KanikoOptions{
|
||||
DockerfilePath: f.Name(),
|
||||
}
|
||||
@@ -1286,7 +1285,7 @@ RUN foobar
|
||||
t.Run(tc.description, func(t *testing.T) {
|
||||
var fileName string
|
||||
if tc.commands == nil {
|
||||
file, err := ioutil.TempFile("", "foo")
|
||||
file, err := os.CreateTemp("", "foo")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
@@ -1348,7 +1347,6 @@ RUN foobar
|
||||
if err != nil {
|
||||
t.Errorf("Expected error to be nil but was %v", err)
|
||||
}
|
||||
fmt.Println(lc.receivedKeys)
|
||||
assertCacheKeys(t, tc.expectedCacheKeys, lc.receivedKeys, "receive")
|
||||
assertCacheKeys(t, tc.pushedCacheKeys, keys, "push")
|
||||
|
||||
@@ -1397,7 +1395,6 @@ func getCommands(fileContext util.FileContext, cmds []instructions.Command, cach
|
||||
outCommands = append(outCommands, cmd)
|
||||
}
|
||||
return outCommands
|
||||
|
||||
}
|
||||
|
||||
func tempDirAndFile(t *testing.T) (string, []string) {
|
||||
|
||||
Reference in New Issue
Block a user