Add luet build --wait

It allows to wait for intermediate images to be available instead of
building all of them
This commit is contained in:
Ettore Di Giacinto
2020-12-18 23:19:18 +01:00
parent 34bba0319b
commit 2b6fe2baa1
3 changed files with 18 additions and 1 deletions

View File

@@ -507,6 +507,18 @@ func (cs *LuetCompiler) genArtifact(p CompilationSpec, builderOpts, runnerOpts C
return artifact, nil
}
func (cs *LuetCompiler) waitForImage(image string) {
if cs.Options.PullFirst && cs.Options.Wait && !cs.Backend.ImageAvailable(image) {
Info(fmt.Sprintf("Waiting for image %s to be available... :zzz:", image))
Spinner(22)
defer SpinnerStop()
for !cs.Backend.ImageAvailable(image) {
Info(fmt.Sprintf("Image %s not available yet, sleeping", image))
time.Sleep(5 * time.Second)
}
}
}
func (cs *LuetCompiler) compileWithImage(image, buildertaggedImage, packageImage string,
concurrency int,
keepPermissions, keepImg bool,
@@ -518,6 +530,7 @@ func (cs *LuetCompiler) compileWithImage(image, buildertaggedImage, packageImage
Debug("Artifact reloaded from YAML. Skipping build")
return art, err
}
cs.waitForImage(packageImage)
if cs.Options.PullFirst && cs.Backend.ImageAvailable(packageImage) {
return &PackageArtifact{}, nil
}