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
bd843cfc
Commit
bd843cfc
authored
Jun 14, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
command/build: -debug flag enables debug mode
parent
6c718bc3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
command/build/command.go
command/build/command.go
+11
-1
command/build/help.go
command/build/help.go
+1
-0
No files found.
command/build/command.go
View file @
bd843cfc
...
@@ -20,11 +20,13 @@ func (Command) Help() string {
...
@@ -20,11 +20,13 @@ func (Command) Help() string {
}
}
func
(
c
Command
)
Run
(
env
packer
.
Environment
,
args
[]
string
)
int
{
func
(
c
Command
)
Run
(
env
packer
.
Environment
,
args
[]
string
)
int
{
var
cfgDebug
bool
var
cfgExcept
[]
string
var
cfgExcept
[]
string
var
cfgOnly
[]
string
var
cfgOnly
[]
string
cmdFlags
:=
flag
.
NewFlagSet
(
"build"
,
flag
.
ContinueOnError
)
cmdFlags
:=
flag
.
NewFlagSet
(
"build"
,
flag
.
ContinueOnError
)
cmdFlags
.
Usage
=
func
()
{
env
.
Ui
()
.
Say
(
c
.
Help
())
}
cmdFlags
.
Usage
=
func
()
{
env
.
Ui
()
.
Say
(
c
.
Help
())
}
cmdFlags
.
BoolVar
(
&
cfgDebug
,
"debug"
,
false
,
"debug mode for builds"
)
cmdFlags
.
Var
((
*
stringSliceValue
)(
&
cfgExcept
),
"except"
,
"build all builds except these"
)
cmdFlags
.
Var
((
*
stringSliceValue
)(
&
cfgExcept
),
"except"
,
"build all builds except these"
)
cmdFlags
.
Var
((
*
stringSliceValue
)(
&
cfgOnly
),
"only"
,
"only build the given builds by name"
)
cmdFlags
.
Var
((
*
stringSliceValue
)(
&
cfgOnly
),
"only"
,
"only build the given builds by name"
)
if
err
:=
cmdFlags
.
Parse
(
args
);
err
!=
nil
{
if
err
:=
cmdFlags
.
Parse
(
args
);
err
!=
nil
{
...
@@ -141,9 +143,12 @@ func (c Command) Run(env packer.Environment, args []string) int {
...
@@ -141,9 +143,12 @@ func (c Command) Run(env packer.Environment, args []string) int {
// Add a newline between the color output and the actual output
// Add a newline between the color output and the actual output
env
.
Ui
()
.
Say
(
""
)
env
.
Ui
()
.
Say
(
""
)
// Prepare all the builds
log
.
Printf
(
"Build debug mode: %v"
,
cfgDebug
)
// Set the debug mode and prepare all the builds
for
_
,
b
:=
range
builds
{
for
_
,
b
:=
range
builds
{
log
.
Printf
(
"Preparing build: %s"
,
b
.
Name
())
log
.
Printf
(
"Preparing build: %s"
,
b
.
Name
())
b
.
SetDebug
(
cfgDebug
)
err
:=
b
.
Prepare
()
err
:=
b
.
Prepare
()
if
err
!=
nil
{
if
err
!=
nil
{
env
.
Ui
()
.
Error
(
err
.
Error
())
env
.
Ui
()
.
Error
(
err
.
Error
())
...
@@ -173,6 +178,11 @@ func (c Command) Run(env packer.Environment, args []string) int {
...
@@ -173,6 +178,11 @@ func (c Command) Run(env packer.Environment, args []string) int {
ui
.
Say
(
"Build finished."
)
ui
.
Say
(
"Build finished."
)
}
}
}(
b
)
}(
b
)
if
cfgDebug
{
log
.
Printf
(
"Debug enabled, so waiting for build to finish: %s"
,
b
.
Name
())
wg
.
Wait
()
}
}
}
// Handle signals
// Handle signals
...
...
command/build/help.go
View file @
bd843cfc
...
@@ -8,6 +8,7 @@ Usage: packer build TEMPLATE
...
@@ -8,6 +8,7 @@ Usage: packer build TEMPLATE
Options:
Options:
-debug Debug mode enabled for builds
-except=foo,bar,baz Build all builds other than these
-except=foo,bar,baz Build all builds other than these
-only=foo,bar,baz Only build the given builds by name
-only=foo,bar,baz Only build the given builds by 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