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

Rename input params for community and direct shared galleries & add validations #204

Conversation

agrawalkshitij
Copy link
Contributor

Includes the following changes:

  1. Renames community gallery and direct shared gallery image ids to follow snake naming
  2. Add extra validation checks to make sure only one kind of gallery can be provided as input
  3. Added some unit tests
  4. Fixed some very old unit tests which didn't seem right. [extra]

Also clarified in comments why the gallery name and gallery unique names are 2 diff things, and thus the same fields should not be used.

Closes #203

@agrawalkshitij
Copy link
Contributor Author

@JenGoldstrich - pls take a look whenever you get time! This hopefully fixes any issues mentioned before!

Copy link

@invidian invidian left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the quick follow up!

builder/azure/arm/config.go Outdated Show resolved Hide resolved
builder/azure/arm/config.go Show resolved Hide resolved
@agrawalkshitij
Copy link
Contributor Author

@JenGoldstrich @nywilken - can you help take a look?


// Id of the direct shared gallery image : /sharedGalleries/{cgName}/Images/{img}[/Versions/{}] (Versions part is optional)
SharedGalleryImageID string `mapstructure:"directSharedGallery_image_id" required:"false"`
// Id of the direct shared gallery image : /sharedGalleries/{galleryUniqueName}/Images/{img}[/Versions/{}] (Versions part is optional)
Copy link
Contributor

Choose a reason for hiding this comment

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

If an image version is provided in the community or direct shared gallery image does the value of ImageVersion get used?

Do they both need to be identical in order for things to work?

Copy link
Contributor

Choose a reason for hiding this comment

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

I went ahead and updated the documentation to include these new configuration. I think there are a few inconsistencies that we should fast follow on. But I did want to get the documentation in a better place for now.

Copy link
Contributor

@nywilken nywilken left a comment

Choose a reason for hiding this comment

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

@agrawalkshitij tanks for the quick follow up here. I left a few requests for clarifying the documentation. In doing so I came across a few questions about the value of the new gallery types and how they pertain to the exiting shared image gallery type.

@@ -140,8 +140,8 @@ type Config struct {
// "gallery_name": "GalleryName",
// "image_name": "ImageName",
// "image_version": "1.0.0",
// "communityGallery_image_id": "/CommunityGalleries/{cg}/Images/{}/Versions/{}",
// "directSharedGallery_image_id": "/SharedGalleries/{cg}/Images/{}/Versions/{}"
// "community_gallery_image_id": "/CommunityGalleries/{galleryUniqueName}/Images/{}/Versions/{}",
Copy link
Contributor

Choose a reason for hiding this comment

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

This example is not usable as it contains all three gallery types. Instead of adding the values here. I would suggest adding a new section above the resource group usage section in the main builder docs to highlight the three types of shared image gallery sources.

I would also recommend putting correctly formatted example values with links to the azure documentation for the two additional gallery types.

Comment on lines +2084 to +2086
"image_name": "ignore",
"image_version": "ignore",
"community_gallery_image_id": "/CommunityGalleries/cg/Images/img",
Copy link
Contributor

Choose a reason for hiding this comment

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

Going back to a question I asked earlier here since it is in a test. The Shared Gallery requires a version and an image name. But community gallery id looks to contain an image name and could provider a version. If they are provided do they differ from the values in image_name and image_version?

If they don't we may just want to have community and direct shared gallery values by the name of the gallery. Or remove the need for having image_name and image_version be set when using a community or direct shared galleries. What do you think?

@nywilken
Copy link
Contributor

I updated the documentation to highlight the new Shared Image Gallery block configs. In the last commit I replace privately with private.

image

Copy link
Contributor

@JenGoldstrich JenGoldstrich left a comment

Choose a reason for hiding this comment

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

Thanks for your review and docs changes @nywilken!

@JenGoldstrich JenGoldstrich merged commit c764c87 into hashicorp:main Jun 28, 2022
@agrawalkshitij
Copy link
Contributor Author

agrawalkshitij commented Jun 28, 2022 via email

@nywilken
Copy link
Contributor

Hey, I am on vacation on right now, so not able to push new iterations with comment fixes. Did you find everything OK, last I checked there were some comments which needed some changes. Did one of you pick up those changes? If yes, thanks a lot. If no, I will get to it once I get back. Thanks, Kshitij Get Outlook for iOShttps://aka.ms/o0ukef

________________________________ From: Jenna Goldstrich @.> Sent: Tuesday, June 28, 2022 9:47:41 PM To: hashicorp/packer-plugin-azure @.> Cc: Kshitij Agrawal @.>; Mention @.> Subject: Re: [hashicorp/packer-plugin-azure] Rename input params for community and direct shared galleries & add validations (PR #204) Merged #204https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fhashicorp%2Fpacker-plugin-azure%2Fpull%2F204&data=05%7C01%7Ckagarwal%40microsoft.com%7Cbe0bdfe763254499981d08da5921ba64%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637920298646525583%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=plDII1z9UA9gKZ5eZY%2FVknhiECIB%2FdNqNaADshsaDRc%3D&reserved=0 into main. — Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fhashicorp%2Fpacker-plugin-azure%2Fpull%2F204%23event-6895503957&data=05%7C01%7Ckagarwal%40microsoft.com%7Cbe0bdfe763254499981d08da5921ba64%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637920298646525583%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=7uR2PDKFyaqTAP6CmjJstzMwKTgO3aUSEscSMm2EW0I%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAMEH2BYOIP7EZBYQSV6ZTG3VRMQSLANCNFSM5XXCFNAA&data=05%7C01%7Ckagarwal%40microsoft.com%7Cbe0bdfe763254499981d08da5921ba64%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637920298646525583%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=lQDda8jNhCl7ncOogBILQFnBw9RqSzuxJmAfCznje3g%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>

@agrawalkshitij we pushed a few changes to the comments to address the changes I requested. There are still some open questions around the usage of the galleries, which we can follow up when back. We are going to release this to address the invalid configuration argument names. We will bump the minor version to denote a breaking change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename communityGallery_image_id and directSharedGallery_image_id to follow snake case
5 participants