Commit Graph

609 Commits

Author SHA1 Message Date
Megan Marsh 6fc3c4eb49 properly document how to set boot_wait to 0s 2020-04-07 16:43:33 -07:00
Jeff Escalante 9165be87da
packer.io prefix removal, html extension remove for in-code errors 2020-04-07 17:53:22 -04:00
Jeff Escalante 4afd107eeb
patch source files for extensions changes 2020-04-07 17:50:51 -04:00
Megan Marsh ca5814ab74 move proxy behind feature flag 2020-04-01 11:31:48 -07:00
Megan Marsh 65b64d04d0 remove docs about windows symlinks which are now inaccurage 2020-03-26 15:51:51 -07:00
Sylvia Moss e6368b9246
Fix azure winrm_password attribution and allow to set winrm_username (#8928) 2020-03-24 14:43:24 +01:00
Sylvia Moss 2319521aa5
Add iso config test for checksum from file specific case (#8897) 2020-03-18 11:32:51 +01:00
Wilken Rivera 7b705545d9
docs: Various doc clean-ups to fix code block formatting and syntax highlighting (#8868) 2020-03-12 15:05:08 +01:00
Sylvia Moss 76f13deaf4
Make template variables SSHPublicKey and SSHPrivateKey as strings (#8829) 2020-03-09 17:25:05 +01:00
Wilken Rivera e1a46ec293
Fix gosimple S1025 linting errors (#8838)
Remove unneeded use of fmt.Sprintf for variables that are already strings.
2020-03-04 15:31:30 -05:00
Lars Lehtonen f808d1d968
common/powershell: fix dropped error 2020-03-02 14:45:22 -08:00
Megan Marsh 9c9826ee4b
Merge pull request #8714 from williamb1024/hyperv-gen1-boot-order
WIP: Add Hyper-V builder `first_boot_device` setting to allow the selection of the initial device or device class used for booting the VM.
2020-03-02 12:27:25 -08:00
Ben Brown 0936f8bc03 Fix Hyper-V compacted disk size comparison
Prior to this the code compares the length of the path, which of course
doesn't change.
2020-03-02 09:55:13 +00:00
Megan Marsh 66a1cdb8d2 regenerate boot command code 2020-02-28 09:50:50 -08:00
William Brooks 7f38ce0686 test and correct gen2 SetFirstBootDeviceGen2 scripts 2020-02-21 11:09:49 -06:00
William Brooks dd8f4370c6 initial support for gen2 and fix driver_mock 2020-02-21 01:30:59 -06:00
William Brooks 5e1e4ec701 fmt && generate 2020-02-21 01:07:58 -06:00
William Brooks d7300f4635 Remove legacy_boot and replace with first_boot_device (initial) 2020-02-21 01:01:09 -06:00
Megan Marsh dde74232f2
Clearly document all template-engine-enabled options (#8770) 2020-02-20 11:05:27 +01:00
William 807f39284d
Merge pull request #2 from hashicorp/master
merge from hashicorp/packer
2020-02-15 23:13:38 -06:00
Wilken Rivera 9ec8b67392
Add golangci-lint to project (#8686)
* Add golangci-lint as linting tool

* Disable failing staticchecks to start; GitHub issue to handle coming soon

* Run `goimports -w` to repair all source files that have improperly
formatted imports

* makefile: Add ci-lint target to run on travis

This change adds a new make target for running golangci-lint on newly
added Go files only. This target is expected to run during Packer ci builds.

* .github/contributing: Add code linting instructions

* travis: Update job configuration to run parallel builds
2020-02-14 11:42:29 -05:00
Megan Marsh 00dfb79c88
Merge pull request #7627 from hashicorp/inplace_isos
Inplace isos
2020-02-11 11:19:10 -08:00
Adrien Delorme 08f394604c Update iso_config.go
use defaultGetterClient instead of getter.DefaultClient
2020-02-11 12:07:06 +01:00
Adrien Delorme cc3d941853 iso checksumming: use checksum or checksum url if set to handle all cases
fix #8322
2020-02-10 17:54:11 +01:00
William Brooks 31622b50ac applied fmt 2020-02-09 15:22:36 -06:00
William Brooks 55ae803852 Add Hyper-V support for Gen-1 boot order with ISO 2020-02-09 13:08:22 -06:00
Adrien Delorme 72c2731f7b Update step_download_test.go 2020-02-06 18:24:13 +01:00
Adrien Delorme 973a1ea103 remove comented code 2020-02-06 18:23:08 +01:00
Adrien Delorme f91429f256 fix goimports 2020-02-06 18:18:03 +01:00
Adrien Delorme d45eca5cdc update tests 2020-02-06 18:17:57 +01:00
Adrien Delorme a8e717ae09 ISOConfig.Prepare: fix ChecksumFromFile usage 2020-02-06 17:51:15 +01:00
Adrien Delorme 8e6bad209b try to use isos inplace whatever the os 2020-02-06 17:50:29 +01:00
Chris Cunningham e94ed9a683 update the note about Windows symlinks
GH-7534 and GH-7545 disabled the use of symlinks for copying local ISOs, 
per:

https://github.com/hashicorp/packer/blob/master/common/step_download.go#L106

Update the documentation to match, as without reading the source it is 
implied that this should work.
2020-02-06 17:38:57 +01:00
Adrien Delorme a19214afeb Allow to use isos in place 2020-02-06 17:07:58 +01:00
Megan Marsh dde7302265
Merge pull request #8689 from hashicorp/fix_8530
Add iso file name when targetPath is a directory
2020-02-04 13:43:09 -08:00
Moss f2c8e8491c Fix format 2020-02-04 18:22:43 +01:00
Moss e020da49f3 Add iso file name when targetPath is absolute 2020-02-04 18:06:47 +01:00
Wilken Rivera 561f02cc2f
builder/azure-arm: Update logic for setting subscriptionID (#8685)
* builder/azure-arm: Update logic for setting subscriptionID

Previously, when using managed identities, the Azure builder would set the SubscriptionID in the Prepare method. But would not update it after getting the updated SubscriptionID from the metadata server. This change updates the Run method to ensure a valid subscriptionID is saved to the statebag before continuing with an image build.

Co-authored-by: Paul Meyer <paul.meyer@outlook.com>
2020-02-04 10:54:58 -05:00
Sylvia Moss dc31bad539
Sharing info with post-processors via artifact (#8632) 2020-01-30 11:27:58 +01:00
Moss 0566f1f999 Extract http ip discover to a new step 2020-01-27 17:06:56 +01:00
Sylvia Moss 0b7251a4bb
Share .Device and .MountPath between builders, provisioners and post-processors (#8621) 2020-01-20 16:29:38 +01:00
Sylvia Moss 0677b02e18
Share SourceImageName with provisioners and manifest post-processor (#8603) 2020-01-16 12:04:03 +01:00
Megan Marsh 90bdcf58bd update step_download to return an ActionContinue if the URls field is empty. this allows us to simplify the hyperv builder, and is still safe because all other builders and uses of step_download already validate that the iso url is not empty if that's what they need, most of them inside of the IsoConfig prepare function. 2020-01-07 10:45:24 -08: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
Megan Marsh 21a849354b fix hook data loading 2019-12-16 11:22:21 -08:00
Megan Marsh a125f81fba add some more comments 2019-12-14 03:44:09 -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