Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
185d2765
Commit
185d2765
authored
May 10, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
command/build: Run the builds in parallel
parent
077f15bd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-1
builder/amazonebs/builder.go
builder/amazonebs/builder.go
+5
-1
command/build/command.go
command/build/command.go
+18
-0
No files found.
builder/amazonebs/builder.go
View file @
185d2765
...
...
@@ -38,7 +38,11 @@ func (b *Builder) Prepare(raw interface{}) (err error) {
}
log
.
Printf
(
"Config: %+v
\n
"
,
b
.
config
)
// TODO: Validate the configuration
return
}
func
(
*
Builder
)
Run
(
packer
.
Build
,
packer
.
Ui
)
{}
func
(
*
Builder
)
Run
(
b
packer
.
Build
,
ui
packer
.
Ui
)
{
ui
.
Say
(
"Building an AWS image...
\n
"
)
}
command/build/command.go
View file @
185d2765
...
...
@@ -4,6 +4,7 @@ import (
"github.com/mitchellh/packer/packer"
"io/ioutil"
"log"
"sync"
)
type
Command
byte
...
...
@@ -54,6 +55,23 @@ func (Command) Run(env packer.Environment, args []string) int {
}
}
// Run all the builds in parallel and wait for them to complete
var
wg
sync
.
WaitGroup
for
_
,
b
:=
range
builds
{
log
.
Printf
(
"Starting build run: %s
\n
"
,
b
.
Name
())
// Increment the waitgroup so we wait for this item to finish properly
wg
.
Add
(
1
)
// Run the build in a goroutine
go
func
()
{
defer
wg
.
Done
()
b
.
Run
(
env
.
Ui
())
}()
}
wg
.
Wait
()
env
.
Ui
()
.
Say
(
"YAY!
\n
"
)
return
0
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment