Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where packer-sdc mapstructure-to-hcl was incorrectly mixing underlying structs for types with similar mapstructure tags #212

Merged
merged 1 commit into from
Oct 27, 2023

Conversation

nywilken
Copy link
Contributor

@nywilken nywilken commented Oct 18, 2023

  • Initial fix for underlying struct mis-match bug

When running packer-sdc mapstructure-to-hcl on the packer-plugin-azure project there was a case where the struct contents of SharedImageGalleryDestination was being selected for the creation of the FlatMap structure for the SharedImageGallery type.

This changes ensure that the underlying struct contents are associated with the type being processed.

@nywilken nywilken changed the base branch from main to nywilken/bump-dependencies-1.20 October 18, 2023 15:02
@nywilken nywilken force-pushed the fix/packer-sdc-mismatch-bug branch 2 times, most recently from 28d0729 to 52ed476 Compare October 19, 2023 18:33
@nywilken nywilken changed the title fix/packer sdc mismatch bug [WIP] fix packer sdc mismatch bug Oct 19, 2023
@nywilken nywilken force-pushed the fix/packer-sdc-mismatch-bug branch from 52ed476 to a93cfdb Compare October 19, 2023 18:37
@nywilken nywilken force-pushed the nywilken/bump-dependencies-1.20 branch from 1555a23 to 7702a43 Compare October 19, 2023 18:38
@nywilken nywilken force-pushed the fix/packer-sdc-mismatch-bug branch from a93cfdb to 146d9ea Compare October 19, 2023 18:39
Base automatically changed from nywilken/bump-dependencies-1.20 to main October 20, 2023 15:21
@nywilken nywilken force-pushed the fix/packer-sdc-mismatch-bug branch from 1812811 to 8e4efa4 Compare October 20, 2023 15:23
@nywilken nywilken changed the title [WIP] fix packer sdc mismatch bug Fix packer sdc mismatch bug Oct 26, 2023
@nywilken nywilken marked this pull request as ready for review October 26, 2023 16:34
@nywilken nywilken requested a review from a team as a code owner October 26, 2023 16:34
Update cmd/packer-sdc/internal/mapstructure-to-hcl2/mapstructure-to-hcl2.go

Co-authored-by: Lucas Bajolet <105649352+lbajolet-hashicorp@users.noreply.github.com>
@nywilken nywilken force-pushed the fix/packer-sdc-mismatch-bug branch from 3b8c5e4 to 42b4f01 Compare October 26, 2023 19:06
Copy link
Contributor

@lbajolet-hashicorp lbajolet-hashicorp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@nywilken nywilken merged commit 4fb8273 into main Oct 27, 2023
8 checks passed
@nywilken nywilken added the bug Something isn't working label Oct 27, 2023
@nywilken nywilken changed the title Fix packer sdc mismatch bug Fix issue where packer-sdc mapstructure-to-hcl was incorrectly mixing underlying structs for types with similar mapstructure tags Oct 27, 2023
@nywilken nywilken deleted the fix/packer-sdc-mismatch-bug branch October 27, 2023 14:56
jooola referenced this pull request in hetznercloud/packer-plugin-hcloud Nov 28, 2023
…123)

[![Mend Renovate logo
banner](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[github.com/hashicorp/packer-plugin-sdk](https://github.com/hashicorp/packer-plugin-sdk)
| require | patch | `v0.5.1` -> `v0.5.2` |

---

### Release Notes

<details>
<summary>hashicorp/packer-plugin-sdk
(github.com/hashicorp/packer-plugin-sdk)</summary>

###
[`v0.5.2`](https://github.com/hashicorp/packer-plugin-sdk/releases/tag/v0.5.2)

[Compare
Source](https://github.com/hashicorp/packer-plugin-sdk/compare/v0.5.1...v0.5.2)

<!-- Release notes generated using configuration in .github/release.yml
at v0.5.2 -->

#### Upgrade Notes

Upgrading to this release may fail until you've applied one of the fixes
documented in
[packer-plugin-sdk#187](https://github.com/hashicorp/packer-plugin-sdk/issues/187#user-content-available-fixes).
Consumers of the Packer plugin SDK require a replace directive within
their plugin's go module file to point to a compatible version of
go-cty. The replace directive subject to change in future releases can
be applied by running the `packer-sdc fix` sub-command to apply the
replace directive to your plugin with a recommended version of the
go-cty fork.

Plugins already working with Packer Plugin SDK v0.5.1 are advised to
apply the updated SDK fixes by re-running `packer-sdc fix` against the
plugin's root directory. The updated SDK fixes will bump the supported
version of the go-cty fork to v1.13.3, which is required for working
with hcl/v2 version 2.17.0 and above.

- **Bumped github.com/zclconf/go-cty to v1.13.1**: to bring in the
latest supported changes of zclconf/go-cty and hashicorp/hcl/v2 to the
SDK.
- **Bumped github.com/hashicorp/hcl/v2 to v2.19.1**: to bring in support
for the latest HCL/v2 refinements builder and enhancements. Refinements
are non-breaking changes but you may see some changed results in your
unit test of operations involving unknown values.
- **Updated `packer-sdc fix`**: to upgrade the replace version for
github.com/nywilken/go-cty from v1.12.1 to v1.13.3.

#### What's Changed

##### Exciting New Features 🎉

- Add capability to specify additional build args to be executed when
running acceptance tests against builders by
[@&#8203;lbajolet-hashicorp](https://github.com/lbajolet-hashicorp) in
[https://github.com/hashicorp/packer-plugin-sdk/pull/202](https://github.com/hashicorp/packer-plugin-sdk/pull/202)
- Bump supported version of go-cty to v1.13.3 by
[@&#8203;nywilken](https://github.com/nywilken) in
[https://github.com/hashicorp/packer-plugin-sdk/pull/215](https://github.com/hashicorp/packer-plugin-sdk/pull/215)

##### Security Changes

- Bump go-getter to v2.2.1 by
[@&#8203;zliang-akamai](https://github.com/zliang-akamai) in
[https://github.com/hashicorp/packer-plugin-sdk/pull/200](https://github.com/hashicorp/packer-plugin-sdk/pull/200)
- Address reported CVEs along with Go toolchain vulnerabilities by
[@&#8203;nywilken](https://github.com/nywilken) in
[https://github.com/hashicorp/packer-plugin-sdk/pull/208](https://github.com/hashicorp/packer-plugin-sdk/pull/208),
[https://github.com/hashicorp/packer-plugin-sdk/pull/213](https://github.com/hashicorp/packer-plugin-sdk/pull/213)

##### Bug Fixes🧑‍🔧 🐞

- Fix issue where packer-sdc mapstructure-to-hcl was incorrectly mixing
underlying structs for types with similar mapstructure tags by
[@&#8203;nywilken](https://github.com/nywilken) in
[https://github.com/hashicorp/packer-plugin-sdk/pull/212](https://github.com/hashicorp/packer-plugin-sdk/pull/212)
- hcl2helper: preemptively panic on nil hcl spec by
[@&#8203;lbajolet-hashicorp](https://github.com/lbajolet-hashicorp) in
[https://github.com/hashicorp/packer-plugin-sdk/pull/204](https://github.com/hashicorp/packer-plugin-sdk/pull/204)

##### Other Changes

- packer-sdc/struct-markdown: Allow packer-internal as project directory
for testing purposes by
[@&#8203;nywilken](https://github.com/nywilken) in
[https://github.com/hashicorp/packer-plugin-sdk/pull/218](https://github.com/hashicorp/packer-plugin-sdk/pull/218)

#### New Contributors

- [@&#8203;zliang-akamai](https://github.com/zliang-akamai) made their
first contribution in
[https://github.com/hashicorp/packer-plugin-sdk/pull/200](https://github.com/hashicorp/packer-plugin-sdk/pull/200)

**Full Changelog**:
hashicorp/packer-plugin-sdk@v0.5.1...v0.5.2

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/hetznercloud/packer-plugin-hcloud).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy41OS44IiwidXBkYXRlZEluVmVyIjoiMzcuNTkuOCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: jo <ljonas@riseup.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants