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
a5bc5bec
Commit
a5bc5bec
authored
Aug 08, 2014
by
Eric Johnson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1397 from jfrazelle/disk_size
add disk size to google compute
parents
391dffd8
8bc696ce
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
2 deletions
+13
-2
builder/googlecompute/config.go
builder/googlecompute/config.go
+5
-0
builder/googlecompute/driver.go
builder/googlecompute/driver.go
+1
-0
builder/googlecompute/driver_gce.go
builder/googlecompute/driver_gce.go
+1
-0
builder/googlecompute/step_create_image.go
builder/googlecompute/step_create_image.go
+2
-2
builder/googlecompute/step_create_instance.go
builder/googlecompute/step_create_instance.go
+1
-0
website/source/docs/builders/googlecompute.markdown
website/source/docs/builders/googlecompute.markdown
+3
-0
No files found.
builder/googlecompute/config.go
View file @
a5bc5bec
...
@@ -18,6 +18,7 @@ type Config struct {
...
@@ -18,6 +18,7 @@ type Config struct {
BucketName
string
`mapstructure:"bucket_name"`
BucketName
string
`mapstructure:"bucket_name"`
ClientSecretsFile
string
`mapstructure:"client_secrets_file"`
ClientSecretsFile
string
`mapstructure:"client_secrets_file"`
DiskSizeGb
int64
`mapstructure:"disk_size"`
ImageName
string
`mapstructure:"image_name"`
ImageName
string
`mapstructure:"image_name"`
ImageDescription
string
`mapstructure:"image_description"`
ImageDescription
string
`mapstructure:"image_description"`
InstanceName
string
`mapstructure:"instance_name"`
InstanceName
string
`mapstructure:"instance_name"`
...
@@ -64,6 +65,10 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
...
@@ -64,6 +65,10 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
c
.
Network
=
"default"
c
.
Network
=
"default"
}
}
if
c
.
DiskSizeGb
==
0
{
c
.
DiskSizeGb
=
10
}
if
c
.
ImageDescription
==
""
{
if
c
.
ImageDescription
==
""
{
c
.
ImageDescription
=
"Created by Packer"
c
.
ImageDescription
=
"Created by Packer"
}
}
...
...
builder/googlecompute/driver.go
View file @
a5bc5bec
...
@@ -25,6 +25,7 @@ type Driver interface {
...
@@ -25,6 +25,7 @@ type Driver interface {
type
InstanceConfig
struct
{
type
InstanceConfig
struct
{
Description
string
Description
string
DiskSizeGb
int64
Image
string
Image
string
MachineType
string
MachineType
string
Metadata
map
[
string
]
string
Metadata
map
[
string
]
string
...
...
builder/googlecompute/driver_gce.go
View file @
a5bc5bec
...
@@ -177,6 +177,7 @@ func (d *driverGCE) RunInstance(c *InstanceConfig) (<-chan error, error) {
...
@@ -177,6 +177,7 @@ func (d *driverGCE) RunInstance(c *InstanceConfig) (<-chan error, error) {
AutoDelete
:
true
,
AutoDelete
:
true
,
InitializeParams
:
&
compute
.
AttachedDiskInitializeParams
{
InitializeParams
:
&
compute
.
AttachedDiskInitializeParams
{
SourceImage
:
image
.
SelfLink
,
SourceImage
:
image
.
SelfLink
,
DiskSizeGb
:
c
.
DiskSizeGb
,
},
},
},
},
},
},
...
...
builder/googlecompute/step_create_image.go
View file @
a5bc5bec
...
@@ -31,8 +31,8 @@ func (s *StepCreateImage) Run(state multistep.StateBag) multistep.StepAction {
...
@@ -31,8 +31,8 @@ func (s *StepCreateImage) Run(state multistep.StateBag) multistep.StepAction {
ui
.
Say
(
"Creating image..."
)
ui
.
Say
(
"Creating image..."
)
cmd
:=
new
(
packer
.
RemoteCmd
)
cmd
:=
new
(
packer
.
RemoteCmd
)
cmd
.
Command
=
fmt
.
Sprintf
(
"%s%s --output_file_name %s"
,
cmd
.
Command
=
fmt
.
Sprintf
(
"%s%s --output_file_name %s
--fssize %d
"
,
sudoPrefix
,
imageBundleCmd
,
imageFilename
)
sudoPrefix
,
imageBundleCmd
,
imageFilename
,
config
.
DiskSizeGb
*
1024
*
1024
*
1024
)
err
:=
cmd
.
StartWithUi
(
comm
,
ui
)
err
:=
cmd
.
StartWithUi
(
comm
,
ui
)
if
err
==
nil
&&
cmd
.
ExitStatus
!=
0
{
if
err
==
nil
&&
cmd
.
ExitStatus
!=
0
{
err
=
fmt
.
Errorf
(
err
=
fmt
.
Errorf
(
...
...
builder/googlecompute/step_create_instance.go
View file @
a5bc5bec
...
@@ -28,6 +28,7 @@ func (s *StepCreateInstance) Run(state multistep.StateBag) multistep.StepAction
...
@@ -28,6 +28,7 @@ func (s *StepCreateInstance) Run(state multistep.StateBag) multistep.StepAction
errCh
,
err
:=
driver
.
RunInstance
(
&
InstanceConfig
{
errCh
,
err
:=
driver
.
RunInstance
(
&
InstanceConfig
{
Description
:
"New instance created by Packer"
,
Description
:
"New instance created by Packer"
,
DiskSizeGb
:
config
.
DiskSizeGb
,
Image
:
config
.
SourceImage
,
Image
:
config
.
SourceImage
,
MachineType
:
config
.
MachineType
,
MachineType
:
config
.
MachineType
,
Metadata
:
map
[
string
]
string
{
Metadata
:
map
[
string
]
string
{
...
...
website/source/docs/builders/googlecompute.markdown
View file @
a5bc5bec
...
@@ -91,6 +91,9 @@ each category, the available options are alphabetized and described.
...
@@ -91,6 +91,9 @@ each category, the available options are alphabetized and described.
### Optional:
### Optional:
*
`disk_size`
(integer) - The size of the disk in GB.
This defaults to 10, which is 10GB.
*
`image_name`
(string) - The unique name of the resulting image.
*
`image_name`
(string) - The unique name of the resulting image.
Defaults to
`packer-{{timestamp}}`
.
Defaults to
`packer-{{timestamp}}`
.
...
...
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