Commit Graph

529 Commits

Author SHA1 Message Date
Sylvia Moss 6d7c6ba18c
Add step_http_ip_discover to virtualbox to allow HTTPIP in vboxmanage (#8700) 2020-02-07 10:38:48 +01:00
Sylvia Moss 08b0bd1d2c
Fix HCL2 code generation for slices within another slice (#8669) 2020-02-03 17:03:28 +01:00
Sylvia Moss dc31bad539
Sharing info with post-processors via artifact (#8632) 2020-01-30 11:27:58 +01:00
Moss 6ad7f593bf Undo ssh_wait_timeout backward incompatibility 2020-01-28 17:26:01 +01:00
Sylvia Moss d6a351b173
Rename communicator config variables and remove deprecated code (#8584) 2020-01-09 08:37:30 -08:00
Sylvia Moss baa203bb53
Adds acpi_shutdown to virtualbox builder (#8587) 2020-01-09 08:36:19 -08:00
Adrien Delorme 7b5a868de2 virtualbox/vm.Builder: use config as a non pointer to avoid a panic
this is a continuation to #8513
2020-01-07 16:55:50 +01:00
Lars Lehtonen 8098ba9cdf builder/virtualbox/common: remove unused url variable (#8559) 2020-01-06 16:45:05 +01:00
Megan Marsh 348e00422e
Merge pull request #8509 from hashicorp/fix_step_import_panic
Remove config dependency from inside StepImport
2019-12-20 09:19:30 -08:00
Moss 7912e496aa Remove config dependency inside StepImport 2019-12-20 11:58:28 +01:00
Megan Marsh 127905e855 remove time flaky time limited tests (#8522)
* remove flaky test. It isn't very useful anyway given that we're slowly adding retries to the checks for lockfiles

* remove time-component from retry test; in underpowered CI builds, this can flake fairly often.
2019-12-20 08:16:18 +01:00
Megan Marsh f47d9f1b1f
Merge pull request #8514 from hashicorp/fix_5821
Configure NAT interface before forwarded port mapping
2019-12-19 11:30:33 -08:00
Adrien Delorme f1e6f8eac1 removed unused config puts 2019-12-19 18:06:39 +01:00
Adrien Delorme a67948f155 fix config pointers 2019-12-19 17:51:57 +01:00
Moss 9216f43463 Configure NAT interface before forwarded port mapping 2019-12-19 17:03:31 +01:00
Moss 42cf9ef064 Remove pointer fixing panic on interface conversion 2019-12-19 13:30:54 +01:00
Adrien Delorme 4b7132c87c Merge remote-tracking branch 'origin/master' into sharing_info 2019-12-17 11:57:09 +01:00
Adrien Delorme 0785c2f6fc
build using HCL2 (#8423)
This follows #8232 which added the code to generate the code required to parse
HCL files for each packer component.

All old config files of packer will keep on working the same. Packer takes one
argument. When a directory is passed, all files in the folder with a name
ending with  “.pkr.hcl” or “.pkr.json” will be parsed using the HCL2 format.
When a file ending with “.pkr.hcl” or “.pkr.json” is passed it will be parsed
using the HCL2 format. For every other case; the old packer style will be used.

## 1. the hcl2template pkg can create a packer.Build from a set of HCL (v2) files

I had to make the packer.coreBuild (which is our one and only packer.Build ) a public struct with public fields

## 2. Components interfaces get a new ConfigSpec Method to read a file from an HCL file.

  This is a breaking change for packer plugins.

a packer component can be a: builder/provisioner/post-processor

each component interface now gets a `ConfigSpec() hcldec.ObjectSpec`
which allows packer to tell what is the layout of the hcl2 config meant
to configure that specific component.

This ObjectSpec is sent through the wire (RPC) and a cty.Value is now
sent through the already existing configuration entrypoints:

 Provisioner.Prepare(raws ...interface{}) error
 Builder.Prepare(raws ...interface{}) ([]string, error)
 PostProcessor.Configure(raws ...interface{}) error

close #1768


Example hcl files:

```hcl
// file amazon-ebs-kms-key/run.pkr.hcl
build {
    sources = [
        "source.amazon-ebs.first",
    ]

    provisioner "shell" {
        inline = [
            "sleep 5"
        ]
    }

    post-processor "shell-local" {
        inline = [
            "sleep 5"
        ]
    }
}

// amazon-ebs-kms-key/source.pkr.hcl

source "amazon-ebs" "first" {

    ami_name = "hcl2-test"
    region = "us-east-1"
    instance_type = "t2.micro"

    kms_key_id = "c729958f-c6ba-44cd-ab39-35ab68ce0a6c"
    encrypt_boot = true
    source_ami_filter {
        filters {
          virtualization-type = "hvm"
          name =  "amzn-ami-hvm-????.??.?.????????-x86_64-gp2"
          root-device-type = "ebs"
        }
        most_recent = true
        owners = ["amazon"]
    }
    launch_block_device_mappings {
        device_name = "/dev/xvda"
        volume_size = 20
        volume_type = "gp2"
        delete_on_termination = "true"
    }
    launch_block_device_mappings {
        device_name = "/dev/xvdf"
        volume_size = 500
        volume_type = "gp2"
        delete_on_termination = true
        encrypted = true
    }

    ami_regions = ["eu-central-1"]
    run_tags {
        Name = "packer-solr-something"
        stack-name = "DevOps Tools"
    }
    
    communicator = "ssh"
    ssh_pty = true
    ssh_username = "ec2-user"
    associate_public_ip_address = true
}
```
2019-12-17 11:25:56 +01:00
Megan Marsh 0f6d1beccf add an extra string array to the Prepare() return values in the builder interfaces; this sets up the ability for builders to give the provisioners custom user-accessible build-time variables. 2019-12-16 21:23:05 -08:00
Sylvia Moss c57f093efe
Remove unnecessary source_path validation for virtualbox-ovf (#8489) 2019-12-16 16:50:21 +01:00
Sylvia Moss 0a8b172bf9 Remove duplicated retry mechanism when deleting VM ffrom virtual box (#8485)
This retry was also added to fix a locked by session error reported in #5501 and fixed in #5512.
2019-12-16 14:31:15 +01:00
Megan Marsh 84063d2132 implement ID and Type values in the provisioner template info sharing 2019-12-13 11:57:01 -08:00
Sylvia Moss 2ee3311082
Retry command execution when VM session is locked (#8483) 2019-12-13 10:47:19 +01:00
Sylvia Moss c6b9efb522 Fix virtualbox-iso TestBuilderAcc_basic (#8481)
make sure the test works for later usage
2019-12-12 10:43:51 +01:00
Sylvia Moss 2f63c581a0
Remove unnecessary 1 sec sleep (#8453) 2019-12-06 11:43:28 +01:00
Sylvia Moss 5ff5623433
Add disable_shutdown option to VirtualBox builder (#8449) 2019-12-05 14:34:56 +01:00
Adrien Delorme a36b94320a virtualbox: simplify ParseSnapshotData 2019-11-06 10:24:20 +01:00
Adrien Delorme 116a038de9 Update snapshot.go
avoid a panic on a too short slice.
2019-11-05 15:48:32 +01:00
Adrien Delorme 14243ce56a
Merge pull request #8305 from hashicorp/fix_8301
allow nvme, since virtualbox 6.0 allows it
2019-11-04 17:58:18 +01:00
Adrien Delorme a23801d4a9 builder.virtualbox.iso: document that EFI mode needs to be enabled for pcie/nvme to work too 2019-11-04 14:30:59 +01:00
Megan Marsh 974eba443a update docs to include warning about extension pack 2019-11-01 09:48:35 -07:00
Adrien Delorme b790776096 vbox iso: use NVMe Controller when the hard drive interface if pcie 2019-11-01 14:43:59 +01:00
Megan Marsh 6f54468dd5 fix mocks 2019-10-31 15:36:22 -07:00
Megan Marsh 65ad3105b3 udpdate generated code 2019-10-31 15:28:36 -07:00
Megan Marsh 9343a23021 add driver calls to enable nvme controller 2019-10-31 15:21:52 -07:00
Megan Marsh d2867c47f0 allow nvme, since virtualbox 6.0 allows it 2019-10-31 14:43:46 -07:00
Adrien Delorme 819329228a Change back to make sure all durations are a time.Duration
It is simply the best/simplest solution and trying to prevent users from passing and integer here would be like opening a can of worms. Because:

* we cannot make mapstructure validate our duration string ( with an UnmarshalJSON func etc.)
* we cannot make mapstructure spit a string instead of a duration and packer will decode-encode-decode config.
* the hcl2 generated code asks for a string, so this will be enforced by default.
2019-10-31 16:12:07 +01:00
Adrien Delorme bf3d9841c6 Force durations to be passed a strings
Before this commit it was possible to set a duration using an integer or a float. Go's time.Duration is an int64 internally an mapstructure will take advantage of this and load the number as a int64 but `1` means one ns which is unexpected/confusing. To avoid confusion and enforce readability this forces users to pass a string with a unit for a duration; ex "56s".
2019-10-31 11:47:19 +01:00
Adrien Delorme 078ba7c8c3 commit old code generation tool
for history
2019-10-15 12:56:42 +02:00
Lars Lehtonen 4a3a011310
builder/virtualbox/vm: fix dropped error 2019-10-01 15:54:28 -07:00
Adrien Delorme 3fe9d52e3f Merge remote-tracking branch 'origin/master' into scrape_doc_to_builder_struct_config 2019-09-20 11:15:44 +02:00
allinwait 171c2a9a07 add the floppy label option 2019-09-12 12:25:22 +00:00
Brian Fox 5b6dcb0c94 fix(virtualbox) LoadSnapshots should succeed even if VM has no snapshots 2019-09-12 10:51:12 +02:00
Adrien Delorme 597a3e323b Merge remote-tracking branch 'origin/master' into scrape_doc_to_builder_struct_config 2019-09-10 13:20:07 +02:00
Adrien Delorme 350aa54274 Update step_shutdown_test.go
bump test duration
2019-09-10 13:07:30 +02:00
Adrien Delorme 4cb7c30987 Merge remote-tracking branch 'origin/master' into scrape_doc_to_builder_struct_config 2019-08-21 16:44:23 +02:00
Thomas Meckel 01edafb49f Cleaned up golint warnings 2019-08-19 21:36:43 +02:00
Thomas Meckel 92501cd344 target_snapshot is not optional as described in the documentation 2019-08-19 21:36:43 +02:00
Megan Marsh 06bef2844b
Merge pull request #7996 from hashicorp/fix_7925
dont bother with a targetpath for the vbox additions; use a hash like…
2019-08-19 09:45:38 -07:00
Brian Fox 47c027e5c8 Remove check/requirement for target_snapshot 2019-08-19 11:25:17 +02:00