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
9387ba0f
Commit
9387ba0f
authored
Jul 15, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
packer: Make builder type available in configs [GH-154]
parent
f621f889
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
40 deletions
+49
-40
builder/virtualbox/builder.go
builder/virtualbox/builder.go
+27
-27
builder/vmware/builder.go
builder/vmware/builder.go
+3
-3
packer/build.go
packer/build.go
+9
-3
packer/build_test.go
packer/build_test.go
+9
-6
packer/template_test.go
packer/template_test.go
+1
-1
No files found.
builder/virtualbox/builder.go
View file @
9387ba0f
...
...
@@ -26,30 +26,30 @@ type Builder struct {
}
type
config
struct
{
BootCommand
[]
string
`mapstructure:"boot_command"`
DiskSize
uint
`mapstructure:"disk_size"`
FloppyFiles
[]
string
`mapstructure:"floppy_files"`
GuestAdditionsPath
string
`mapstructure:"guest_additions_path"`
GuestAdditionsURL
string
`mapstructure:"guest_additions_url"`
GuestAdditionsSHA256
string
`mapstructure:"guest_additions_sha256"`
GuestOSType
string
`mapstructure:"guest_os_type"`
Headless
bool
`mapstructure:"headless"`
HTTPDir
string
`mapstructure:"http_directory"`
HTTPPortMin
uint
`mapstructure:"http_port_min"`
HTTPPortMax
uint
`mapstructure:"http_port_max"`
ISOChecksum
string
`mapstructure:"iso_checksum"`
ISOChecksumType
string
`mapstructure:"iso_checksum_type"`
ISOUrl
string
`mapstructure:"iso_url"`
OutputDir
string
`mapstructure:"output_directory"`
ShutdownCommand
string
`mapstructure:"shutdown_command"`
SSHHostPortMin
uint
`mapstructure:"ssh_host_port_min"`
SSHHostPortMax
uint
`mapstructure:"ssh_host_port_max"`
SSHPassword
string
`mapstructure:"ssh_password"`
SSHPort
uint
`mapstructure:"ssh_port"`
SSHUser
string
`mapstructure:"ssh_username"`
VBoxVersionFile
string
`mapstructure:"virtualbox_version_file"`
VBoxManage
[][]
string
`mapstructure:"vboxmanage"`
VMName
string
`mapstructure:"vm_name"`
BootCommand
[]
string
`mapstructure:"boot_command"`
DiskSize
uint
`mapstructure:"disk_size"`
FloppyFiles
[]
string
`mapstructure:"floppy_files"`
GuestAdditionsPath
string
`mapstructure:"guest_additions_path"`
GuestAdditionsURL
string
`mapstructure:"guest_additions_url"`
GuestAdditionsSHA256
string
`mapstructure:"guest_additions_sha256"`
GuestOSType
string
`mapstructure:"guest_os_type"`
Headless
bool
`mapstructure:"headless"`
HTTPDir
string
`mapstructure:"http_directory"`
HTTPPortMin
uint
`mapstructure:"http_port_min"`
HTTPPortMax
uint
`mapstructure:"http_port_max"`
ISOChecksum
string
`mapstructure:"iso_checksum"`
ISOChecksumType
string
`mapstructure:"iso_checksum_type"`
ISOUrl
string
`mapstructure:"iso_url"`
OutputDir
string
`mapstructure:"output_directory"`
ShutdownCommand
string
`mapstructure:"shutdown_command"`
SSHHostPortMin
uint
`mapstructure:"ssh_host_port_min"`
SSHHostPortMax
uint
`mapstructure:"ssh_host_port_max"`
SSHPassword
string
`mapstructure:"ssh_password"`
SSHPort
uint
`mapstructure:"ssh_port"`
SSHUser
string
`mapstructure:"ssh_username"`
VBoxVersionFile
string
`mapstructure:"virtualbox_version_file"`
VBoxManage
[][]
string
`mapstructure:"vboxmanage"`
VMName
string
`mapstructure:"vm_name"`
PackerBuildName
string
`mapstructure:"packer_build_name"`
PackerDebug
bool
`mapstructure:"packer_debug"`
...
...
@@ -59,9 +59,9 @@ type config struct {
RawShutdownTimeout
string
`mapstructure:"shutdown_timeout"`
RawSSHWaitTimeout
string
`mapstructure:"ssh_wait_timeout"`
bootWait
time
.
Duration
``
shutdownTimeout
time
.
Duration
``
sshWaitTimeout
time
.
Duration
``
bootWait
time
.
Duration
``
shutdownTimeout
time
.
Duration
``
sshWaitTimeout
time
.
Duration
``
}
func
(
b
*
Builder
)
Prepare
(
raws
...
interface
{})
error
{
...
...
builder/vmware/builder.go
View file @
9387ba0f
...
...
@@ -60,9 +60,9 @@ type config struct {
RawShutdownTimeout
string
`mapstructure:"shutdown_timeout"`
RawSSHWaitTimeout
string
`mapstructure:"ssh_wait_timeout"`
bootWait
time
.
Duration
``
shutdownTimeout
time
.
Duration
``
sshWaitTimeout
time
.
Duration
``
bootWait
time
.
Duration
``
shutdownTimeout
time
.
Duration
``
sshWaitTimeout
time
.
Duration
``
}
func
(
b
*
Builder
)
Prepare
(
raws
...
interface
{})
error
{
...
...
packer/build.go
View file @
9387ba0f
...
...
@@ -11,6 +11,11 @@ const (
// build.
BuildNameConfigKey
=
"packer_build_name"
// This is the key in the configuration that is set to the type
// of the builder that is run. This is useful for provisioners and
// such who want to make use of this.
BuilderTypeConfigKey
=
"packer_builder_type"
// This is the key in configurations that is set to "true" when Packer
// debugging is enabled.
DebugConfigKey
=
"packer_debug"
...
...
@@ -109,9 +114,10 @@ func (b *coreBuild) Prepare() (err error) {
b
.
prepareCalled
=
true
packerConfig
:=
map
[
string
]
interface
{}{
BuildNameConfigKey
:
b
.
name
,
DebugConfigKey
:
b
.
debug
,
ForceConfigKey
:
b
.
force
,
BuildNameConfigKey
:
b
.
name
,
BuilderTypeConfigKey
:
b
.
builderType
,
DebugConfigKey
:
b
.
debug
,
ForceConfigKey
:
b
.
force
,
}
// Prepare the builder
...
...
packer/build_test.go
View file @
9387ba0f
...
...
@@ -11,6 +11,7 @@ func testBuild() *coreBuild {
name
:
"test"
,
builder
:
&
TestBuilder
{
artifactId
:
"b"
},
builderConfig
:
42
,
builderType
:
"foo"
,
hooks
:
map
[
string
][]
Hook
{
"foo"
:
[]
Hook
{
&
TestHook
{}},
},
...
...
@@ -40,9 +41,10 @@ func TestBuild_Prepare(t *testing.T) {
assert
:=
asserts
.
NewTestingAsserts
(
t
,
true
)
packerConfig
:=
map
[
string
]
interface
{}{
BuildNameConfigKey
:
"test"
,
DebugConfigKey
:
false
,
ForceConfigKey
:
false
,
BuildNameConfigKey
:
"test"
,
BuilderTypeConfigKey
:
"foo"
,
DebugConfigKey
:
false
,
ForceConfigKey
:
false
,
}
build
:=
testBuild
()
...
...
@@ -87,9 +89,10 @@ func TestBuild_Prepare_Debug(t *testing.T) {
assert
:=
asserts
.
NewTestingAsserts
(
t
,
true
)
packerConfig
:=
map
[
string
]
interface
{}{
BuildNameConfigKey
:
"test"
,
DebugConfigKey
:
true
,
ForceConfigKey
:
false
,
BuildNameConfigKey
:
"test"
,
BuilderTypeConfigKey
:
"foo"
,
DebugConfigKey
:
true
,
ForceConfigKey
:
false
,
}
build
:=
testBuild
()
...
...
packer/template_test.go
View file @
9387ba0f
...
...
@@ -2,8 +2,8 @@ package packer
import
(
"cgl.tideland.biz/asserts"
"sort"
"reflect"
"sort"
"testing"
)
...
...
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