runner: introduce runner abstraction
For now all it does is represent the name of the runner and what requirements it has of the build pipeline. Move some package definitions from the runner package set to where it belongs.
This commit is contained in:
parent
33fe2da25c
commit
529bc803db
22 changed files with 101 additions and 40 deletions
18
internal/runner/fedora.go
Normal file
18
internal/runner/fedora.go
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
package runner
|
||||
|
||||
import "fmt"
|
||||
|
||||
type Fedora struct {
|
||||
Version uint64
|
||||
}
|
||||
|
||||
func (r *Fedora) String() string {
|
||||
return fmt.Sprintf("org.osbuild.fedora%d", r.Version)
|
||||
}
|
||||
|
||||
func (p *Fedora) GetBuildPackages() []string {
|
||||
return []string{
|
||||
"glibc", // ldconfig
|
||||
"systemd", // systemd-tmpfiles and systemd-sysusers
|
||||
}
|
||||
}
|
||||
15
internal/runner/linux.go
Normal file
15
internal/runner/linux.go
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
package runner
|
||||
|
||||
type Linux struct {
|
||||
}
|
||||
|
||||
func (r *Linux) String() string {
|
||||
return "org.osbuild.linux"
|
||||
}
|
||||
|
||||
func (p *Linux) GetBuildPackages() []string {
|
||||
return []string{
|
||||
"glibc", // ldconfig
|
||||
"systemd", // systemd-tmpfiles and systemd-sysusers
|
||||
}
|
||||
}
|
||||
24
internal/runner/rhel.go
Normal file
24
internal/runner/rhel.go
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package runner
|
||||
|
||||
import "fmt"
|
||||
|
||||
type RHEL struct {
|
||||
Major uint64
|
||||
Minor uint64
|
||||
}
|
||||
|
||||
func (r *RHEL) String() string {
|
||||
return fmt.Sprintf("org.osbuild.fedora%d%d", r.Major, r.Minor)
|
||||
}
|
||||
|
||||
func (p *RHEL) GetBuildPackages() []string {
|
||||
packages := []string{
|
||||
"glibc", // ldconfig
|
||||
}
|
||||
if p.Major >= 8 {
|
||||
packages = append(packages,
|
||||
"systemd", // systemd-tmpfiles and systemd-sysusers
|
||||
)
|
||||
}
|
||||
return packages
|
||||
}
|
||||
6
internal/runner/runner.go
Normal file
6
internal/runner/runner.go
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
package runner
|
||||
|
||||
type Runner interface {
|
||||
String() string
|
||||
GetBuildPackages() []string
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue