Add flag to skip pulling images already present

This commit is contained in:
Marc Campbell committed 2019-02-18 21:12:35 -08:00
1 parent 3a4de2d215
commit 7fadbdb6e8
5 files changed
+96 -4

No files matched your search

+19 -4
View File
@@ -49,10 +49,25 @@ func (runner *runnerImpl) addImageExecutor(action *model.Action, executors *[]co
case *model.UsesDockerImage:
image = uses.Image
*executors = append(*executors, container.NewDockerPullExecutor(container.NewDockerPullExecutorInput{
DockerExecutorInput: in,
Image: image,
}))
pull := runner.config.ForcePull
if !pull {
imageExists, err := container.ImageExistsLocally(runner.config.Ctx, image)
if err != nil {
return "", fmt.Errorf("unable to determine if image already exists for image %q", image)
}
if imageExists {
pull = false
}
}
if pull {
*executors = append(*executors, container.NewDockerPullExecutor(container.NewDockerPullExecutorInput{
DockerExecutorInput: in,
Image: image,
}))
}
case *model.UsesPath:
contextDir := filepath.Join(runner.config.WorkingDir, uses.String())