Skip to content

Update HCP Packer registry image extraction, validation, publishing logic for registry capable plugins#11221

Merged
nywilken merged 11 commits intomasterfrom
improved-registry-artifact-handling
Sep 14, 2021
Merged

Update HCP Packer registry image extraction, validation, publishing logic for registry capable plugins#11221
nywilken merged 11 commits intomasterfrom
improved-registry-artifact-handling

Conversation

@nywilken
Copy link
Copy Markdown
Contributor

@nywilken nywilken commented Aug 24, 2021

This version of Packer core has been updated with new error handling to fail a build if Packer is unable to decode or publish image metadata to the HCP Packer Registry. These changes use the development version of hashicorp/packer-plugin-sdk#76.

In these changes the RegistryBuilder and RegistryPostProcessor have been updated to used mapstructure for decoding all Artifact State data that is to be sent to HCP Packer Registry. If decoding fails for whatever reason the build fails and no data is published to HCP Packer Registry - open question is should we call artifact.Destroy() on publishing image errors?

Lastly, this change renames the packer_registry pkg to just registry. All references to the package are still set as packerregistry but the imports have been updated.

This change also vendors the latest versions of Amazon, GoogleCompute and Azure Arm plugins for the the private beta release.

Copy link
Copy Markdown
Contributor

@azr azr left a comment

Choose a reason for hiding this comment

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

dope !

@nywilken nywilken force-pushed the improved-registry-artifact-handling branch from 5f5034e to 591a9b7 Compare September 2, 2021 22:01
@nywilken nywilken force-pushed the improved-registry-artifact-handling branch from 4bfe2bf to 8fead8c Compare September 3, 2021 19:57
@nywilken nywilken marked this pull request as ready for review September 3, 2021 20:07
@nywilken nywilken requested a review from a team as a code owner September 3, 2021 20:07
Copy link
Copy Markdown
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.

LGTM! 👍🏼
As for the artifact.Destroy(), I wouldn't destroy it if it fails unless this is explicitly desired. My thought is that it can be a good source for debugging 🤔 What do you think?

@nywilken nywilken force-pushed the improved-registry-artifact-handling branch from e6db430 to 24976a7 Compare September 7, 2021 19:53
@nywilken
Copy link
Copy Markdown
Contributor Author

nywilken commented Sep 8, 2021

LGTM! 👍🏼
As for the artifact.Destroy(), I wouldn't destroy it if it fails unless this is explicitly desired. My thought is that it can be a good source for debugging 🤔 What do you think?

Yeah, that is a good point. This also may lead the way to adding some sort of import of existing image data to the registry functionality. Once we have a clear way to fail a build if the builder or post-process is not HCP Packer registry capable the need for destroying will not be necessary. I like your idea of not doing anything unless explicitly desired. Thanks!

@hashicorp-cla
Copy link
Copy Markdown

hashicorp-cla commented Sep 9, 2021

CLA assistant check
All committers have signed the CLA.

Comment thread go.mod Outdated
Wilken Rivera and others added 10 commits September 13, 2021 15:39
This change uses the github.com/hashicorp/packer-plgin-sdk/packer/registryimage for querying
Artifact State for HCP Registry Image metadata. To handle the conversion
of the RPC response, mapstructure was introduced to conversion state
data into an registryimage.Image before publishing to a image bucket.
@nywilken nywilken force-pushed the improved-registry-artifact-handling branch from 24976a7 to 6469188 Compare September 13, 2021 19:41
* The latest release of Amazon, GoogleCompute, and Azure have support
  for publishing images to the HCP Packer registry.
@nywilken nywilken changed the title Improved registry artifact handling Update HCP Packer registry image extraction, validation, publishing for registry capable plugins Sep 14, 2021
@nywilken nywilken changed the title Update HCP Packer registry image extraction, validation, publishing for registry capable plugins Update HCP Packer registry image extraction, validation, publishing logic for registry capable plugins Sep 14, 2021
@nywilken nywilken merged commit b10df3a into master Sep 14, 2021
@nywilken nywilken deleted the improved-registry-artifact-handling branch September 14, 2021 01:08
@github-actions
Copy link
Copy Markdown

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 Oct 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants