Commit Graph

604 Commits

Author SHA1 Message Date
sylviamoss 41c66d6935 vendor vsphere plugin 2021-04-15 16:25:31 -07:00
sylviamoss 38fe79948b remove vsphere components and docs 2021-04-15 16:24:57 -07:00
Adrien Delorme 77a29fc2f8
Allow to have `dynamic` blocks in a `build` block + tests (#10825)
This :
* allows to have a `build.dynamic` block
* add tests
* makes sure to show a correct message when a source was not found
  * display only name of source (instead of a weird map printout) 
  * use a "Did you mean %q" feature where possible 


Because dynamic blocks need all variables to be evaluated and available, I moved parsing of everything that is not a variable to "after" variables are extrapolated. Meaning that dynamic block get expanded in the `init` phase and then only we start interpreting HCL2 content.

After #10819 fix #10657
2021-03-30 15:53:04 +02:00
Adrien Delorme a9bec7945e
remove .mdx extensions in links (#10823)
Some of them were added in #10800 some where already there
2021-03-25 14:02:21 +01:00
Sylvia Moss 505cbd2591
Vendor amazon plugin (#10800)
* remove amazon from core
* vendor amazon plugin
* remove website content
* Add amazon to docs-remote-plugins
* update amazon reference links in the documentation
* update amazon docs version to latest

Co-authored-by: Adrien Delorme <adrien.delorme@icloud.com>
2021-03-25 13:37:48 +01:00
Adrien Delorme 0e3fcb589b
Implicit required_plugin blocks (#10732)
* used components that don't have a required_plugin block will make Packer 'implicitly' require those. These components are manually selected and commented for now.
* add tests
 * docs
2021-03-24 11:31:39 +01:00
Adrien Delorme 7732f7998c
Add http_content func to serve variables from HTTP @ preseed (#10801)
This imports hashicorp/packer-plugin-sdk#43

* code generate things
* update docs
* update guides
* update examples

We want to add a new guide.
2021-03-23 12:31:13 +01:00
Megan Marsh 0993c976fa
hcl2_upgrade escaped quotes fix (#10794)
* clean up extra quoting that can cause text template failures. when everyone else abandons you, regex will always be there.

* LINTING
2021-03-22 10:56:30 +01:00
Megan Marsh a40a782408 remove escaped dir 2021-03-19 09:28:30 -07:00
Adrien Delorme e2e6bce4c4 Update hcl2_upgrade_test.go
show diffs with strings
2021-03-19 13:56:41 +01:00
Megan Marsh 502708b86a
Refactor hcl2_upgrade (#10787) 2021-03-19 10:24:49 +01:00
Megan Marsh 4242cf3151 fix tests 2021-03-18 10:02:27 -07:00
Megan Marsh 0ecc4b5e52 add annotation warning to isotime func usage 2021-03-17 16:06:19 -07:00
Megan Marsh 6986fb0e81 make upgrade set isotime func properly 2021-03-17 15:52:22 -07:00
Adrien Delorme fe21ff905d test that folders containing a - file won't hang forever 2021-03-15 11:51:21 +01:00
Adrien Delorme 832c0f2b2a actually run fmt tests and then remove debug statements 2021-03-15 11:41:14 +01:00
teddylear 22d373c279 Adding more debug logic 2021-03-15 11:36:10 +01:00
Adrien Delorme be7d7313c5 add tests for piping fmt 2021-03-12 11:25:10 +01:00
Adrien Delorme a115b428ac simplify fmt test case a little 2021-03-12 11:07:26 +01:00
Adrien Delorme 4e22147909 Merge remote-tracking branch 'origin/master' into pr/teddylear/10457 2021-03-12 10:38:04 +01:00
Wilken Rivera 3c282de6c3 Add maps for statically vendored components
This change adds a new set of maps for builders, provisioners, and
post-processors that store reference to components that were once part
of Packer and are now vendored. This file acts as a single place for
defining this vendored components, which are then merged into the main
components maps to be used in Packer.

Quick test to ensure the exoscale-import post-processor is still loaded
```
// Validate that exoscale-import is in the know post-procoessors list
~>  packer.test build docker_centos_shell_provisioner.pkr.hcl
Error: Unknown post-processor type "badlynamed-import"

  on docker_centos_shell_provisioner.pkr.hcl line 18:
  (source code not available)

known post-processors: [ucloud-import digitalocean-import docker-push
googlecompute-export manifest vsphere-template docker-tag vsphere checksum
docker-import exoscale-import yandex-export compress googlecompute-import
yandex-import vagrant-cloud alicloud-import amazon-import artifice shell-local
docker-save vagrant]

// Validate that exoscale-import get loaded
~>  packer.test build docker_centos_shell_provisioner.pkr.hcl
Error: Failed preparing post-processor-block "exoscale-import" ""

  on docker_centos_shell_provisioner.pkr.hcl line 18:
  (source code not available)

4 error(s) occurred:

* api_key must be set
* api_secret must be set
* image_bucket must be set
* template_zone must be set

==> Wait completed after 2 microseconds

==> Builds finished but no artifacts were created.
```
2021-03-09 10:09:13 -05:00
Wilken Rivera edd4567096 Remove plugin registration generation step
This change removes the generation of command/plugin.go so that plugin
registration can be managed manually. As we begin to break out plugins
we will need to begin modifying this file, possibly with stubs to allow
for the removal of plugins without breaking Packer's backwards
  compatibility with 1.7.0. After 1.8.0 is released we should be able to
  revet these changes so that we can continue to generate the plugin
  file for those plugins core to Packer.
2021-03-09 10:02:02 -05:00
Marc Falzon 125a2f1f76 Remove "exoscale-import" post-processor
This change removes the `exoscale-import` post-processor from the
upstream Packer repository, following extraction as a standalone plugin
in a dedicated repository (https://github.com/exoscale/packer-post-processor-exoscale-import)
2021-03-09 10:01:05 -05:00
Megan Marsh 71b815a5fd reword commits 2021-03-05 16:07:32 -08:00
Wilken Rivera 79481ed7ec Add vendored components map as opposed to removing code generation for command/plugin.go 2021-03-05 15:44:04 -05:00
Megan Marsh 1c3c1f17d9 stop generating plugins file to make it possible to vendor plugins 2021-03-05 15:33:34 -05:00
Megan Marsh a5b0e37d7e docker extraction POC 2021-03-05 15:33:34 -05:00
Sylvia Moss 610dde7f02
check for nil config map (#10730) 2021-03-05 11:10:00 +01:00
Megan Marsh 96b753f3b0
pin packer to golang 1.16 (#10702)
* pin packer to golang 1.16
* vet command/build_cancellation_test.go
2021-03-02 11:43:58 +01:00
sylviamoss 5ccbd27b72 Improve upgrade error and transform all variables with template eng to locals 2021-02-23 16:51:13 +01:00
sylviamoss 20e8f666d9 make locals out of variables with template engines 2021-02-23 14:18:43 +01:00
sylviamoss a1a5cf0113 upgrade variables with other variables 2021-02-22 17:16:19 +01:00
sylviamoss 2016d6baec Fix panic on upgrading variables json file 2021-02-22 16:07:37 +01:00
Megan Marsh dd167925d7
add machine readable to the cli help func and docs (#10658) 2021-02-19 11:17:47 +01:00
Sylvia Moss 37d05c85ff
upgrade pause_before (#10654) 2021-02-18 15:05:12 +01:00
Megan Marsh 00e503388e
change template parsing error to include warning about file extensions (#10652) 2021-02-18 09:59:30 +01:00
Megan Marsh 1710590418
Merge pull request #10633 from hashicorp/azr_init_no_magic_host
Packer init: remove host and namespace guessing
2021-02-16 14:32:20 -08:00
Wilken Rivera 728c5a217d Add test case for non-github hostname
Tests results on current branch; install succeeded which was not expected
```
2021/02/16 14:02:24 ui: Installed plugin example.com/sylviamoss/comment v0.2.19 in "/tmp/pkr-test-cfg-dir-6_pkr_config458005728/example.com/sylviamoss/comment/packer-plugin-comment_v0.2.19_x5.0_linux_amd64"
    init_test.go:361: InitCommand.Run() = 0, want 1
    init_test.go:381: unexpected dir hash after init:   string(
        -       "h1:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=",
        +       "h1:iVtzkl/nVm2KiLvlz8rH56ME8QEqRxq8+XT2Lo6bzGU=",
          )
--- FAIL: TestInitCommand_Run (6.39s)
    --- PASS: TestInitCommand_Run/already-installed-no-op (0.01s)
        --- PASS: TestInitCommand_Run/already-installed-no-op/-subtest-0 (0.00s)
    --- PASS: TestInitCommand_Run/already-installed-upgrade (2.30s)
        --- PASS: TestInitCommand_Run/already-installed-upgrade/-subtest-0 (0.06s)
    --- PASS: TestInitCommand_Run/release-with-no-binary (0.17s)
    --- PASS: TestInitCommand_Run/manually-installed-single-component-plugin-works (1.32s)
        --- PASS: TestInitCommand_Run/manually-installed-single-component-plugin-works/-subtest-0 (0.01s)
    --- PASS: TestInitCommand_Run/manually-installed-single-component-plugin-old-api-fails (1.42s)
        --- PASS: TestInitCommand_Run/manually-installed-single-component-plugin-old-api-fails/-subtest-0 (0.01s)
    --- FAIL: TestInitCommand_Run/unsupported-non-github-source-address (1.18s)
```

Tests results after change with change in this branch
```
2021/02/16 14:03:14 [TRACE] getting available versions for the example.com/sylviamoss/comment plugin
2021/02/16 14:03:14 [TRACE] &{%!q(*github.Client=<nil>) "packer-getter-github-1.7.0-dev"} getter could not get release: example.com/sylviamoss/comment doesn't appear to be a valid github.com source address; check source and try again.
2021/02/16 14:03:14 [DEBUG] will try to install: []
2021/02/16 14:03:14 ui error: no release version found for the example.com/sylviamoss/comment plugin matching the constraint(s): "v0.2.19"
--- PASS: TestInitCommand_Run (5.38s)
    --- PASS: TestInitCommand_Run/already-installed-no-op (0.01s)
        --- PASS: TestInitCommand_Run/already-installed-no-op/-subtest-0 (0.00s)
    --- PASS: TestInitCommand_Run/already-installed-upgrade (2.08s)
        --- PASS: TestInitCommand_Run/already-installed-upgrade/-subtest-0 (0.07s)
    --- PASS: TestInitCommand_Run/release-with-no-binary (0.21s)
    --- PASS: TestInitCommand_Run/manually-installed-single-component-plugin-works (1.20s)
        --- PASS: TestInitCommand_Run/manually-installed-single-component-plugin-works/-subtest-0 (0.01s)
    --- PASS: TestInitCommand_Run/manually-installed-single-component-plugin-old-api-fails (1.88s)
        --- PASS: TestInitCommand_Run/manually-installed-single-component-plugin-old-api-fails/-subtest-0 (0.01s)
    --- PASS: TestInitCommand_Run/unsupported-non-github-source-address (0.00s)
```
2021-02-16 14:03:29 -05:00
Sylvia Moss e0557f84e9
Add access config to generated amazon ami data source (#10634) 2021-02-15 17:35:03 +01:00
Adrien Delorme 8208f425c8 addrs: remove Plugin.ForDisplay func, the String one does the job
to make things less confusing
2021-02-15 15:32:42 +01:00
Megan Marsh cac6b04546
update help text for hcl2_upgrade (#10624) 2021-02-15 11:03:44 +01:00
Megan Marsh 80ed988ffe
Hcl2 upgrade fix (#10625)
* fix random nil pointer dereference I found while debugging hcl2_upgrade issues

* fix hcl2_upgrade command by creating passthroughs for all text template fields
2021-02-15 10:40:21 +01:00
Megan Marsh b20dea6aec
Merge pull request #10614 from hashicorp/azr_acc_test_old_single_component_plugins
Acc test "old style" single component plugins
2021-02-12 14:22:29 -08:00
sylviamoss e69410b633 fix lint 2021-02-12 15:38:44 +01:00
sylviamoss 855ba9775a add docs 2021-02-12 15:31:13 +01:00
sylviamoss 76e3d57cae add with-annotation flag to hcl2_upgrade 2021-02-12 15:18:53 +01:00
teddylear 0637601eda Fixing recursive formatting tests to work on all platforms 2021-02-11 22:08:36 -05:00
Adrien Delorme 7089e0854a rename setup func to avoid name conflict 2021-02-11 18:00:18 +01:00
Adrien Delorme 40c2b2a153 add manually-installed-single-component-plugin-old-api-fails 2021-02-11 16:55:30 +01:00
Adrien Delorme 3677069010 test: manually-installed-single-component-plugin-works 2021-02-11 16:35:08 +01:00