Commit Graph

41 Commits

Author SHA1 Message Date
Megan Marsh 7d658149ea update tests and website and generated partials to reflect new package format 2020-11-17 10:36:01 -08:00
Megan Marsh e04eaa89e6 move steps and step configs from packer/common to packer/common/commonsteps 2020-11-13 11:15:04 -08:00
Megan Marsh 6402362018 create packer-plugin-sdk directory and begin moving the relevant folders into it. 2020-11-13 10:47:36 -08:00
Chris Roberts d8222b1656
Add support for uploading directly to storage on Vagrant Cloud (#10193)
Vagrant Cloud provides support for uploading directly to the backend
storage instead of streaming through Vagrant Cloud. This adds support
for direct to storage uploads and sets it as the default upload method.
A new option has been added to disable this behavior and revert back
to streaming upload via Vagrant Cloud (`no_direct_upload`).

This default for uploading directly to the backend storage also matches
up with changes being added to Vagrant proper for box upload behavior:
hashicorp/vagrant#11916
2020-11-05 20:01:55 -05:00
Megan Marsh c0ce8a9414 rework fixer deprecation code so we know what plugins they relate to 2020-10-21 15:28:59 -07:00
Megan Marsh b982d987a7 Add Artifice postprocessor ID to valid artifacts for postprocessors that perform artifact type validation 2020-05-15 13:13:43 -07:00
Sylvia Moss dc31bad539
Sharing info with post-processors via artifact (#8632) 2020-01-30 11:27:58 +01:00
Megan Marsh b23425f637 use pointer to config rather than config 2019-12-19 11:27:21 -08: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
Adrien Delorme 078ba7c8c3 commit old code generation tool
for history
2019-10-15 12:56:42 +02:00
Lars Lehtonen 21f2e67462
post-processor/vagrant-cloud: fix dropped errors 2019-09-26 09:23:09 -07:00
Brian Fox 331babc2ce allow blank access_token (no auth) for private vagrant box hosting 2019-09-12 12:37:53 +02:00
DanHam 7770ade74c
Clearer error message for artifice users. OCD nits and logging 2019-08-21 14:32:26 +01:00
DanHam 57137c6e33
Should return an error if the value of the provider key is empty 2019-08-21 14:32:25 +01:00
DanHam a9e22a6bb2
Should return the provider by parsing the json in the box metadata file 2019-08-21 14:32:24 +01:00
DanHam 063e4bd3e5
Should return an error if the box tar archive is empty 2019-08-21 14:32:24 +01:00
DanHam 9c6b355088
Should return an error if the box is a plain gzip file 2019-08-21 14:32:24 +01:00
DanHam 35d326de39
Add basic workings to function. Return an error if box file is empty 2019-08-21 14:32:23 +01:00
DanHam 6b5cf6dcb2
Should return an error when the box file is missing 2019-08-21 14:32:23 +01:00
DanHam e8c586175e
Intention: Allow use of artifice pp with vagrant-cloud pp
The Vagrant-Cloud and Vagrant provider (e.g. virtualbox, vmware_desktop
etc.) must be determined differently depending on the builder or
post-processor supplying the artifact.

Adds a wrapper function that:

* Uses the original method of determining the provider when the artifact
  is provided by either the Vagrant builder or Vagrant post-processor
* Uses a new (currently empty) function when the artifact is provided
  via the Artifice post-processor
2019-08-21 14:32:23 +01:00
Adrien Delorme a81abd297b Merge remote-tracking branch 'origin/master' into context_provisioner 2019-04-08 20:09:01 +02:00
Adrien Delorme e65115a7a0 contextualize post-processor 2019-04-03 15:55:55 +02:00
Megan Marsh 12fc1fa751 default_keep_input_artifact 2019-04-02 16:51:58 -07:00
Vadym Haidamaka 4855bc79c9 Add vagrant-cloud post-processor support for the vagrant builder 2019-03-12 05:33:46 +02:00
Davi Vidal a2fd287e56 Ignores SSL verification when on premise vagrant cloud 2019-03-05 10:57:11 +01:00
Adrien Delorme 415b886f5b post-processor/vagrant-cloud: validate vagrant cloud auth token doing an auth request 2018-10-24 15:08:08 +02:00
Edouard BONLIEU 7e36cfcff1
Add Scaleway builder 2018-02-08 12:09:24 -08:00
Matthew Hooker 366dc3da0a
move multistep imports to helper.
gomvpkg -from "github.com/mitchellh/multistep" -to "github.com/hashicorp/packer/helper/multistep"
2018-01-24 17:09:15 -08:00
Vijaya Bhaskar Reddy Kondreddi e45223a867 Fix -on-error issue not working.
When we supply -on-error flag for Packer with Hyper-v builder, it does not do anything.
2017-09-01 00:14:28 +05:30
Matthew Hooker 94d7a4ce8d
post-processor/vagrant-cloud: try upload once
* fixes multiple uploads mentioned in #4973
* removed unused token code
2017-06-12 17:34:32 -07:00
Matthew Hooker dde40d54c6
atlas cloud token warn 2017-06-07 17:20:54 -07:00
Matthew Hooker 81522dced0
move packer to hashicorp 2017-04-04 13:39:01 -07:00
Mitchell Hashimoto 5241d8c6d6 post-processor/*: fix interpolation context 2015-06-22 12:24:55 -07:00
Mitchell Hashimoto dc1e67b6d2 post-processor/*: interpolation 2015-05-27 14:56:22 -07:00
Mitchell Hashimoto e422a45449 fmt 2014-10-28 08:35:21 -07:00
Tristan Helmich 7816fc0bf9 vagrantcloud post-processor selfhosted box feature 2014-08-02 15:02:12 +02:00
Jack Pearkes f384806821 post-processor/vagrant-cloud: add no_release and version_description 2014-06-25 10:32:17 -04:00
Jack Pearkes 26abac6999 post-processor/vagrant-cloud: steps for create, upload and release 2014-06-24 15:58:45 -04:00
Jack Pearkes c899051c9c post-processor/vagrant-cloud: use multistep 2014-06-23 15:48:51 -04:00
Jack Pearkes a678362701 post-processor/vagrant-cloud: add api items 2014-06-20 11:20:27 -04:00
Jack Pearkes 7d4efdc236 post-processor/vagrant-cloud: initial commit 2014-06-16 15:53:37 -04:00