pipeline/stages: Add support for various stages defined in osbuild
This commit is contained in:
parent
ed2dd9829c
commit
86c47bc1d6
9 changed files with 146 additions and 0 deletions
14
internal/pipeline/chrony_stage.go
Normal file
14
internal/pipeline/chrony_stage.go
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package pipeline
|
||||
|
||||
type ChronyStageOptions struct {
|
||||
Timeservers []string `json:"timeservers"`
|
||||
}
|
||||
|
||||
func (ChronyStageOptions) isStageOptions() {}
|
||||
|
||||
func NewChronyStage(options *ChronyStageOptions) *Stage {
|
||||
return &Stage{
|
||||
Name: "org.osbuild.chrony",
|
||||
Options: options,
|
||||
}
|
||||
}
|
||||
16
internal/pipeline/firewall_stage.go
Normal file
16
internal/pipeline/firewall_stage.go
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
package pipeline
|
||||
|
||||
type FirewallStageOptions struct {
|
||||
Ports []string `json:"ports,omitempty"`
|
||||
EnabledServices []string `json:"enabled_services,omitempty"`
|
||||
DisabledServices []string `json:"disabled_services,omitempty"`
|
||||
}
|
||||
|
||||
func (FirewallStageOptions) isStageOptions() {}
|
||||
|
||||
func NewFirewallStage(options *FirewallStageOptions) *Stage {
|
||||
return &Stage{
|
||||
Name: "org.osbuild.firewall",
|
||||
Options: options,
|
||||
}
|
||||
}
|
||||
18
internal/pipeline/groups_stage.go
Normal file
18
internal/pipeline/groups_stage.go
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
package pipeline
|
||||
|
||||
type GroupsStageOptions struct {
|
||||
Groups map[string]GroupsStageOptionsGroup `json:"groups"`
|
||||
}
|
||||
|
||||
func (GroupsStageOptions) isStageOptions() {}
|
||||
|
||||
type GroupsStageOptionsGroup struct {
|
||||
GID *string `json:"gid,omitempty"`
|
||||
}
|
||||
|
||||
func NewGroupsStage(options *GroupsStageOptions) *Stage {
|
||||
return &Stage{
|
||||
Name: "org.osbuild.groups",
|
||||
Options: options,
|
||||
}
|
||||
}
|
||||
14
internal/pipeline/hostname_stage.go
Normal file
14
internal/pipeline/hostname_stage.go
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package pipeline
|
||||
|
||||
type HostnameStageOptions struct {
|
||||
Hostname string `json:"hostname"`
|
||||
}
|
||||
|
||||
func (HostnameStageOptions) isStageOptions() {}
|
||||
|
||||
func NewHostnameStage(options *HostnameStageOptions) *Stage {
|
||||
return &Stage{
|
||||
Name: "org.osbuild.hostname",
|
||||
Options: options,
|
||||
}
|
||||
}
|
||||
14
internal/pipeline/keymap_stage.go
Normal file
14
internal/pipeline/keymap_stage.go
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package pipeline
|
||||
|
||||
type KeymapStageOptions struct {
|
||||
Keymap string `json:"keymap"`
|
||||
}
|
||||
|
||||
func (KeymapStageOptions) isStageOptions() {}
|
||||
|
||||
func NewKeymapStage(options *KeymapStageOptions) *Stage {
|
||||
return &Stage{
|
||||
Name: "org.osbuild.keymap",
|
||||
Options: options,
|
||||
}
|
||||
}
|
||||
|
|
@ -48,6 +48,22 @@ func (stage *Stage) UnmarshalJSON(data []byte) error {
|
|||
options = new(LocaleStageOptions)
|
||||
case "org.osbuild.selinux":
|
||||
options = new(SELinuxStageOptions)
|
||||
case "org.osbuild.hostname":
|
||||
options = new(HostnameStageOptions)
|
||||
case "org.osbuild.users":
|
||||
options = new(UsersStageOptions)
|
||||
case "org.osbuild.groups":
|
||||
options = new(GroupsStageOptions)
|
||||
case "org.osbuild.timezone":
|
||||
options = new(TimezoneStageOptions)
|
||||
case "org.osbuild.chrony":
|
||||
options = new(ChronyStageOptions)
|
||||
case "org.osbuild.keymap":
|
||||
options = new(KeymapStageOptions)
|
||||
case "org.osbuild.firewall":
|
||||
options = new(FirewallStageOptions)
|
||||
case "org.osbuild.systemd":
|
||||
options = new(SystemdStageOptions)
|
||||
default:
|
||||
return errors.New("unexpected stage name")
|
||||
}
|
||||
|
|
|
|||
15
internal/pipeline/systemd_stage.go
Normal file
15
internal/pipeline/systemd_stage.go
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
package pipeline
|
||||
|
||||
type SystemdStageOptions struct {
|
||||
EnabledServices []string `json:"enabled_services,omitempty"`
|
||||
DisabledServices []string `json:"disabled_services,omitempty"`
|
||||
}
|
||||
|
||||
func (SystemdStageOptions) isStageOptions() {}
|
||||
|
||||
func NewSystemdStage(options *SystemdStageOptions) *Stage {
|
||||
return &Stage{
|
||||
Name: "org.osbuild.systemd",
|
||||
Options: options,
|
||||
}
|
||||
}
|
||||
14
internal/pipeline/timezone_stage.go
Normal file
14
internal/pipeline/timezone_stage.go
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package pipeline
|
||||
|
||||
type TimezoneStageOptions struct {
|
||||
Zone string `json:"zone"`
|
||||
}
|
||||
|
||||
func (TimezoneStageOptions) isStageOptions() {}
|
||||
|
||||
func NewTimezoneStage(options *TimezoneStageOptions) *Stage {
|
||||
return &Stage{
|
||||
Name: "org.osbuild.users",
|
||||
Options: options,
|
||||
}
|
||||
}
|
||||
25
internal/pipeline/users_stage.go
Normal file
25
internal/pipeline/users_stage.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package pipeline
|
||||
|
||||
type UsersStageOptions struct {
|
||||
Users map[string]UsersStageOptionsUser `json:"users"`
|
||||
}
|
||||
|
||||
func (UsersStageOptions) isStageOptions() {}
|
||||
|
||||
type UsersStageOptionsUser struct {
|
||||
UID *string `json:"uid,omitempty"`
|
||||
GID *string `json:"gid,omitempty"`
|
||||
Groups []string `json:"groups,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Home *string `json:"home,omitempty"`
|
||||
Shell *string `json:"shell,omitempty"`
|
||||
Password *string `json:"password,omitempty"`
|
||||
Key *string `json:"key,omitempty"`
|
||||
}
|
||||
|
||||
func NewUsersStage(options *UsersStageOptions) *Stage {
|
||||
return &Stage{
|
||||
Name: "org.osbuild.users",
|
||||
Options: options,
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue