diff --git a/pkg/plugins/unpack_image.go b/pkg/plugins/unpack_image.go index d7a5f1bb..a35233c2 100644 --- a/pkg/plugins/unpack_image.go +++ b/pkg/plugins/unpack_image.go @@ -1,8 +1,15 @@ +//go:build !nounpack + package plugins import ( "context" "fmt" + "net/http" + "os" + "runtime" + "syscall" + "github.com/containerd/containerd/archive" "github.com/google/go-containerregistry/pkg/authn" "github.com/google/go-containerregistry/pkg/name" @@ -15,10 +22,6 @@ import ( "github.com/mudler/yip/pkg/logger" "github.com/mudler/yip/pkg/schema" "github.com/twpayne/go-vfs/v4" - "net/http" - "os" - "runtime" - "syscall" ) func UnpackImage(l logger.Interface, s schema.Stage, fs vfs.FS, console Console) error { diff --git a/pkg/plugins/unpack_image_disabled.go b/pkg/plugins/unpack_image_disabled.go new file mode 100644 index 00000000..0d2521bf --- /dev/null +++ b/pkg/plugins/unpack_image_disabled.go @@ -0,0 +1,17 @@ +//go:build nounpack + +package plugins + +import ( + "github.com/mudler/yip/pkg/logger" + "github.com/mudler/yip/pkg/schema" + "github.com/twpayne/go-vfs/v4" +) + +func UnpackImage(l logger.Interface, s schema.Stage, _ vfs.FS, _ Console) error { + if len(s.UnpackImages) == 0 { + return nil + } + l.Warn("Unpack image plugin is disabled at build time") + return nil +} diff --git a/pkg/plugins/unpack_image_test.go b/pkg/plugins/unpack_image_test.go index beba4a91..3b776d21 100644 --- a/pkg/plugins/unpack_image_test.go +++ b/pkg/plugins/unpack_image_test.go @@ -1,7 +1,11 @@ +//go:build !nounpack + package plugins_test import ( "debug/elf" + "os" + . "github.com/mudler/yip/pkg/plugins" "github.com/mudler/yip/pkg/schema" consoletests "github.com/mudler/yip/tests/console" @@ -9,7 +13,6 @@ import ( . "github.com/onsi/gomega" "github.com/sirupsen/logrus" "github.com/twpayne/go-vfs/v4" - "os" ) var _ = Describe("UnpackImage", Label("unpack_image"), func() {