diff --git a/cmd/root.go b/cmd/root.go index 2d4b59df..4bf33862 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -20,7 +20,7 @@ import ( "os" "github.com/mudler/luet/cmd/util" - bus "github.com/mudler/luet/pkg/bus" + bus "github.com/mudler/luet/pkg/api/core/bus" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -99,7 +99,7 @@ To build a package, from a tree definition: plugin := viper.GetStringSlice("plugin") - bus.Manager.Initialize(plugin...) + bus.Manager.Initialize(util.DefaultContext, plugin...) if len(bus.Manager.Plugins) != 0 { util.DefaultContext.Info(":lollipop:Enabled plugins:") for _, p := range bus.Manager.Plugins { diff --git a/pkg/bus/events.go b/pkg/api/core/bus/events.go similarity index 94% rename from pkg/bus/events.go rename to pkg/api/core/bus/events.go index 5c8f2d81..6024903b 100644 --- a/pkg/bus/events.go +++ b/pkg/api/core/bus/events.go @@ -2,7 +2,7 @@ package bus import ( "github.com/mudler/go-pluggable" - "github.com/sirupsen/logrus" + "github.com/mudler/luet/pkg/api/core/types" ) var ( @@ -82,15 +82,15 @@ type Bus struct { *pluggable.Manager } -func (b *Bus) Initialize(plugin ...string) { +func (b *Bus) Initialize(ctx *types.Context, plugin ...string) { b.Manager.Load(plugin...).Register() for _, e := range b.Manager.Events { b.Manager.Response(e, func(p *pluggable.Plugin, r *pluggable.EventResponse) { if r.Errored() { - logrus.Fatal("Plugin", p.Name, "at", p.Executable, "Error", r.Error) + ctx.Fatal("Plugin", p.Name, "at", p.Executable, "Error", r.Error) } - logrus.Debug( + ctx.Debug( "plugin_event", "received from", p.Name, diff --git a/pkg/api/core/types/artifact/artifact.go b/pkg/api/core/types/artifact/artifact.go index c57522d5..9368bb31 100644 --- a/pkg/api/core/types/artifact/artifact.go +++ b/pkg/api/core/types/artifact/artifact.go @@ -37,10 +37,10 @@ import ( "strings" containerdCompression "github.com/containerd/containerd/archive/compression" + bus "github.com/mudler/luet/pkg/api/core/bus" config "github.com/mudler/luet/pkg/api/core/config" "github.com/mudler/luet/pkg/api/core/image" types "github.com/mudler/luet/pkg/api/core/types" - bus "github.com/mudler/luet/pkg/bus" backend "github.com/mudler/luet/pkg/compiler/backend" compression "github.com/mudler/luet/pkg/compiler/types/compression" compilerspec "github.com/mudler/luet/pkg/compiler/types/spec" diff --git a/pkg/compiler/backend/simpledocker.go b/pkg/compiler/backend/simpledocker.go index 47b8dfa7..cbb6bfad 100644 --- a/pkg/compiler/backend/simpledocker.go +++ b/pkg/compiler/backend/simpledocker.go @@ -20,8 +20,8 @@ import ( "github.com/google/go-containerregistry/pkg/name" "github.com/google/go-containerregistry/pkg/v1/daemon" + bus "github.com/mudler/luet/pkg/api/core/bus" "github.com/mudler/luet/pkg/api/core/types" - bus "github.com/mudler/luet/pkg/bus" v1 "github.com/google/go-containerregistry/pkg/v1" diff --git a/pkg/compiler/backend/simpleimg.go b/pkg/compiler/backend/simpleimg.go index bd7937d1..c3aeed23 100644 --- a/pkg/compiler/backend/simpleimg.go +++ b/pkg/compiler/backend/simpleimg.go @@ -21,8 +21,8 @@ import ( "github.com/google/go-containerregistry/pkg/crane" v1 "github.com/google/go-containerregistry/pkg/v1" + bus "github.com/mudler/luet/pkg/api/core/bus" "github.com/mudler/luet/pkg/api/core/types" - bus "github.com/mudler/luet/pkg/bus" "github.com/pkg/errors" ) diff --git a/pkg/compiler/compiler.go b/pkg/compiler/compiler.go index d1f35a9f..54e411bb 100644 --- a/pkg/compiler/compiler.go +++ b/pkg/compiler/compiler.go @@ -29,10 +29,10 @@ import ( "sync" "time" + bus "github.com/mudler/luet/pkg/api/core/bus" "github.com/mudler/luet/pkg/api/core/image" "github.com/mudler/luet/pkg/api/core/types" artifact "github.com/mudler/luet/pkg/api/core/types/artifact" - bus "github.com/mudler/luet/pkg/bus" "github.com/mudler/luet/pkg/compiler/backend" "github.com/mudler/luet/pkg/compiler/types/options" compilerspec "github.com/mudler/luet/pkg/compiler/types/spec" diff --git a/pkg/compiler/compiler_test.go b/pkg/compiler/compiler_test.go index 700731a5..b6e081ca 100644 --- a/pkg/compiler/compiler_test.go +++ b/pkg/compiler/compiler_test.go @@ -16,7 +16,6 @@ package compiler_test import ( - "fmt" "io/ioutil" "os" "path/filepath" diff --git a/pkg/helpers/docker/docker.go b/pkg/helpers/docker/docker.go index 3f0e930a..eb514189 100644 --- a/pkg/helpers/docker/docker.go +++ b/pkg/helpers/docker/docker.go @@ -36,7 +36,7 @@ import ( "github.com/google/go-containerregistry/pkg/name" v1 "github.com/google/go-containerregistry/pkg/v1" "github.com/google/go-containerregistry/pkg/v1/remote" - "github.com/mudler/luet/pkg/bus" + "github.com/mudler/luet/pkg/api/core/bus" "github.com/opencontainers/go-digest" specs "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" diff --git a/pkg/installer/installer.go b/pkg/installer/installer.go index a897f4c5..f35015dc 100644 --- a/pkg/installer/installer.go +++ b/pkg/installer/installer.go @@ -26,9 +26,9 @@ import ( "github.com/mudler/luet/pkg/api/core/config" + "github.com/mudler/luet/pkg/api/core/bus" "github.com/mudler/luet/pkg/api/core/types" artifact "github.com/mudler/luet/pkg/api/core/types/artifact" - "github.com/mudler/luet/pkg/bus" "github.com/mudler/luet/pkg/helpers" fileHelper "github.com/mudler/luet/pkg/helpers/file" "github.com/mudler/luet/pkg/helpers/match" diff --git a/pkg/installer/repository_docker.go b/pkg/installer/repository_docker.go index 0e411e72..293875b0 100644 --- a/pkg/installer/repository_docker.go +++ b/pkg/installer/repository_docker.go @@ -24,10 +24,10 @@ import ( "strings" "time" + "github.com/mudler/luet/pkg/api/core/bus" "github.com/mudler/luet/pkg/api/core/image" "github.com/mudler/luet/pkg/api/core/types" artifact "github.com/mudler/luet/pkg/api/core/types/artifact" - "github.com/mudler/luet/pkg/bus" compiler "github.com/mudler/luet/pkg/compiler" "github.com/mudler/luet/pkg/compiler/backend" "github.com/mudler/luet/pkg/helpers" diff --git a/pkg/installer/repository_local.go b/pkg/installer/repository_local.go index 09965073..55f1eb86 100644 --- a/pkg/installer/repository_local.go +++ b/pkg/installer/repository_local.go @@ -28,7 +28,7 @@ import ( artifact "github.com/mudler/luet/pkg/api/core/types/artifact" pkg "github.com/mudler/luet/pkg/package" - "github.com/mudler/luet/pkg/bus" + "github.com/mudler/luet/pkg/api/core/bus" "github.com/pkg/errors" )