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
521b59a6
Commit
521b59a6
authored
Jun 12, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make everything support the new builder interface
parent
12cc8e98
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
30 deletions
+21
-30
builder/amazonebs/builder.go
builder/amazonebs/builder.go
+3
-17
builder/virtualbox/builder.go
builder/virtualbox/builder.go
+2
-2
builder/vmware/builder.go
builder/vmware/builder.go
+5
-6
command/build/command.go
command/build/command.go
+8
-2
packer/plugin/builder.go
packer/plugin/builder.go
+1
-1
packer/plugin/builder_test.go
packer/plugin/builder_test.go
+2
-2
No files found.
builder/amazonebs/builder.go
View file @
521b59a6
...
...
@@ -100,21 +100,7 @@ func (b *Builder) Prepare(raw interface{}) error {
return
nil
}
func
(
b
*
Builder
)
Run
(
ui
packer
.
Ui
,
hook
packer
.
Hook
,
cache
packer
.
Cache
)
packer
.
Artifact
{
// Basic sanity checks. These are panics now because the Prepare
// method should verify these exist and such.
if
b
.
config
.
AccessKey
==
""
{
panic
(
"access key not filled in"
)
}
if
b
.
config
.
SecretKey
==
""
{
panic
(
"secret key not filled in"
)
}
if
b
.
config
.
Region
==
""
{
panic
(
"region not filled in"
)
}
func
(
b
*
Builder
)
Run
(
ui
packer
.
Ui
,
hook
packer
.
Hook
,
cache
packer
.
Cache
)
(
packer
.
Artifact
,
error
)
{
region
,
ok
:=
aws
.
Regions
[
b
.
config
.
Region
]
if
!
ok
{
panic
(
"region not found"
)
...
...
@@ -147,11 +133,11 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) packer
// If there are no AMIs, then jsut return
if
_
,
ok
:=
state
[
"amis"
];
!
ok
{
return
nil
return
nil
,
nil
}
// Build the artifact and return it
return
&
artifact
{
state
[
"amis"
]
.
(
map
[
string
]
string
)}
return
&
artifact
{
state
[
"amis"
]
.
(
map
[
string
]
string
)}
,
nil
}
func
(
b
*
Builder
)
Cancel
()
{
...
...
builder/virtualbox/builder.go
View file @
521b59a6
...
...
@@ -169,7 +169,7 @@ func (b *Builder) Prepare(raw interface{}) error {
return
nil
}
func
(
b
*
Builder
)
Run
(
ui
packer
.
Ui
,
hook
packer
.
Hook
,
cache
packer
.
Cache
)
packer
.
Artifact
{
func
(
b
*
Builder
)
Run
(
ui
packer
.
Ui
,
hook
packer
.
Hook
,
cache
packer
.
Cache
)
(
packer
.
Artifact
,
error
)
{
steps
:=
[]
multistep
.
Step
{
new
(
stepDownloadISO
),
new
(
stepPrepareOutputDir
),
...
...
@@ -197,7 +197,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) packer
b
.
runner
=
&
multistep
.
BasicRunner
{
Steps
:
steps
}
b
.
runner
.
Run
(
state
)
return
nil
return
nil
,
nil
}
func
(
b
*
Builder
)
Cancel
()
{
...
...
builder/vmware/builder.go
View file @
521b59a6
...
...
@@ -184,7 +184,7 @@ func (b *Builder) Prepare(raw interface{}) error {
return
nil
}
func
(
b
*
Builder
)
Run
(
ui
packer
.
Ui
,
hook
packer
.
Hook
,
cache
packer
.
Cache
)
packer
.
Artifact
{
func
(
b
*
Builder
)
Run
(
ui
packer
.
Ui
,
hook
packer
.
Hook
,
cache
packer
.
Cache
)
(
packer
.
Artifact
,
error
)
{
// Seed the random number generator
rand
.
Seed
(
time
.
Now
()
.
UTC
()
.
UnixNano
())
...
...
@@ -216,11 +216,11 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) packer
// If we were interrupted or cancelled, then just exit.
if
_
,
ok
:=
state
[
multistep
.
StateCancelled
];
ok
{
return
nil
return
nil
,
nil
}
if
_
,
ok
:=
state
[
multistep
.
StateHalted
];
ok
{
return
nil
return
nil
,
nil
}
// Compile the artifact list
...
...
@@ -231,11 +231,10 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) packer
}
if
err
:=
filepath
.
Walk
(
b
.
config
.
OutputDir
,
visit
);
err
!=
nil
{
ui
.
Error
(
fmt
.
Sprintf
(
"Error collecting result files: %s"
,
err
))
return
nil
return
nil
,
err
}
return
&
Artifact
{
b
.
config
.
OutputDir
,
files
}
return
&
Artifact
{
b
.
config
.
OutputDir
,
files
}
,
nil
}
func
(
b
*
Builder
)
Cancel
()
{
...
...
command/build/command.go
View file @
521b59a6
...
...
@@ -139,10 +139,16 @@ 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
()]
artifacts
[
b
.
Name
()]
=
b
.
Run
(
ui
,
env
.
Cache
())
ui
.
Say
(
"Build finished."
)
artifacts
[
b
.
Name
()],
err
=
b
.
Run
(
ui
,
env
.
Cache
())
if
err
!=
nil
{
ui
.
Error
(
fmt
.
Sprintf
(
"Build errored: %s"
,
err
))
}
else
{
ui
.
Say
(
"Build finished."
)
}
}(
b
)
}
...
...
packer/plugin/builder.go
View file @
521b59a6
...
...
@@ -19,7 +19,7 @@ func (b *cmdBuilder) Prepare(config interface{}) error {
return
b
.
builder
.
Prepare
(
config
)
}
func
(
b
*
cmdBuilder
)
Run
(
ui
packer
.
Ui
,
hook
packer
.
Hook
,
cache
packer
.
Cache
)
packer
.
Artifact
{
func
(
b
*
cmdBuilder
)
Run
(
ui
packer
.
Ui
,
hook
packer
.
Hook
,
cache
packer
.
Cache
)
(
packer
.
Artifact
,
error
)
{
defer
func
()
{
r
:=
recover
()
b
.
checkExit
(
r
,
nil
)
...
...
packer/plugin/builder_test.go
View file @
521b59a6
...
...
@@ -12,8 +12,8 @@ func (helperBuilder) Prepare(interface{}) error {
return
nil
}
func
(
helperBuilder
)
Run
(
packer
.
Ui
,
packer
.
Hook
,
packer
.
Cache
)
packer
.
Artifact
{
return
nil
func
(
helperBuilder
)
Run
(
packer
.
Ui
,
packer
.
Hook
,
packer
.
Cache
)
(
packer
.
Artifact
,
error
)
{
return
nil
,
nil
}
func
(
helperBuilder
)
Cancel
()
{}
...
...
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