Skip to content

Commit

Permalink
manifest: add devices/mounts to the files/dir stages in bootc
Browse files Browse the repository at this point in the history
Without this the files/dir stages will not have access to the
created bootc container filesystem.

This was found by the integration test in
osbuild/bootc-image-builder#841
  • Loading branch information
mvo5 committed Feb 26, 2025
1 parent 9d95516 commit cd30d69
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 13 additions & 2 deletions pkg/manifest/raw_bootc.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,22 @@ func (p *RawBootcImage) serialize() osbuild.Pipeline {

// First create custom directories, because some of the custom files may depend on them
if len(p.Directories) > 0 {
pipeline.AddStages(osbuild.GenDirectoryNodesStages(p.Directories)...)

stages := osbuild.GenDirectoryNodesStages(p.Directories)
for _, stage := range stages {
stage.Mounts = mounts
stage.Devices = devices
}
pipeline.AddStages(stages...)
}

if len(p.Files) > 0 {
pipeline.AddStages(osbuild.GenFileNodesStages(p.Files)...)
stages := osbuild.GenFileNodesStages(p.Files)
for _, stage := range stages {
stage.Mounts = mounts
stage.Devices = devices
}
pipeline.AddStages(stages...)
}

// XXX: maybe go back to adding this conditionally when we stop
Expand Down
2 changes: 2 additions & 0 deletions pkg/manifest/raw_bootc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ func TestRawBootcImageSerializeCreateFilesDirs(t *testing.T) {
require.NotNil(t, mkdirStage)
mkdirOptions := mkdirStage.Options.(*osbuild.MkdirStageOptions)
assert.Equal(t, "/path/to/dir", mkdirOptions.Paths[0].Path)
assertBootcDeploymentAndBindMount(t, mkdirStage)
} else {
assert.Nil(t, mkdirStage)
}
Expand All @@ -326,6 +327,7 @@ func TestRawBootcImageSerializeCreateFilesDirs(t *testing.T) {
require.NotNil(t, copyStage)
copyOptions := copyStage.Options.(*osbuild.CopyStageOptions)
assert.Equal(t, "tree:///path/to/file", copyOptions.Paths[0].To)
assertBootcDeploymentAndBindMount(t, copyStage)
} else {
assert.Nil(t, copyStage)
}
Expand Down

0 comments on commit cd30d69

Please sign in to comment.