command/build: -parallel=false to disable parallelization [GH-924]
This commit is contained in:
parent
6fe0cb76ea
commit
b5f153a1a2
|
@ -10,6 +10,8 @@ FEATURES:
|
|||
IMPROVEMENTS:
|
||||
|
||||
* builder/vmware: Workstation 10 support for Linux. [GH-900]
|
||||
* command/build: Added '-parallel' flag so you can disable parallelization
|
||||
with `-no-parallel`. [GH-924]
|
||||
|
||||
BUG FIXES:
|
||||
|
||||
|
|
|
@ -23,12 +23,14 @@ func (Command) Help() string {
|
|||
func (c Command) Run(env packer.Environment, args []string) int {
|
||||
var cfgDebug bool
|
||||
var cfgForce bool
|
||||
var cfgParallel bool
|
||||
buildOptions := new(cmdcommon.BuildOptions)
|
||||
|
||||
cmdFlags := flag.NewFlagSet("build", flag.ContinueOnError)
|
||||
cmdFlags.Usage = func() { env.Ui().Say(c.Help()) }
|
||||
cmdFlags.BoolVar(&cfgDebug, "debug", false, "debug mode for builds")
|
||||
cmdFlags.BoolVar(&cfgForce, "force", false, "force a build if artifacts exist")
|
||||
cmdFlags.BoolVar(&cfgParallel, "parallel", true, "enable/disable parallelization")
|
||||
cmdcommon.BuildOptionFlags(cmdFlags, buildOptions)
|
||||
if err := cmdFlags.Parse(args); err != nil {
|
||||
return 1
|
||||
|
@ -176,6 +178,11 @@ func (c Command) Run(env packer.Environment, args []string) int {
|
|||
wg.Wait()
|
||||
}
|
||||
|
||||
if !cfgParallel {
|
||||
log.Printf("Parallelization disabled, waiting for build to finish: %s", b.Name())
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
if interrupted {
|
||||
log.Println("Interrupted, not going to start any more builds.")
|
||||
break
|
||||
|
|
|
@ -13,6 +13,7 @@ Options:
|
|||
-machine-readable Machine-readable output
|
||||
-except=foo,bar,baz Build all builds other than these
|
||||
-only=foo,bar,baz Only build the given builds by name
|
||||
-parallel=false Disable parallelization (on by default)
|
||||
-var 'key=value' Variable for templates, can be used multiple times.
|
||||
-var-file=path JSON file containing user variables.
|
||||
`
|
||||
|
|
Loading…
Reference in New Issue