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

Associate Packer build to HCP Packer parent iteration #11832

Merged
merged 3 commits into from
Jun 10, 2022

Conversation

nywilken
Copy link
Contributor

@nywilken nywilken commented Jun 3, 2022

This change allows Packer core to validate that a newly build image is a child of a HCP Packer registry source image. This association is handle by checking the source of a build against the reported source image of a build artifact that is configured to publish to the HCP Packer registry.

@nywilken nywilken requested a review from a team as a code owner June 3, 2022 12:46
@nywilken nywilken changed the title nywilken/parent iteration id WIP Associate Packer build to HCP Packer parent iteration Jun 3, 2022
Wilken Rivera added 2 commits June 6, 2022 21:09
* Fix typo for HCP_PACKER_BUILD_FINGERPRINT env in test
* Add test Fingerprint where needed; failing tests were not showing
  because they are properly set for acctest
@nywilken nywilken force-pushed the nywilken/parent-iteration-id branch from c75d489 to a49efc5 Compare June 7, 2022 01:10
@nywilken nywilken changed the title WIP Associate Packer build to HCP Packer parent iteration Associate Packer build to HCP Packer parent iteration Jun 9, 2022
@nywilken nywilken requested a review from sylviamoss June 9, 2022 19:29
@@ -48,7 +48,8 @@ func (p *Parser) decodeHCPRegistry(block *hcl.Block, cfg *PackerConfig) (*HCPPac
BuildLabels map[string]string `hcl:"build_labels,optional"`
Config hcl.Body `hcl:",remain"`
}
diags := gohcl.DecodeBody(body, cfg.EvalContext(LocalContext, nil), &b)
ectx := cfg.EvalContext(DatasourceContext, nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it makes more sense if this is BuildContext considering that the hcp_packer_registry is inside the build block. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. I'll update.

Copy link
Contributor

@sylviamoss sylviamoss left a comment

Choose a reason for hiding this comment

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

The solution looks pretty simple and straightforward. Well done! 👍🏼
I will download the binary and run a quick test! I will let you know when I'm done.

@sylviamoss
Copy link
Contributor

I tested it by creating child iterations based on one and two parents. All worked as expected, so 👍🏼 !!

@nywilken nywilken merged commit 846e4e6 into main Jun 10, 2022
@nywilken nywilken deleted the nywilken/parent-iteration-id branch June 10, 2022 15:39
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants