Sylvia Moss
bdd736b800
Interpolate vagrantfile_template on Vagrant post-processor ( #9923 )
2020-09-16 10:08:44 +02:00
Adrien Delorme
40947c2bf6
HCL2: generate hcl tags with go-cty tags too ( #9306 )
...
This will allow to generate the config files:
```go
package main
import (
"fmt"
"github.com/hashicorp/hcl/v2/gohcl"
"github.com/hashicorp/hcl/v2/hclwrite"
"github.com/hashicorp/packer/builder/alicloud/ecs"
)
func main() {
name := "name"
app := ecs.FlatConfig{
AlicloudImageName: &name,
ECSSystemDiskMapping: &ecs.FlatAlicloudDiskDevice{
DiskName: &name,
},
}
f := hclwrite.NewEmptyFile()
block := gohcl.EncodeAsBlock(&app, `source "something" "something"`)
f.Body().AppendBlock(block)
fmt.Printf("%s", f.Bytes())
}
```
Will output:
```
source "something" "something" {
packer_user_variables = null
packer_sensitive_variables = null
image_name = "name"
image_share_account = null
image_unshare_account = null
image_copy_regions = null
image_copy_names = null
tags = null
tag = null
system_disk_mapping = { disk_category = null, disk_delete_with_instance = null, disk_descri
ption = null, disk_device = null, disk_encrypted = null, disk_name = "name", disk_size = null, disk_
snapshot_id = null }
image_disk_mappings = null
ssh_remote_tunnels = null
ssh_local_tunnels = null
ssh_public_key = null
ssh_private_key = null
}
```
This is a good first step for #9015 and #9282
fix #9304
2020-05-28 11:19:00 +02:00
Megan Marsh
4041cb7775
generated code
2020-05-19 16:10:51 -07:00
Megan Marsh
557eb015ea
make artifice post-processor play nicely with vagrant post-processor, including template validation., Update docs for each.
2020-05-19 15:52:12 -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
Adrien Delorme
840e67f775
HCL2: when we see a map generate an attribute spec instead of a block spec ( #9035 )
...
* mapstructure-to-hcl2: when we see a map generate an attribute spec and not a block spec
this will alow to do
tags = {
key = "value"
}
instead of
tags {
key = "value"
}
This will also enable using variables directly for those tags
* generate code
* update tests
2020-04-14 16:05:13 +02: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
Sylvia Moss
dc31bad539
Sharing info with post-processors via artifact ( #8632 )
2020-01-30 11:27:58 +01:00
Sylvia Moss
06a26e74b4
Override post-processor config when processing ( #8592 )
2020-01-14 11:13:16 +01:00
Hanjie Wang
d9a128a375
In Vagrant post-processor, check whether the host system is able to create a dummy Vagrant box before processing ( #8431 )
2020-01-08 11:33:39 -08:00
Rui Lopes
ec17b3d8fa
correctly handle the diskSize property as a qemu size string
2020-01-05 15:44:01 +00: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
DanHam
1bffdd9bff
Add option to allow box Vagrantfile to be dynamically generated during build
2019-08-13 09:09:28 +01:00
DanHam
19f3a63ee1
Tests: Should not error when template is to be created during build
2019-08-13 09:09:28 +01:00
DanHam
4b042ac402
Tests: Should not error when vagrantfile_template exists
2019-08-13 09:09:27 +01:00
Adrien Delorme
a81abd297b
Merge remote-tracking branch 'origin/master' into context_provisioner
2019-04-08 20:09:01 +02:00
Megan Marsh
056fcb7cea
fix tests and add a few new ones
2019-04-03 11:32:49 -07: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
Adrien Delorme and Matthew Patton
b7222d1f56
Add tmp package that offers Dir & File funcs
...
this regroups the calls of tmp func calls into one package.
the tmp pkg allows to store tmp files under a common directory for easier managment
Squashed commit of the following:
commit 74b674c015
Merge: fc94b5714 66001525d
Author: Matthew Patton <[email protected] >
Date: Fri Nov 2 02:02:38 2018 -0400
Merge branch 'remove_TMPDIR_docs' of github.com:tb3088/packer into remove_TMPDIR_docs
commit fc94b57142
Author: Matthew Patton <[email protected] >
Date: Fri Nov 2 01:42:38 2018 -0400
update tests to honor configured temporary directory
commit 5a562359f4
Author: Matthew Patton <[email protected] >
Date: Thu Nov 1 18:52:38 2018 -0400
sync straggler to refactor. implement tests at packer/configfile instead of buried in docker.
commit 9d5a4a0935
Author: Matthew Patton <[email protected] >
Date: Thu Nov 1 15:39:46 2018 -0400
insert URL to GoLang API for os.TempDir()
commit fbae4c2e05
Author: Matthew Patton <[email protected] >
Date: Thu Nov 1 07:41:29 2018 -0400
revise documentation to match code
commit 3590fae8bd
Author: Matthew Patton <[email protected] >
Date: Thu Nov 1 07:21:59 2018 -0400
refacter config_file. replace all hard-coded os.TempDir with wrapper
commit d5c5306a97
Author: Matthew Patton <[email protected] >
Date: Wed Oct 31 20:11:36 2018 -0400
close massive file overwrite hole with TempDir
commit 0a72297da8
Author: Matthew Patton <[email protected] >
Date: Wed Oct 31 01:06:00 2018 -0400
adjust var declaration scope
commit 20f68228b6
Author: Matthew Patton <[email protected] >
Date: Wed Oct 31 00:54:35 2018 -0400
use mktemp() equivalent to create temporary directory
commit c73ebe3d83
Author: Matthew Patton <[email protected] >
Date: Tue Oct 30 20:40:58 2018 -0400
remove extraneous variable declaration, fix FOR loop
commit 63549b8bd7
Author: Matthew Patton <[email protected] >
Date: Tue Oct 30 19:30:44 2018 -0400
match styistic convension with rest of docs
commit 9761010749
Author: Matthew Patton <[email protected] >
Date: Tue Oct 30 19:08:39 2018 -0400
revert dangling config file change
commit 95159afbc0
Author: Matthew Patton <[email protected] >
Date: Fri Dec 29 23:53:43 2017 -0500
replace invalid TMPDIR variable wth PACKER_TMP_DIR.
update ConfigTmpDir() to try common temporary paths first and
only write to configDir() as a last resort.
commit 66001525d7
Author: Matthew Patton <[email protected] >
Date: Fri Nov 2 01:42:38 2018 -0400
update tests to honor configured temporary directory
commit e9b6adefea
Author: Matthew Patton <[email protected] >
Date: Thu Nov 1 18:52:38 2018 -0400
sync straggler to refactor. implement tests at packer/configfile instead of buried in docker.
commit 852113ed07
Author: Matthew Patton <[email protected] >
Date: Thu Nov 1 15:39:46 2018 -0400
insert URL to GoLang API for os.TempDir()
commit 54add38d1d
Author: Matthew Patton <[email protected] >
Date: Thu Nov 1 07:41:29 2018 -0400
revise documentation to match code
commit 6b5b8f6d4e
Author: Matthew Patton <[email protected] >
Date: Thu Nov 1 07:21:59 2018 -0400
refacter config_file. replace all hard-coded os.TempDir with wrapper
commit c22092c601
Author: Matthew Patton <[email protected] >
Date: Wed Oct 31 20:11:36 2018 -0400
close massive file overwrite hole with TempDir
commit 7a73045091
Author: Matthew Patton <[email protected] >
Date: Wed Oct 31 01:06:00 2018 -0400
adjust var declaration scope
commit 0f2933adb6
Author: Matthew Patton <[email protected] >
Date: Wed Oct 31 00:54:35 2018 -0400
use mktemp() equivalent to create temporary directory
commit d74839ede0
Author: Matthew Patton <[email protected] >
Date: Tue Oct 30 20:40:58 2018 -0400
remove extraneous variable declaration, fix FOR loop
commit eb65416619
Author: Matthew Patton <[email protected] >
Date: Tue Oct 30 19:30:44 2018 -0400
match styistic convension with rest of docs
commit acaa2b31ed
Author: Matthew Patton <[email protected] >
Date: Tue Oct 30 19:08:39 2018 -0400
revert dangling config file change
commit e573fde668
Author: Matthew Patton <[email protected] >
Date: Fri Dec 29 23:53:43 2017 -0500
replace invalid TMPDIR variable wth PACKER_TMP_DIR.
update ConfigTmpDir() to try common temporary paths first and
only write to configDir() as a last resort.
commit 39a9874afc
Merge: 8a413cfe8 3315812c2
Author: Matthew Patton <[email protected] >
Date: Tue Oct 30 18:19:26 2018 -0400
Merge branch 'master' of https://github.com/hashicorp/packer into prestine
commit 8a413cfe83
Merge: e07491de5 4e14710a6
Author: Matthew Patton <[email protected] >
Date: Mon Oct 1 20:18:10 2018 -0400
Merge remote-tracking branch 'upstream/master' into prestine
commit e07491de59
Merge: 42610a35d a1fa35dff
Author: Matthew Patton <[email protected] >
Date: Tue Aug 21 13:26:19 2018 -0400
Merge remote-tracking branch 'upstream/master' into prestine
commit 42610a35d5
Merge: 5298142da 0d63cf7bc
Author: Matthew Patton <[email protected] >
Date: Tue Jun 19 22:45:05 2018 -0400
Merge remote-tracking branch 'upstream/master' into prestine
commit 5298142da6
Merge: 7bb110bc7 9d9736552
Author: Matthew Patton <[email protected] >
Date: Mon Jun 11 15:10:09 2018 -0400
Merge remote-tracking branch 'upstream/master' into prestine
commit 7bb110bc74
Merge: a61c869ca 6189d66e7
Author: Matthew Patton <[email protected] >
Date: Wed May 9 23:41:22 2018 -0400
Merge remote-tracking branch 'upstream/master' into prestine
commit a61c869ca7
Merge: 098101dd9 4be5f072c
Author: Matthew Patton <[email protected] >
Date: Fri May 4 10:13:04 2018 -0400
Merge remote-tracking branch 'upstream/master' into prestine
commit 098101dd99
Merge: fefaf0fa6 554b2b4a5
Author: Matthew Patton <[email protected] >
Date: Tue May 1 20:52:30 2018 -0400
Merge branch 'EOL-handling' into prestine
Co-Authored-By: Matthew Patton <[email protected] >
2018-12-12 16:35:57 +01:00
Henk
e4c2216642
qemu: Add "hvf" as a libvirt driver
...
To prevent post-processing from failing when running on
macOS with the acceleratir set to "hvf".
2018-11-04 12:20:53 +01:00
Patrick Double
d796edc783
Add to vagrant post-processor support for Azure
2018-08-08 10:04:28 -05:00
Patrick Double
066b364873
Remove packer.docker from vagrant post processor builtins
2018-07-17 15:07:22 -05:00
Patrick Double
a301145ae1
Allow docker build as input to vagrant, docs
2018-07-17 09:41:18 -05:00
Patrick Double
1781d352a5
Add Vagrantfile fragment with docker tag specified
2018-07-16 15:35:02 -05:00
Patrick Double
e7fc651f60
First cut at vagrant post-processor for docker
2018-07-06 17:11:24 -05:00
Matthew Hooker
788418cff2
Add unit test to show that we handle tars safely
2018-05-25 12:13:59 -07:00
Matthew Hooker
c6299972b9
s/boot_command/bootcommand/
2018-04-19 14:26:31 -07:00
Matthew Hooker
60986ae682
better comment about why gnu tar
2018-03-29 16:18:55 -07:00
Matthew Hooker
742e366367
conditionally set tar header on go >= 1.10
2018-03-29 14:21:54 -07:00
Stefan Scherer
832f390733
Set tar header format to tar.FormatGNU
2018-03-29 22:46:59 +02:00
Josh Soref
c312493c38
spelling: available
2018-03-13 07:13:24 +00:00
Graham Hayes
91d60d6b81
Add LXC to vagrant post-processor
2018-03-07 15:17:52 +00:00
Edouard BONLIEU
ae18995ca1
Fix builder id
2018-02-08 12:10:10 -08:00
Edouard BONLIEU
7e36cfcff1
Add Scaleway builder
2018-02-08 12:09:24 -08:00
SwampDragons
074ddbea8e
Merge pull request #5732 from KohlsTechnology/vagrant_google
...
Add vagrant post-processor support for Google
2018-01-31 15:49:02 -08:00
Matthew Hooker
ebe995c0ff
run goimports
2018-01-22 17:21:10 -08:00
Sean Malloy
e8bac9f4c8
Add unit tests for new vagrant Google post-processor
2017-12-23 23:46:30 -06:00
Sean Malloy
e47bd65986
Add vagrant post-processor support for Google
...
Add the ability to create Google vagrant boxes
using the vagrant post-processor. The Google
plugin for vagrant is linked below.
https://github.com/mitchellh/vagrant-google
2017-12-23 00:13:17 -06:00
Joe Ferguson
5c2f758053
🎨 Fix typo in "copyed" -> "copied" usages.
2017-10-26 07:42:49 -05:00
Sander Saares
fb4db02586
Copy/link permissions 0777 -> 0755
...
Previous permission flags were unusually permissive. Almost everything else in Packer uses 0755.
2017-09-02 15:06:04 +03:00
Sander Saares
0ebf1d0da9
Link VHD instead of copy where allowed by OS
...
No need to incur that copy I/O if we don't even change the file!
2017-09-02 14:56:59 +03:00
Matthew Hooker
81522dced0
move packer to hashicorp
2017-04-04 13:39:01 -07:00
Matthew Hooker
bf64d7bdc2
automagic simplification
2017-03-28 20:36:20 -07:00
Volodymyr Babchynskyy
d57517d4a4
fix vagrant box structure
2016-12-12 22:44:17 +00:00
lxb
12ef9bf8af
Fixed inconsistency between vagrant-libvirt driver and packer QEMU accelerator
2016-11-03 22:55:55 +11:00
Michael Travis
2f1783dda2
Added vsphere-esx hosts to supported machine types in vagrant post processor
2016-10-06 15:09:01 +01:00
Mark Peek
5bfa6ce2b8
post-processor/vagrant: add artifact id tests for AWS and DO
2015-10-23 18:38:47 -07:00
Chris Bednarski
9ee07f1e8d
Add parallel gzip compression to the vagrant post-processor
2015-08-12 12:34:52 -07:00