mirror of
https://github.com/mudler/luet.git
synced 2025-08-18 07:16:57 +00:00
Move bus to api/core
This commit is contained in:
parent
67a07e7c5a
commit
c220eac061
@ -20,7 +20,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/mudler/luet/cmd/util"
|
"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/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
@ -99,7 +99,7 @@ To build a package, from a tree definition:
|
|||||||
|
|
||||||
plugin := viper.GetStringSlice("plugin")
|
plugin := viper.GetStringSlice("plugin")
|
||||||
|
|
||||||
bus.Manager.Initialize(plugin...)
|
bus.Manager.Initialize(util.DefaultContext, plugin...)
|
||||||
if len(bus.Manager.Plugins) != 0 {
|
if len(bus.Manager.Plugins) != 0 {
|
||||||
util.DefaultContext.Info(":lollipop:Enabled plugins:")
|
util.DefaultContext.Info(":lollipop:Enabled plugins:")
|
||||||
for _, p := range bus.Manager.Plugins {
|
for _, p := range bus.Manager.Plugins {
|
||||||
|
@ -2,7 +2,7 @@ package bus
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/mudler/go-pluggable"
|
"github.com/mudler/go-pluggable"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/mudler/luet/pkg/api/core/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -82,15 +82,15 @@ type Bus struct {
|
|||||||
*pluggable.Manager
|
*pluggable.Manager
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Bus) Initialize(plugin ...string) {
|
func (b *Bus) Initialize(ctx *types.Context, plugin ...string) {
|
||||||
b.Manager.Load(plugin...).Register()
|
b.Manager.Load(plugin...).Register()
|
||||||
|
|
||||||
for _, e := range b.Manager.Events {
|
for _, e := range b.Manager.Events {
|
||||||
b.Manager.Response(e, func(p *pluggable.Plugin, r *pluggable.EventResponse) {
|
b.Manager.Response(e, func(p *pluggable.Plugin, r *pluggable.EventResponse) {
|
||||||
if r.Errored() {
|
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",
|
"plugin_event",
|
||||||
"received from",
|
"received from",
|
||||||
p.Name,
|
p.Name,
|
@ -37,10 +37,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
containerdCompression "github.com/containerd/containerd/archive/compression"
|
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"
|
config "github.com/mudler/luet/pkg/api/core/config"
|
||||||
"github.com/mudler/luet/pkg/api/core/image"
|
"github.com/mudler/luet/pkg/api/core/image"
|
||||||
types "github.com/mudler/luet/pkg/api/core/types"
|
types "github.com/mudler/luet/pkg/api/core/types"
|
||||||
bus "github.com/mudler/luet/pkg/bus"
|
|
||||||
backend "github.com/mudler/luet/pkg/compiler/backend"
|
backend "github.com/mudler/luet/pkg/compiler/backend"
|
||||||
compression "github.com/mudler/luet/pkg/compiler/types/compression"
|
compression "github.com/mudler/luet/pkg/compiler/types/compression"
|
||||||
compilerspec "github.com/mudler/luet/pkg/compiler/types/spec"
|
compilerspec "github.com/mudler/luet/pkg/compiler/types/spec"
|
||||||
|
@ -20,8 +20,8 @@ import (
|
|||||||
|
|
||||||
"github.com/google/go-containerregistry/pkg/name"
|
"github.com/google/go-containerregistry/pkg/name"
|
||||||
"github.com/google/go-containerregistry/pkg/v1/daemon"
|
"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"
|
"github.com/mudler/luet/pkg/api/core/types"
|
||||||
bus "github.com/mudler/luet/pkg/bus"
|
|
||||||
|
|
||||||
v1 "github.com/google/go-containerregistry/pkg/v1"
|
v1 "github.com/google/go-containerregistry/pkg/v1"
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@ import (
|
|||||||
|
|
||||||
"github.com/google/go-containerregistry/pkg/crane"
|
"github.com/google/go-containerregistry/pkg/crane"
|
||||||
v1 "github.com/google/go-containerregistry/pkg/v1"
|
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"
|
"github.com/mudler/luet/pkg/api/core/types"
|
||||||
bus "github.com/mudler/luet/pkg/bus"
|
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
@ -29,10 +29,10 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"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/image"
|
||||||
"github.com/mudler/luet/pkg/api/core/types"
|
"github.com/mudler/luet/pkg/api/core/types"
|
||||||
artifact "github.com/mudler/luet/pkg/api/core/types/artifact"
|
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/backend"
|
||||||
"github.com/mudler/luet/pkg/compiler/types/options"
|
"github.com/mudler/luet/pkg/compiler/types/options"
|
||||||
compilerspec "github.com/mudler/luet/pkg/compiler/types/spec"
|
compilerspec "github.com/mudler/luet/pkg/compiler/types/spec"
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
package compiler_test
|
package compiler_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
@ -36,7 +36,7 @@ import (
|
|||||||
"github.com/google/go-containerregistry/pkg/name"
|
"github.com/google/go-containerregistry/pkg/name"
|
||||||
v1 "github.com/google/go-containerregistry/pkg/v1"
|
v1 "github.com/google/go-containerregistry/pkg/v1"
|
||||||
"github.com/google/go-containerregistry/pkg/v1/remote"
|
"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"
|
"github.com/opencontainers/go-digest"
|
||||||
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
@ -26,9 +26,9 @@ import (
|
|||||||
|
|
||||||
"github.com/mudler/luet/pkg/api/core/config"
|
"github.com/mudler/luet/pkg/api/core/config"
|
||||||
|
|
||||||
|
"github.com/mudler/luet/pkg/api/core/bus"
|
||||||
"github.com/mudler/luet/pkg/api/core/types"
|
"github.com/mudler/luet/pkg/api/core/types"
|
||||||
artifact "github.com/mudler/luet/pkg/api/core/types/artifact"
|
artifact "github.com/mudler/luet/pkg/api/core/types/artifact"
|
||||||
"github.com/mudler/luet/pkg/bus"
|
|
||||||
"github.com/mudler/luet/pkg/helpers"
|
"github.com/mudler/luet/pkg/helpers"
|
||||||
fileHelper "github.com/mudler/luet/pkg/helpers/file"
|
fileHelper "github.com/mudler/luet/pkg/helpers/file"
|
||||||
"github.com/mudler/luet/pkg/helpers/match"
|
"github.com/mudler/luet/pkg/helpers/match"
|
||||||
|
@ -24,10 +24,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/mudler/luet/pkg/api/core/bus"
|
||||||
"github.com/mudler/luet/pkg/api/core/image"
|
"github.com/mudler/luet/pkg/api/core/image"
|
||||||
"github.com/mudler/luet/pkg/api/core/types"
|
"github.com/mudler/luet/pkg/api/core/types"
|
||||||
artifact "github.com/mudler/luet/pkg/api/core/types/artifact"
|
artifact "github.com/mudler/luet/pkg/api/core/types/artifact"
|
||||||
"github.com/mudler/luet/pkg/bus"
|
|
||||||
compiler "github.com/mudler/luet/pkg/compiler"
|
compiler "github.com/mudler/luet/pkg/compiler"
|
||||||
"github.com/mudler/luet/pkg/compiler/backend"
|
"github.com/mudler/luet/pkg/compiler/backend"
|
||||||
"github.com/mudler/luet/pkg/helpers"
|
"github.com/mudler/luet/pkg/helpers"
|
||||||
|
@ -28,7 +28,7 @@ import (
|
|||||||
artifact "github.com/mudler/luet/pkg/api/core/types/artifact"
|
artifact "github.com/mudler/luet/pkg/api/core/types/artifact"
|
||||||
pkg "github.com/mudler/luet/pkg/package"
|
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"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user