Commit Graph

392 Commits

Author SHA1 Message Date
Adrien Delorme 87ba7258b3
Use packer-sdc in packer + remove mapstructure-to-hcl2 & struct-markdown (#10913)
* start using `go:generate packer-sdc struct-markdown`

* Update Makefile

remove @go install ./cmd/struct-markdown

* run go generate for struct-markdown

* use //go:generate packer-sdc mapstructure-to-hcl2

* run go generate for mapstructure-to-hcl2

* remove struct-markdown and mapstructure-to-hcl2

* vendor vendors
2021-04-16 11:52:03 +02:00
sylviamoss e0614cabf4 move acctest pkg from sdk to core and update acceptance tests 2021-04-07 11:52:19 +02:00
Ace Eldeib 3227d3da43
clean up azure temporary managed os disk (#10713)
* clean up temporary managed os disk

* improve message for skipping disk deletion

Co-authored-by: Wilken Rivera <dev@wilkenrivera.com>

* re-arrange osdisk/additional disk cleanup

Co-authored-by: Wilken Rivera <dev@wilkenrivera.com>

* remove additional disk cleanup

* add some validation on scenarios

* alway clean up resources inside template cleanup

* tidy to master

* clarify naming and comments

Co-authored-by: Wilken Rivera <dev@wilkenrivera.com>

* test: add acceptance testing for azure cleanup

* revert template changes

* fix err check

* delete resources in parallel with retry to avoid serial deletion

* nit: improve log message for transient deletion errors

* fix: typo

* remove unused func to make lint happy

Co-authored-by: Wilken Rivera <dev@wilkenrivera.com>
2021-03-18 12:09:57 -04:00
Brian Farrell 273a720440
Add client_cert_token_timeout to address GH-9465 (#10528) 2021-03-02 11:51:18 +01:00
Taylor Chaparro 317e2da000
azure client sig fix: don't overwrite subscription id if unset (#10659) 2021-02-19 11:16:31 +01:00
Megan Marsh 1cb9aea752 change markdown references to new pathing 2021-01-15 11:59:36 -08:00
Wilken Rivera 04dbbe2d8e Fix broken links detected by link checker
- Fix broken example links
- Fix broken provisioner links
- Ignore linode.com because of DDOS protection settings
2021-01-06 16:27:12 -05:00
Megan Marsh 88b7b0e14a remove sdk 2020-12-17 13:29:25 -08:00
Megan Marsh 5f34bbd56e add extra line before package declaration so this line does not become the synopsis of a package for godoc 2020-12-16 15:14:43 -08:00
Megan Marsh becf7723e6 move builder/testing to acctest inside sdk 2020-12-03 11:57:06 -08:00
Megan Marsh 863e20ad65 move builder/testing framework into sdk; it imports the core but I think we just need to accept that. It doesn't expose the core directly to the SDK. 2020-12-02 09:46:42 -08:00
Megan Marsh 39354f64e5 move helper/communicator dir into packer-plugin-sdk
fix imports; fix website and generated partials
2020-12-02 08:41:32 -08:00
Megan Marsh 0eff73293a fix imports, vendoring, and linting 2020-11-30 14:30:30 -08:00
Megan Marsh d5971ca25e fix tests by moving mock hooks and communicators, and BasicUi definition, into SDK 2020-11-30 14:30:30 -08:00
Megan Marsh 56a45b04ab Move hook and communicator definitions to packer-plugin-sdk 2020-11-30 14:30:30 -08:00
Megan Marsh a6fdeca099 move logsecretfilter into packer sdk 2020-11-30 14:30:30 -08:00
Megan Marsh 14bdb9516c move Artifact and artifact mock to the sdk 2020-11-30 14:29:52 -08:00
Megan Marsh c70870cb83 move multierror and multierrorappend into sdk 2020-11-30 14:29:06 -08:00
Megan Marsh 001886670d move Ui definition into the packer plugin sdk. 2020-11-30 14:26:54 -08:00
Megan Marsh ea1ac530b0 move hcl2template kv types into the config/custom_types with trilean definitions 2020-11-18 15:46:59 -08:00
Megan Marsh f8f1ebf0c7 move version and useragent definitions into sdk 2020-11-18 11:42:02 -08:00
Megan Marsh 9e47696dff move helper/config to bundle with the other template definitions 2020-11-18 10:34:59 -08:00
Megan Marsh 3f6deb8828 move multistep into the plugin sdk 2020-11-17 16:31:03 -08:00
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
Megan Marsh 8ecd16db81 regenerate code 2020-11-10 08:16:59 -08:00
Megan Marsh 1ecd715221 refactor code so that packer/version is not a dependency of sdk code or plugin code 2020-11-09 17:20:42 -08:00
Paul Meyer 5ea90fea5b
Merge pull request #10210 from sumit-kalra/master
[builder/azure-arm] Create keyvaults with SoftDelete enabled
2020-11-06 14:07:41 -08:00
Simon Gottschlag 65b7d3b604
Add Azure CLI authentication (#10157)
Adds the ability to use an active `az login` session for authenticating the Azure builder
2020-11-06 14:24:16 -05:00
Sumit Kalra 2b69a5f496 azure-arm builder: Create keyvaults with SoftDelete enabled 2020-11-02 20:42:55 -08:00
Megan Marsh 72fd763207 fix crash 2020-10-29 14:29:16 -07:00
Adrien Delorme f5e037e8b4 Merge remote-tracking branch 'origin/master' into azr_selectable_temp_keygen_type_gcp 2020-10-26 15:47:29 +01:00
Wilken Rivera a1d69bfe91 Fix liniting issues 2020-10-23 13:52:05 -04:00
Wilken Rivera afd33679f5 builder/azure_arm: Fix build failures due to the deletion of attached managed disks
Previously (prior to v1.6.2) the Azure ARM builder had two delete functions
one that would run before any of the StepDelete* types, and one on deployment template
cleanup. The refactored coded re-introduces the logic from the previously removed
step in v1.6.1 as the main delete logic for the whole deployment
template. Ensuring that all deployed items are deleted before trying to
remove any managed disks.

This change moves all the deletion logic into the
step_deployment_template#Cleanup function to ensure that dependent steps
are only called once the created deployment items (i.e
StepDelateAdditionalDisks) have been deleted.

Test results before change
```

    compute.DisksClient#Delete: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=<nil> Code="OperationNotAllowed" Message="Disk pkrdd02e9rzzu5k-1 is attached to VM /subscriptions/1f90521a-24f6-4758-ac3d-88d869fb0bf5/resourceGroups/packer-acceptance-test/providers/Microsoft.Compute/virtualMachines/pkrvm02e9rzzu5k."
--- FAIL: TestBuilderAcc_ManagedDisk_Windows_Build_Resource_Group_Additional_Disk (454.00s)
FAIL
FAIL    github.com/hashicorp/packer/builder/azure/arm   454.008s

```

Test results after change
```
--- PASS: TestBuilderAcc_ManagedDisk_Windows_Build_Resource_Group_Additional_Disk (563.56s)

```

Closes #10070
2020-10-23 13:44:27 -04:00
Megan Marsh 70cb4097e1 review comments, add plugin type for a few missing builders 2020-10-21 16:17:32 -07:00
Wilken Rivera a2ba700ac0 Remove deprecated object ids from configs 2020-10-21 13:56:22 -04:00
Adrien Delorme 522d122858 regen all code 2020-10-21 12:04:10 +02:00
Wilken Rivera 1621ab59d8
tests/azure/arm: Update test image name (#10133)
I've run into a few cases where running the full test suite for the ARM
builder would fail because of conflicting image names. This is a
workaround for now the bigger fix is to have the acceptance clean up any
created images.

Results before change
```
the managed image named testBuilderAccManagedDiskWindows-1603151855 already exists in the resource group packer-acceptance-test, use the -force option to automatically delete it.
--- FAIL: TestBuilderAcc_ManagedDisk_Windows_Build_Resource_Group (0.66s)
```

Results after change
```
PASS
ok      github.com/hashicorp/packer/builder/azure/arm   2431.115s

```
2020-10-21 11:12:50 +02:00
Adrien Delorme 54032d6c11 gen code and docs 2020-10-15 16:51:23 +02:00
Wilken Rivera c7ba5c9a14
Fix line ending issues for test files (#10096) 2020-10-14 11:03:43 +02:00
Braunson b2047bd938
Put the correct AzureTags type in StateBag (#10014)
Azure expects the tags format to use a pointer to the string for the map value.
The configuration from the builder is not a pointer so when storing in the state bag for
reference in later execution we convert it when creating the StateBag.

Fixes #10012 and #10013.

* Use the MapToAzureTags helper and error check in resource group creation

* Added test case for tag values not using a pointer

* test/azure/arm: Add test to verify tags stored in state

* test/azure/arm: Add azure_tags to existing acceptance test for Linux

Test Before Fix
```
--- FAIL: TestBuilderAcc_ManagedDisk_Linux (1.81s)
panic: interface conversion: interface {} is map[string]string, not map[string]*string [recovered]
        panic: interface conversion: interface {} is map[string]string, not map[string]*string
FAIL    github.com/hashicorp/packer/builder/azure/arm   1.822s

```

Test After Fix
```
2020/09/29 17:23:03 ui: ==> test: Resource group has been deleted.
--- PASS: TestBuilderAcc_ManagedDisk_Linux (517.41s)
    PASS
    ok      github.com/hashicorp/packer/builder/azure/arm   517.426s
```

Co-authored-by: Wilken Rivera <dev@wilkenrivera.com>
2020-09-30 09:55:46 -04:00
Adrien Delorme 654fade0a9
azure arm: make map[string]*string => map[string]string to simplify things (#9985)
* azure arm: make map[string]*string => map[string]string to simplify things
* go generate ./builder/azure/...
* tests !

fix #9984
2020-09-24 12:19:26 +02:00
Sylvia Moss ba74602d63
Allows publishing to a Shared Image Gallery with a different subscription id (#9875) 2020-09-03 17:13:32 +02:00
Wilken Rivera 55812fe8a5 Handle error of deferred deletion 2020-08-12 11:30:15 -04:00
Wilken Rivera 5700f74c8c Handle lease not present error 2020-08-12 11:27:07 -04:00
Wilken Rivera d91839b93e Update deletion logic for OS disks
* Add an ResourceNotFound error check
* Add logic to break temporary disk lease before deleting it
2020-08-12 11:03:51 -04:00
Wilken Rivera ba6d11d518 Remove StepDeleteOSDisk in favor of StepDeployTemplate#Cleanup 2020-08-12 11:03:03 -04:00
Wilken Rivera aed97e1a8b Ensure any active leases are brokend before deleting 2020-08-11 16:41:28 -04:00
Wilken Rivera 920da9d0a4 Fix up code to remove some additional steps 2020-08-11 16:40:51 -04:00