mirror of
https://github.com/mudler/luet.git
synced 2025-09-03 08:14:46 +00:00
Don't bail out if image doesn't exist locally
The backend will figure out if we have the image or not, otherwise will atempt to pull if not there. Skip retrieve integration test with img as its not supported.
This commit is contained in:
@@ -21,6 +21,8 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
. "github.com/mudler/luet/pkg/logger"
|
||||||
|
|
||||||
"github.com/mudler/luet/pkg/compiler"
|
"github.com/mudler/luet/pkg/compiler"
|
||||||
"github.com/mudler/luet/pkg/config"
|
"github.com/mudler/luet/pkg/config"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
@@ -78,6 +80,7 @@ func GenerateChanges(b compiler.CompilerBackend, fromImage, toImage compiler.Com
|
|||||||
ImageName: fromImage.ImageName,
|
ImageName: fromImage.ImageName,
|
||||||
Destination: srcRootFS,
|
Destination: srcRootFS,
|
||||||
}
|
}
|
||||||
|
Debug("Extracting source image", fromImage.ImageName)
|
||||||
err = b.ExtractRootfs(srcImageExtract, false) // No need to keep permissions as we just collect file diffs
|
err = b.ExtractRootfs(srcImageExtract, false) // No need to keep permissions as we just collect file diffs
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []compiler.ArtifactLayer{}, errors.Wrap(err, "Error met while unpacking src image "+fromImage.ImageName)
|
return []compiler.ArtifactLayer{}, errors.Wrap(err, "Error met while unpacking src image "+fromImage.ImageName)
|
||||||
@@ -87,6 +90,7 @@ func GenerateChanges(b compiler.CompilerBackend, fromImage, toImage compiler.Com
|
|||||||
ImageName: toImage.ImageName,
|
ImageName: toImage.ImageName,
|
||||||
Destination: dstRootFS,
|
Destination: dstRootFS,
|
||||||
}
|
}
|
||||||
|
Debug("Extracting destination image", toImage.ImageName)
|
||||||
err = b.ExtractRootfs(dstImageExtract, false)
|
err = b.ExtractRootfs(dstImageExtract, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []compiler.ArtifactLayer{}, errors.Wrap(err, "Error met while unpacking dst image "+toImage.ImageName)
|
return []compiler.ArtifactLayer{}, errors.Wrap(err, "Error met while unpacking dst image "+toImage.ImageName)
|
||||||
|
@@ -175,7 +175,7 @@ func (*SimpleDocker) ExportImage(opts compiler.CompilerBackendOptions) error {
|
|||||||
return errors.Wrap(err, "Failed exporting image: "+string(out))
|
return errors.Wrap(err, "Failed exporting image: "+string(out))
|
||||||
}
|
}
|
||||||
|
|
||||||
Info(":whale: Exported image:", name)
|
Debug(":whale: Exported image:", name)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -164,7 +164,7 @@ func (s *SimpleImg) ExtractRootfs(opts compiler.CompilerBackendOptions, keepPerm
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "Failed extracting image: "+string(out))
|
return errors.Wrap(err, "Failed extracting image: "+string(out))
|
||||||
}
|
}
|
||||||
Info(":tea: Image " + name + " extracted")
|
Debug(":tea: Image " + name + " extracted")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -288,8 +288,6 @@ func (cs *LuetCompiler) unpackDelta(concurrency int, keepPermissions bool, p Com
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "Could not pull image")
|
return nil, errors.Wrap(err, "Could not pull image")
|
||||||
}
|
}
|
||||||
} else if !cs.Backend.ImageExists(builderOpts.ImageName) {
|
|
||||||
return nil, errors.New("No image found for " + builderOpts.ImageName)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Info(pkgTag, ":hammer: Generating delta")
|
Info(pkgTag, ":hammer: Generating delta")
|
||||||
@@ -298,6 +296,7 @@ func (cs *LuetCompiler) unpackDelta(concurrency int, keepPermissions bool, p Com
|
|||||||
return nil, errors.Wrap(err, "Could not generate changes from layers")
|
return nil, errors.Wrap(err, "Could not generate changes from layers")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Debug("Extracting image to grab files from delta")
|
||||||
if err := cs.Backend.ExtractRootfs(CompilerBackendOptions{
|
if err := cs.Backend.ExtractRootfs(CompilerBackendOptions{
|
||||||
ImageName: runnerOpts.ImageName, Destination: rootfs}, keepPermissions); err != nil {
|
ImageName: runnerOpts.ImageName, Destination: rootfs}, keepPermissions); err != nil {
|
||||||
return nil, errors.Wrap(err, "Could not extract rootfs")
|
return nil, errors.Wrap(err, "Could not extract rootfs")
|
||||||
|
@@ -12,6 +12,7 @@ oneTimeTearDown() {
|
|||||||
|
|
||||||
testBuild() {
|
testBuild() {
|
||||||
mkdir $tmpdir/testbuild
|
mkdir $tmpdir/testbuild
|
||||||
|
[ "$LUET_BACKEND" == "img" ] && startSkipping
|
||||||
luet build --tree "$ROOT_DIR/tests/fixtures/retrieve-integration" --destination $tmpdir/testbuild --compression gzip test/b
|
luet build --tree "$ROOT_DIR/tests/fixtures/retrieve-integration" --destination $tmpdir/testbuild --compression gzip test/b
|
||||||
buildst=$?
|
buildst=$?
|
||||||
assertEquals 'builds successfully' "$buildst" "0"
|
assertEquals 'builds successfully' "$buildst" "0"
|
||||||
@@ -20,6 +21,7 @@ testBuild() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
testRepo() {
|
testRepo() {
|
||||||
|
[ "$LUET_BACKEND" == "img" ] && startSkipping
|
||||||
assertTrue 'no repository' "[ ! -e '$tmpdir/testbuild/repository.yaml' ]"
|
assertTrue 'no repository' "[ ! -e '$tmpdir/testbuild/repository.yaml' ]"
|
||||||
luet create-repo --tree "$ROOT_DIR/tests/fixtures/retrieve-integration" \
|
luet create-repo --tree "$ROOT_DIR/tests/fixtures/retrieve-integration" \
|
||||||
--output $tmpdir/testbuild \
|
--output $tmpdir/testbuild \
|
||||||
@@ -59,6 +61,7 @@ EOF
|
|||||||
|
|
||||||
|
|
||||||
testInstall() {
|
testInstall() {
|
||||||
|
[ "$LUET_BACKEND" == "img" ] && startSkipping
|
||||||
luet install -y --config $tmpdir/luet.yaml test/b
|
luet install -y --config $tmpdir/luet.yaml test/b
|
||||||
#luet install -y --config $tmpdir/luet.yaml test/c-1.0 > /dev/null
|
#luet install -y --config $tmpdir/luet.yaml test/c-1.0 > /dev/null
|
||||||
installst=$?
|
installst=$?
|
||||||
@@ -71,6 +74,7 @@ testInstall() {
|
|||||||
|
|
||||||
|
|
||||||
testUnInstall() {
|
testUnInstall() {
|
||||||
|
[ "$LUET_BACKEND" == "img" ] && startSkipping
|
||||||
luet uninstall -y --full --config $tmpdir/luet.yaml test/b
|
luet uninstall -y --full --config $tmpdir/luet.yaml test/b
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'uninstall test successfully' "$installst" "0"
|
assertEquals 'uninstall test successfully' "$installst" "0"
|
||||||
@@ -80,6 +84,7 @@ testUnInstall() {
|
|||||||
|
|
||||||
|
|
||||||
testCleanup() {
|
testCleanup() {
|
||||||
|
[ "$LUET_BACKEND" == "img" ] && startSkipping
|
||||||
luet cleanup --config $tmpdir/luet.yaml
|
luet cleanup --config $tmpdir/luet.yaml
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
|
Reference in New Issue
Block a user