osbuildexecutor: introduce osbuildexecutor.Executor interface
Wrap the current osbuildexecutor.Executor in an interface so it's easier to add different executors, which for instance can run osbuild in a VM.
This commit is contained in:
parent
9e85050633
commit
e10424de2f
4 changed files with 51 additions and 3 deletions
11
internal/osbuildexecutor/osbuild-executor.go
Normal file
11
internal/osbuildexecutor/osbuild-executor.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
package osbuildexecutor
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/osbuild/images/pkg/osbuild"
|
||||
)
|
||||
|
||||
type Executor interface {
|
||||
RunOSBuild(manifest []byte, store, outputDirectory string, exports, checkpoints, extraEnv []string, result bool, errorWriter io.Writer) (*osbuild.Result, error)
|
||||
}
|
||||
18
internal/osbuildexecutor/runner-impl-host.go
Normal file
18
internal/osbuildexecutor/runner-impl-host.go
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
package osbuildexecutor
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/osbuild/images/pkg/osbuild"
|
||||
)
|
||||
|
||||
type hostExecutor struct{}
|
||||
|
||||
func (he *hostExecutor) RunOSBuild(manifest []byte, store, outputDirectory string, exports, checkpoints,
|
||||
extraEnv []string, result bool, errorWriter io.Writer) (*osbuild.Result, error) {
|
||||
return osbuild.RunOSBuild(manifest, store, outputDirectory, exports, checkpoints, extraEnv, result, errorWriter)
|
||||
}
|
||||
|
||||
func NewHostExecutor() Executor {
|
||||
return &hostExecutor{}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue