Parallel overlay builds
- Closes #1018 Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
@@ -66,9 +66,9 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||
defer syscall.Umask(oldMask)
|
||||
|
||||
if len(OverlayNames) > 0 {
|
||||
err = overlay.BuildSpecificOverlays(db, OverlayNames)
|
||||
err = overlay.BuildSpecificOverlays(db, OverlayNames, Workers)
|
||||
} else {
|
||||
err = overlay.BuildAllOverlays(db)
|
||||
err = overlay.BuildAllOverlays(db, Workers)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -2,6 +2,7 @@ package build
|
||||
|
||||
import (
|
||||
"log"
|
||||
"runtime"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/warewulf/warewulf/internal/pkg/node"
|
||||
@@ -31,6 +32,7 @@ var (
|
||||
}
|
||||
OverlayNames []string
|
||||
OverlayDir string
|
||||
Workers int
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -44,7 +46,7 @@ func init() {
|
||||
}
|
||||
baseCmd.PersistentFlags().StringVarP(&OverlayDir, "output", "o", "", `Do not create an overlay image for distribution but write to
|
||||
the given directory. An overlay must also be ge given to use this option.`)
|
||||
|
||||
baseCmd.PersistentFlags().IntVar(&Workers, "workers", runtime.NumCPU(), "The number of parallel workers building overlays")
|
||||
}
|
||||
|
||||
// GetRootCommand returns the root cobra.Command for the application.
|
||||
|
||||
Reference in New Issue
Block a user