osbuild2: new org.osbuild.ostree.passwd stage
Add support for the `org.osbuild.ostree.passwd` and with it also support for the `org.osbuild.ostree.checkout` input. This stage can be used to pre-load the user and groups database from an existing commit to ensure that uids/gids are stable.
This commit is contained in:
parent
7059995268
commit
f8c8f28ac8
3 changed files with 51 additions and 0 deletions
|
|
@ -13,3 +13,30 @@ func NewOSTreeInput() *OSTreeInput {
|
|||
input.Origin = "org.osbuild.source"
|
||||
return input
|
||||
}
|
||||
|
||||
// Inputs of type org.osbuild.ostree.checkout
|
||||
type OSTreeCheckoutInput struct {
|
||||
inputCommon
|
||||
References OSTreeCheckoutReferences `json:"references"`
|
||||
}
|
||||
|
||||
func (OSTreeCheckoutInput) isStageInput() {}
|
||||
|
||||
type OSTreeCheckoutReferences []string
|
||||
|
||||
func (OSTreeCheckoutReferences) isReferences() {}
|
||||
|
||||
// NewOSTreeCommitsInput creates a new OSTreeCommitsInputs
|
||||
// where `origin` is either "org.osbuild.source" or "org.osbuild.pipeline
|
||||
// `name` is the id of the commit, i.e. its digest or the pipeline name that
|
||||
// produced it)
|
||||
func NewOSTreeCheckoutInput(origin, name string) *OSTreeCheckoutInput {
|
||||
input := new(OSTreeCheckoutInput)
|
||||
input.Type = "org.osbuild.ostree.checkout"
|
||||
input.Origin = origin
|
||||
|
||||
inputRefs := make([]string, 1)
|
||||
inputRefs[0] = name
|
||||
input.References = inputRefs
|
||||
return input
|
||||
}
|
||||
|
|
|
|||
21
internal/osbuild2/ostree_passwd_stage.go
Normal file
21
internal/osbuild2/ostree_passwd_stage.go
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package osbuild2
|
||||
|
||||
// The org.osbuild.ostree.passwd stage has no options so far.
|
||||
type OSTreePasswdStageOptions struct {
|
||||
}
|
||||
|
||||
func (s *OSTreePasswdStageOptions) isStageOptions() {}
|
||||
|
||||
type OSTreePasswdStageInputs struct {
|
||||
Commits *OSTreeCheckoutInput `json:"commits"`
|
||||
}
|
||||
|
||||
func (OSTreePasswdStageInputs) isStageInputs() {}
|
||||
|
||||
// A new org.osbuild.ostree.passwd stage to pre-fill the user and group databases
|
||||
func NewOSTreePasswdStage(origin, name string) *Stage {
|
||||
return &Stage{
|
||||
Type: "org.osbuild.ostree.passwd",
|
||||
Inputs: &OSTreePasswdStageInputs{Commits: NewOSTreeCheckoutInput(origin, name)},
|
||||
}
|
||||
}
|
||||
|
|
@ -100,6 +100,9 @@ func (stage *Stage) UnmarshalJSON(data []byte) error {
|
|||
case "org.osbuild.ostree.commit":
|
||||
options = new(OSTreeCommitStageOptions)
|
||||
inputs = new(OSTreeCommitStageInputs)
|
||||
case "org.osbuild.ostree.passwd":
|
||||
options = new(OSTreePasswdStageOptions)
|
||||
inputs = new(OSTreePasswdStageInputs)
|
||||
case "org.osbuild.ostree.pull":
|
||||
options = new(OSTreePullStageOptions)
|
||||
inputs = new(OSTreePullStageInputs)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue