Commit Graph

13813 Commits

Author SHA1 Message Date
Megan Marsh a6c56aa4e2 fix build func docs 2019-12-18 16:53:17 -08:00
Megan Marsh f6878d6a2a update master to 1.5.1-dev 2019-12-18 16:40:17 -08:00
Megan Marsh a8a3758cc8
Cut version 1.5.0 2019-12-18 15:57:46 -08:00
Megan Marsh e03342cd32
Cut version 1.5.0 2019-12-18 15:54:41 -08:00
Megan Marsh 616060b463
Cut version pipefail 2019-12-18 15:48:26 -08:00
Megan Marsh e3c0022a8e update release process to incorporate binary signing 2019-12-18 15:44:49 -08:00
Megan Marsh ee5e0315d2
Cut version pipefail 2019-12-18 15:17:00 -08:00
Megan Marsh b70ab5c8d4
Cut version 1.5.0 2019-12-18 14:55:07 -08:00
Megan Marsh 2d335a16f7 cut packer release v1.5.0 2019-12-18 10:08:52 -08:00
Megan Marsh a1e4440797 update changelog date 2019-12-18 10:08:17 -08:00
Megan Marsh b4d3f71a7b update changelog 2019-12-18 10:02:27 -08:00
Wilken Rivera ba36201f89 docs/guides/hcl: Update sample configuration (#8499) 2019-12-18 10:17:47 +01:00
Megan Marsh dd8ad87dce
Merge pull request #8500 from hashicorp/fix_post_processors_hcl
fix pps
2019-12-17 16:39:29 -08:00
Megan Marsh 48b384dbc4 update changelog 2019-12-17 16:33:23 -08:00
Megan Marsh 4b1c2930b1 update changelog 2019-12-17 16:32:02 -08:00
Megan Marsh 5bacd37014 fix pps 2019-12-17 16:13:21 -08:00
Wilken Rivera a72242cd70
Merge pull request #8498 from hashicorp/f-builder_docker-typeassertion-check
builder/docker: Fix interface conversion issue when getting config from state bag
2019-12-17 18:08:00 -05:00
Megan Marsh dca2c03cdb
Merge pull request #7866 from hashicorp/sharing_info
Add new struct to Provision() method signature, allowing us to share connection and credential info generated at build time with provisioners.
2019-12-17 14:55:20 -08:00
nywilken 9403d55549 builder/docker: Add type assertion check when reading config from state bag 2019-12-17 17:48:35 -05:00
nywilken 0ba6b22fee builder/docker: Update type of config stored in state bag 2019-12-17 17:48:35 -05:00
Megan Marsh b51fca7857 regenerate builder mock 2019-12-17 13:49:16 -08:00
Megan Marsh 8490bbc45c add tests for info sharing 2019-12-17 13:41:48 -08:00
Wilken Rivera d10a702ce8
Merge pull request #8497 from hashicorp/td-command_build-doc-fixes
command/build: Fix URL to HCL2 syntax guide
2019-12-17 15:49:03 -05:00
nywilken 3d56f8ac80 command/build: Fix URL to HCL2 syntax guide
* small typo fixes
2019-12-17 15:36:04 -05:00
Megan Marsh cd7abf1f9e clean up a few final issues with info sharing 2019-12-17 11:20:57 -08:00
Megan Marsh 25711ed7d0 make HCL2 respect the new builder-returned generated vars list 2019-12-17 09:42:15 -08:00
Wilken Rivera 49c6c74046
Merge pull request #8490 from hashicorp/fix_7865
builder/azure: Remove double override of GalleryImageVersionsClient.PollDuration
2019-12-17 10:49:58 -05:00
nywilken 1eb55c2ae3 builder/azure: Remove double override of GalleryImageVersionsClient.PollDuration
This change fixes an issues where custom timeouts set for the
GalleryImagesVersionClient was being over written by the default client
poll duration.
2019-12-17 10:47:32 -05:00
Adrien Delorme ee2d74ce9e
hcl2template/common_test.go: make testParse a helper (#8495)
so that when an error happens we see the real calling function
2019-12-17 16:46:36 +01:00
Adrien Delorme bc49234930 remove old untrue comment 2019-12-17 16:45:20 +01:00
Adrien Delorme 50fb1148b4 wip 2019-12-17 16:31:22 +01:00
Adrien Delorme 4b7132c87c Merge remote-tracking branch 'origin/master' into sharing_info 2019-12-17 11:57:09 +01:00
Adrien Delorme 65cc5fe823
fix missing typo correction (#8494)
I left this change on my local branch
2019-12-17 11:31:57 +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 6bc5a95c3a tweak docs; change to 2019-12-16 21:35:42 -08: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
Megan Marsh 18bb4ffb44 bump API version since this change makes things backwards incompatible. 2019-12-16 11:46:46 -08:00
Megan Marsh 21a849354b fix hook data loading 2019-12-16 11:22:21 -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 1679d9fb9d docs 2019-12-14 03:53:22 -08:00
Megan Marsh a125f81fba add some more comments 2019-12-14 03:44:09 -08:00
Megan Marsh d47f151bf9 punctuation 2019-12-14 03:38:27 -08:00
Megan Marsh 82367a88f8 reorganize placeholder data call to live with provisioner implementation; force users to use the generated function, therefore forcing validation, for all variables except winrmpassword, by doing a simple string check against the placeholder data. 2019-12-14 03:32:38 -08:00
Megan Marsh ac570e0cc0 store ssh public and private keys on shared info 2019-12-13 13:15:03 -08:00
Megan Marsh 88d4ce37c9 template functioin to let Provisioners access PACKER_RUN_UUID 2019-12-13 13:03:09 -08:00
Megan Marsh 84063d2132 implement ID and Type values in the provisioner template info sharing 2019-12-13 11:57:01 -08:00
Megan Marsh e1652696a6 Rather than using reflection to grab the whole SSH config, for now just use the config convenience functions to get the majority of needed values 2019-12-13 10:02:13 -08:00
Kris Hicks 40357e2534 docs/builder/azure-arm: Remove errant html comment (#8484)
* Remove errant html comment from source

* make generate
2019-12-13 10:35:24 -05:00
Sylvia Moss 2ee3311082
Retry command execution when VM session is locked (#8483) 2019-12-13 10:47:19 +01:00