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
47dcd473
Commit
47dcd473
authored
Jun 17, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
command/build: Improved output when builds error
parent
f4a5adf4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
command/build/command.go
command/build/command.go
+15
-5
No files found.
command/build/command.go
View file @
47dcd473
...
...
@@ -164,6 +164,7 @@ func (c Command) Run(env packer.Environment, args []string) int {
var
interruptWg
,
wg
sync
.
WaitGroup
interrupted
:=
false
artifacts
:=
make
(
map
[
string
]
packer
.
Artifact
)
errors
:=
make
(
map
[
string
]
error
)
for
_
,
b
:=
range
builds
{
// Increment the waitgroup so we wait for this item to finish properly
wg
.
Add
(
1
)
...
...
@@ -187,15 +188,17 @@ func (c Command) Run(env packer.Environment, args []string) int {
go
func
(
b
packer
.
Build
)
{
defer
wg
.
Done
()
var
err
error
log
.
Printf
(
"Starting build run: %s"
,
b
.
Name
()
)
ui
:=
buildUis
[
b
.
Name
()
]
artifact
s
[
b
.
Name
()],
err
=
b
.
Run
(
ui
,
env
.
Cache
())
name
:=
b
.
Name
()
log
.
Printf
(
"Starting build run: %s"
,
name
)
ui
:=
buildUis
[
name
]
artifact
,
err
:
=
b
.
Run
(
ui
,
env
.
Cache
())
if
err
!=
nil
{
ui
.
Error
(
fmt
.
Sprintf
(
"Build errored: %s"
,
err
))
errors
[
name
]
=
err
}
else
{
ui
.
Say
(
"Build finished."
)
artifacts
[
name
]
=
artifact
}
}(
b
)
...
...
@@ -223,8 +226,15 @@ func (c Command) Run(env packer.Environment, args []string) int {
return
1
}
if
len
(
errors
)
>
0
{
env
.
Ui
()
.
Error
(
"
\n
==> Some builds didn't complete successfully and had errors:"
)
for
name
,
err
:=
range
errors
{
env
.
Ui
()
.
Error
(
fmt
.
Sprintf
(
"--> %s: %s"
,
name
,
err
))
}
}
// Output all the artifacts
env
.
Ui
()
.
Say
(
"
\n
==>
The build completed! The artifacts created we
re:"
)
env
.
Ui
()
.
Say
(
"
\n
==>
Builds finished. The artifacts of successful builds a
re:"
)
for
name
,
artifact
:=
range
artifacts
{
var
message
bytes
.
Buffer
fmt
.
Fprintf
(
&
message
,
"--> %s: "
,
name
)
...
...
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