-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Creating image from some Azure Marketplace Images requires additional items in the ARM template. #3506
Comments
Thanks for the report. I'm a bit confused -- is this a bug / UX problem or something we need to fix in the documentation? |
I think it is more of a feature request rather than a bug (although it can be justified both ways I think). It is not something that can be fixed in the documentation as Packer does not support this yet. We need to be able to add the plan information from a the builder configuration when using AzureRM for some marketplace images. |
I work for Chef and I am trying to build up a custom image in an Azure subscription using Packer to do it. I am using our AMP for the Chef server which needs this |
I do not think this is a builder/azure issue, but rather a Chef issue? I do not understand this well enough to offer any help. Here's information that would help me.
I can offer general help on the ARM, but I am not sure where to start. |
@russellseymour Thanks for following up. I think I understand now. @boumenot It sounds to me like we should provide a way to add arbitrary values to the JSON payload that packer sends to the Azure API when creating a machine. This allows us to support extra options that packer doesn't have logic for right now. We support a similar feature for VMX files which allows users to specify their own key=value pairs in the config file that packer generates, even if there is not a documented packer option for it. Also, many of the hard-coded commands in e.g. provisioners can be overridden in case the user wants to specify options that packer doesn't support. This provides the benefit of extra flexibility for advanced users but means we don't have to have a first-class workflow and extra logic for each use-case. If this is a common need we can make it a first-class feature. |
Makes sense. Thanks for the pointing me at the VMX work. This will be a good way to learn more. My plan is rework the Azure builder's use of JSON documents, so we do not have hard coded strings. A member of the community stepped up to do some this work, so I am waiting to see what he comes up with, and will iterate from there. |
I have got some more information from Microsoft about what this As the Chef image is a modified Ubuntu it requires the A complete Virtual Machine resource with the
I was not able to find any documentation on this. The way I found the correct syntax and layout was to use the https://resources.azure.com page and select a machine that I had created through the portal - this gave me the JSON definition of the machine. |
@russellseymour Thanks again for the detailed followup. @boumenot It sounds like this is a fairly common use case for vendors and MS partners so we might want to make the UX nice here; I'll defer to you on the best way to proceed since you're more familiar with this part of the code, but I can hop in and help if you need. |
Update: We have added this to our TODO. Our plan is to allow users to specify a list of JSON patches that can be applied to the ARM template before it is submitted for processing. My plan is to use this library for the patching. The RFCs have good information: RFC6902 JSON patch and RFC7396 JSON Merge Patch. |
@russellseymour - I created a PR to address your issue. Are you able to build this PR, and validate if it corrects your issue? As I dug into this more I realized that it was much more specialized than I originally thought. I would appreciate your help if knowing if the fix actually works for you. |
I have not seen a response, so I am closing this for now. Please re-open as appropriate. I'll leave the PR around, but I would like confirmation before proceeding with it. |
@boumenot Sorry been busy with things. Will have a look and let you know. Thanks. |
No pressure. |
I am having the same issue. I want to use the plan information in my builder to build the image. I tried building this PR but failed to do so. Cherry picking the commit id says "fatal : bad object " Please guide me how can I test this. |
The PR has become stale. I'll need to update it. The other alternative is you build directly from my clone of the Packer repo where the PR was created. This should give you a working build. |
Has anyone from the packer team going to revisit this issue? I'm facing this issue with an nginx plus marketplace image. |
I was not willing to commit the patch without confirmation that it would work. I can restart the work if you're willing to validate it. |
I'm not near my C2 client and can't test this. Anyone care to validate it?: |
Came across this issue after trying to build from an Azure marketplace image as well. I think this issue should be reopened. It's still a missing feature IMHO. @boumenot I'm willing to test/validate if needed. |
Saw the same issue trying to use a CIS marketplace image. |
@sstent Same in my case. |
I'll reopen this, but we need someone to step up and test the patch. Anyone willing to do that? @sstent @rbramwell @njappboy If you have problems building off of @boumenot's repo, I can help out, but please let me know. |
@mwhooker I'm willing to test the patch. Please point me in the right direction. I checked to URL given in #3506 (comment) but it returns a 404 |
Found the PR #3665 Took a look at the code. I'll build the branch and give it a go. |
Thanks for stepping up @rbramwell! If you get stuck let me know. I should be able to give this attention next week. |
I ran into this today. Any chance that I can help out and get this resolved ? Is there a work around at the moment ? |
Running into this as well, which unfortunately makes Packer unusable for me when working with Azure. |
Any information on how this needs to be tested so the issue can be resolved ? @sstent @rbramwell @njappboy @boumenot I'm happy to help, as this is blocking me. Just send me the directions |
/cc @harijayms |
Take II. I posted a new PR. I did a private build with this change for Windows, Linux, and MacOS (all are amd64). If you are able to try it, please do so and report back. I do not have the ability to test it end-to-end unfortunately. |
Unfortunately, It failed for me. What else do you need from me? Logs?
|
I can't tell if you are using an official release, or the version with the fix that I posted in my previous updated. If it was the version I posted, I would expect a version with a Git hash. Please retry with the version I posted if you used the official version. |
no, definitely used the version I downloaded from OneDrive. Went as far as deleting packer from my path ( brew ) I'll double check though. Edit, done. ✔️✔️ https://gist.github.com/gbonk/135c5b04853f98b2d0ab9f4048ca999e |
Perfect, you included a gist. The version in the gist is much more precise, and what I was expecting to see.
From the logs, it looks like you forgot to set plan_name, plan_product, and plan_publisher in your .json file. Of course, I could be wrong about that too. If you can, please include your .json file. |
You are correct. I do not set plan_name, plan_product, and plan_publisher in my .json. If possible, please provide ( and update the) documentation on what to set those fields too. I wasn't before and this was all working fine without setting those fields. Edit: Tomorrow at work I'll give it a try following the example above from the others. |
I documented them in my PR. Once the change is accepted, the PR will update the live documentation on packer.io. Until then, you will need to use the PR's edits. |
Fantastic... The link in your documentation was very helpful, and helped to clarify to me why this plan stuff was necessary when my previous work didn't require plan settings. As per the link, I got the plan details...
Then passing via environment variables into my builder.json
I have achieved sweet success. 👍 And my $0.02 suggestion the documentation
|
@sstent @rbramwell How can we capture an image from VM created by CIS Images in Azure Marketplace? |
I'm going to lock this issue 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 similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
When creating a new image from some Azure Marketplace Images the following JSON snippet is required in the root of the 'virtualMachine' resource:
Although this seems a duplication of the information being passed to Azure it is required otherwise the following error will be seen:
Would it be possible to add a new parameter in the builder configuration that states this plan information needs to be added to the template.
This is the case with creating a custom image of a
Chef Server
for example however Windows machines work without this information.The text was updated successfully, but these errors were encountered: