Commit Graph

122 Commits

Author SHA1 Message Date
Troy Toman 12f279fa79 add ability to set a different project-id for a network in the googlecloud builder 2016-12-02 15:22:36 -06:00
Rickard von Essen 6947a74151 Merge pull request #4162 from classmarkets/google-source-image-family
builder/googlecompute: support source image family
2016-11-26 17:26:47 +01:00
Rickard von Essen d18da5e679
Added printout of select source_image 2016-11-26 15:06:43 +01:00
Rickard von Essen 96e9a8e6e9 Removed default value for ssh_username 2016-11-17 22:30:34 +01:00
Peter Schultz bcb319640e builder/googlecompute: support source image family
Closes #4100
2016-11-13 16:54:04 +01:00
Matthew Hooker 5d0892bd37 Merge pull request #4101 from lwander/f-googlecompute-ssh-private-key-file
builder/googlecompute: Use ssh_private_key_file if provided
2016-11-03 11:04:02 -07:00
Lars Wander 583e341ae7 builder/googlecompute: Store empty public_key 2016-11-03 12:49:09 -04:00
Lars Wander 7f474d8f78 builder/googlecompute: Tests added 2016-11-03 12:45:52 -04:00
Scott Crunkleton 85210afe92 googlecompute: conditionally omit the wait for startup script step if no startup script is provided. 2016-11-02 15:20:21 -07:00
Lars Wander d70e783455 builder/googlecompute: Use ssh_private_key_file if provided
This seemed to be missing from the googlecompute provider. Now if the
ssh_private_key_file is provided, that will be used in place of a temporary
key. I didn't update the googlecompute specific docs under `./website/`, since
this parameter is already documented under the communicators templates page.
2016-11-02 17:04:34 -04:00
Matthew Hooker d920b3fbf4 run gofmt 2016-11-01 14:08:04 -07:00
YAMADA Tsuyoshi da7d317e46 googlecompute: Run instance with custom scopes 2016-10-22 15:46:14 +09:00
Rickard von Essen 924c0bc461 Merge pull request #3932 from pieter-lazzaro/googlecompute-createpassword
GCE Windows instance password creation
2016-09-30 22:01:56 +02:00
Rickard von Essen c0a4067151
builder/googlecompute: Print out WinRM password in debug mode. 2016-09-30 21:17:38 +02:00
Matthew Hooker a8e57d83d2 gofmt project.
noticed many unrelated changes being added to patches because of gofmt.

ran `find . -not -path "./vendor/*" -name "*.go" -exec gofmt -w {} \;`
2016-09-29 14:13:06 -07:00
Matthew Hooker a9abe43325 builder/amazon: add retry login when creating tags.
also move Retry from builder/googlecompute/common to common/retry
2016-09-28 18:22:31 -07:00
Pieter Lazzaro 5db1c1f503 Create a password for windows instances when using WinRM communicator and no password is provided. 2016-09-27 18:42:34 -04:00
Valentin Tjoncke ef1517064c googlecompute/builder: Always show message when checking image exists 2016-09-24 21:12:25 +02:00
nouney 4605f9559f Fix unreachable code 2016-09-23 20:38:28 +02:00
Valentin Tjoncke 6f545af7f7 builder/googlecompute: -force 2016-09-23 14:21:43 +02:00
Rickard von Essen 9ce70bfce0 Merge pull request #3338 from yuki-takeichi/gce-nvme 2016-09-20 12:50:43 +02:00
Yuki Takeichi 04078c5c48 Enable to select NVMe images for googlecompute builder 2016-09-20 12:47:14 +02:00
Orivej Desh 6762965696 Add -on-error command line argument to allow preserving artifacts on builder errors
Resolves #409
2016-09-16 12:15:00 +00:00
Scott Crunkleton b54b82d3ac Some googlecompute fixes and cleanup. Addresses https://github.com/mitchellh/packer/issues/3829. Changes:
- startup scripts don't run for Windows since it is isn't implemented yet.
- startup scripts use instance metadata instead of serial port output to flag when they are done.
- added licenses to Image data type (to check if an Image is a  Windows Image).
- added GetImage and GetImageFromProject to googlecompute Drivers.
- changed some of the builder/googlecompute tests to use github.com/stretchr/testify/assert.

Tests:
- (in the Packer directory) `go test .`, `go test ./builder/googlecompute`, and `go test ./post-processor/googlecompute-export`
- manual run of `packer build packer_template.json` with the following files

--packer_template.json--
{
  "builders": [
    {
      "type": "googlecompute",
      "account_file": "creds.json",
      "project_id": "google.com:packer-test",
      "source_image": "debian-8-jessie-v20160629",
      "zone": "us-central1-a",
      "startup_script_file": "startup_script.sh",
      "metadata": {
        "startup-script": "#!/bin/sh\necho \"This should be overwritten.\"",
        "startup-script-log-dest": "gs://packer-test.google.com.a.appspot.com/startup-script.log"
      },
      "image_name": "test-packer-modifications",
      "ssh_username": "foo"
    }
  ],
  "post-processors": [
    {
      "type": "googlecompute-export",
      "paths": [
        "gs://packer-test.google.com.a.appspot.com/foo.tar.gz",
        "gs://packer-test.google.com.a.appspot.com/bar.tar.gz"
      ],
      "keep_input_artifact": true
    }
  ]
}

--startup_script.sh--
\#!/bin/sh
echo "Hi, my name is Scott. I'm waiting 60 seconds!" >> /scott
sleep 60
echo "I'm done waiting!" >> /scott
2016-09-09 16:22:50 -07:00
Ingo Gottwald 0c1051a017 GCE builder: Switch to google.DefaultClient (#3655)
* GCE builder: Switch to google.DefaultClient

This enables authentication through an authenticated gcloud tool.

* GCE builder: Add docs about auth mech precedence
2016-08-27 03:12:55 +02:00
crunk1 55b5a45ae4 Created googlecompute-export post-processor. Modified the googlecompute builder to pass a few configuration values to its resulting artifact. These values can then be used in googlecompute-export post-processor.
Added documentation and changed authentication stuff on temporary VM.
2016-08-15 14:36:26 -07:00
Evan Brown a5c598264f builder/googlecompute: Support provisioning VM without external IP address
This change adds an `omit_external_ip` configuration property that, when true,
will cause no external IP address to be associated with the Google Compute
Engine VM provisioned to create an image. When using `omit_external_ip`, you
must also set the `use_internal_ip` configuration property to true.

Addresses #3296
2016-08-02 13:43:04 -07:00
Scott Crunkleton 7190fbeed8 Adding support for googlecompute startup scripts.
- Startup scripts can be provided through the instance creation metadata field 'startup-script'.
- Script log can be copied to a GCS location by setting the metadata field 'startup-script-log-dest'.
Added Retry method to googlecompute package.
Added GetSerialPortOutput to googlecompute Drivers.
Added StepWaitInstanceStartup (and associated test) which waits for an
instance startup-script to finish.
Changed the instance service account to use the same service account as the one provided in the Packer config template. It was the project default service account.

Tested googlecompute package with 'go test' and also performed builds
with a startup script and without a startup script.
2016-07-20 14:54:36 -07:00
Chris Bednarski 2f0e1218dc Move regexp to package scope so it will be validated by the compiler instead of at runtime 2016-05-13 15:37:25 -07:00
Peter Schultz a99a417db9 builder/googlecompute: validate image_family 2016-05-13 15:24:02 -07:00
Peter Schultz 8546aafec5 builder/googlecompute: support image family 2016-05-13 15:24:02 -07:00
Christopher Boumenot 2d1347c1ec Insert Packer's version into the User Agent. (#3465) 2016-05-05 13:10:55 -07:00
Chris Bednarski 1b1bbb604e Merge branch 'googlecompute-disk-type' of https://github.com/meatballhat/packer into f-google-disk-type 2016-03-10 14:51:30 -08:00
Chris Bednarski 4458de4ea0 Reformat 2016-02-11 23:53:40 -08:00
Matt Morrison daf57c7632 Add tests and documentation for subnetwork attribute 2016-02-11 21:54:48 +13:00
Matt Morrison 942aaa7a85 Add support for Google subnetworks. Closes #3062. Fixes an issue with how packer populates instances metadata. Closes #3181 2016-02-11 17:31:46 +13:00
Ryan Uber 7732cf45a0 builder/googlecompute: fix image name defaults 2016-01-19 11:12:19 -08:00
Caius Howcroft 069c3c21b1 Added support for GCE external static IPs 2015-12-24 19:15:41 -06:00
YAMADA Tsuyoshi 18d79cfb3d added test 2015-12-05 15:48:07 +09:00
YAMADA Tsuyoshi afd314959b supported `preemptible` in googlecompute builder 2015-12-05 05:13:35 +09:00
Dan Buch cac93d311c builder/googlecompute: accept disk type, default pd-standard 2015-10-13 20:18:26 -04:00
Dave Cunningham 1fea962a3a account_file can be verbatim JSON string 2015-10-08 02:40:18 -04:00
Rickard von Essen 9cf99289c5 Fixed GCE builder after dependency change.
See
4af91da601
2015-09-20 10:14:07 +02:00
Chris Bednarski 32b714e085 Update code.google.com/gosshold/ssh to point to golang.org/x/crypto/ssh, since this has been moved into core now
Fixes #2515
2015-07-30 19:19:59 -07:00
Chris Bednarski 1c71eaaa91 Change panic to multierror 2015-07-07 17:12:21 -06:00
Chris Bednarski 775450f46a Merge branch 'fix_gce_image_name' of https://github.com/samitpal/packer into b-google-image-name 2015-07-07 16:19:55 -06:00
Chris Bednarski bd6c31c2d9 Added TestImageName and moved private methods to the bottom of the file 2015-07-07 16:18:31 -06:00
Samit Pal 6d6b3e1ac2 The default image name in the code has a bug. It is being set to packer-{{timestamp}}, the {{timestamp}} part needs to be interpolated. Without the interpolation the GCE builder fails with
the following error

==> googlecompute: Creating image...
==> googlecompute: Error waiting for image: googleapi: Error 400: Invalid value for field 'resource.name': 'packer-{{timestamp}}'. Must be a match of regex '(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)', invalid
2015-07-07 05:27:58 +00:00
Mitchell Hashimoto 6c7a7b6068 builder/googlecompute: default SSH settings properly [GH-2340] 2015-06-29 09:56:33 -07:00
Mitchell Hashimoto 84189f7a28 builder/*: properly save interpolation context 2015-06-22 09:22:42 -07:00