mirror of
https://github.com/mudler/luet.git
synced 2025-08-10 11:42:15 +00:00
Skip building if artifact already exists
This commit is contained in:
parent
bcc6ce19ea
commit
1d1efad18b
@ -92,6 +92,17 @@ func NewPackageArtifactFromYaml(data []byte) (Artifact, error) {
|
|||||||
return p, err
|
return p, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func LoadArtifactFromYaml(spec CompilationSpec) (Artifact, error) {
|
||||||
|
|
||||||
|
metaFile := spec.GetPackage().GetFingerPrint() + ".metadata.yaml"
|
||||||
|
dat, err := ioutil.ReadFile(spec.Rel(metaFile))
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Wrap(err, "Error reading file "+metaFile)
|
||||||
|
}
|
||||||
|
|
||||||
|
return NewPackageArtifactFromYaml(dat)
|
||||||
|
}
|
||||||
|
|
||||||
func (a *PackageArtifact) SetCompressionType(t CompressionImplementation) {
|
func (a *PackageArtifact) SetCompressionType(t CompressionImplementation) {
|
||||||
a.CompressionType = t
|
a.CompressionType = t
|
||||||
}
|
}
|
||||||
|
@ -227,6 +227,11 @@ func (cs *LuetCompiler) stripIncludesFromRootfs(includes []string, rootfs string
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (cs *LuetCompiler) compileWithImage(image, buildertaggedImage, packageImage string, concurrency int, keepPermissions, keepImg bool, p CompilationSpec) (Artifact, error) {
|
func (cs *LuetCompiler) compileWithImage(image, buildertaggedImage, packageImage string, concurrency int, keepPermissions, keepImg bool, p CompilationSpec) (Artifact, error) {
|
||||||
|
if !cs.Clean {
|
||||||
|
if art, err := LoadArtifactFromYaml(p); err == nil {
|
||||||
|
return art, err
|
||||||
|
}
|
||||||
|
}
|
||||||
pkgTag := ":package: " + p.GetPackage().GetName()
|
pkgTag := ":package: " + p.GetPackage().GetName()
|
||||||
|
|
||||||
p.SetSeedImage(image) // In this case, we ignore the build deps as we suppose that the image has them - otherwise we recompose the tree with a solver,
|
p.SetSeedImage(image) // In this case, we ignore the build deps as we suppose that the image has them - otherwise we recompose the tree with a solver,
|
||||||
@ -382,6 +387,11 @@ func (cs *LuetCompiler) compileWithImage(image, buildertaggedImage, packageImage
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (cs *LuetCompiler) packageFromImage(p CompilationSpec, tag string, keepPermissions, keepImg bool, concurrency int) (Artifact, error) {
|
func (cs *LuetCompiler) packageFromImage(p CompilationSpec, tag string, keepPermissions, keepImg bool, concurrency int) (Artifact, error) {
|
||||||
|
if !cs.Clean {
|
||||||
|
if art, err := LoadArtifactFromYaml(p); err == nil {
|
||||||
|
return art, err
|
||||||
|
}
|
||||||
|
}
|
||||||
pkgTag := ":package: " + p.GetPackage().GetName()
|
pkgTag := ":package: " + p.GetPackage().GetName()
|
||||||
|
|
||||||
Info(pkgTag, " 🍩 Build starts 🔨 🔨 🔨 ")
|
Info(pkgTag, " 🍩 Build starts 🔨 🔨 🔨 ")
|
||||||
|
Loading…
Reference in New Issue
Block a user