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

Allow for VM image exporting #217

Closed
1 task done
Kennochas opened this issue Jul 12, 2022 · 6 comments · Fixed by #226
Closed
1 task done

Allow for VM image exporting #217

Kennochas opened this issue Jul 12, 2022 · 6 comments · Fixed by #226
Assignees
Labels
priority/high High Priority sev/low Low type/enhancement Enhancement
Milestone

Comments

@Kennochas
Copy link

Code of Conduct

  • I have read and agree to the project's Code of Conduct.

Description

It would be nice to have a configuration option for downloading the image after it is created.

Use Case(s)

In my use case for this, I am attempting to do the following, which is creating a completely managed content library.

(All of our code is stored inside of Azure Devops)

  1. On the 15th of every month, all of the images are built by packer using CI.
  2. Packer downloads the VMDK's and such using the vsphere provider exports.
  3. The CI then uploads the VMDK's and associated build artifacts to ADO.
  4. ADO creates a release with all of the newly updated images.
  5. ADO pushes the artifacts down to a few web-servers for hosting a VMware content library.
  6. Using William Lam's script (https://github.com/khensler/vmware-scripts/blob/AZBlob/python/make_vcsp_2022.py) I am creating the JSON configuration for a content library.

Potential Configuration

In my version of the code, I am doing the following, but there may be better ways to handle it. I suspect there would be a desire to have a boolean for export or not that falls under the common variables? I am unsure of how to handle that in a packer configuration exactly.

 // Exporting the Template
  export {
    name = "${var.vm_guest_os_family}-${var.vm_guest_os_name}-${var.vm_guest_os_version}-${var.vm_guest_os_edition_standard}-${var.vm_guest_os_experience_core}-v${local.build_version}"
    force = true
    manifest = "sha1"
    options = ["extraconfig"]
    output_directory = "./artifacts/${var.vm_guest_os_family}-${var.vm_guest_os_name}-${var.vm_guest_os_version}-${var.vm_guest_os_edition_standard}-${var.vm_guest_os_experience_core}-v${local.build_version}"
  }

### References

https://www.packer.io/plugins/builders/vsphere/vsphere-iso#export-configuration
@tenthirtyam
Copy link
Contributor

tenthirtyam commented Jul 12, 2022

Thanks for submitting this enhancement request. I'll take this item into consideration for some of the near-term updates.

Ryan Johnson
Senior Staff Solutions Architect | Product Engineering @ VMware, Inc.

@tenthirtyam tenthirtyam added this to the Backlog milestone Jul 12, 2022
@tenthirtyam tenthirtyam added community/good-first-issue Community: Good First Issue status/planned Planned labels Jul 14, 2022
@tenthirtyam
Copy link
Contributor

tenthirtyam commented Jul 18, 2022

The OVF export option is pretty simple to implement from one of the common variables and the use of local variables.

I've implemented this option locally and will include this in the next release.

Ryan Johnson
Senior Staff Solutions Architect | Product Engineering @ VMware, Inc.

@tenthirtyam tenthirtyam added priority/high High Priority and removed priority/low Low Priority community/good-first-issue Community: Good First Issue status/needs-review Needs Review project/backlog Backlog labels Jul 18, 2022
@tenthirtyam tenthirtyam modified the milestones: Backlog, v22.07 Jul 18, 2022
tenthirtyam added a commit that referenced this issue Jul 19, 2022
Adds a common option to export machine image artifacts (`.ovf`,`.vmdk`, and `.mf`) to an output path.

#217

Signed-off-by: Ryan Johnson <[email protected]>
tenthirtyam added a commit that referenced this issue Jul 19, 2022
Adds a common option to export machine image artifacts (`.ovf`,`.vmdk`, and `.mf`) to an output path.

Resolves #217

Signed-off-by: Ryan Johnson <[email protected]>
@tenthirtyam
Copy link
Contributor

Hi, Stephen.

I've pushed the option to the main branch. Give it a go before v22.07 if you like.

You'll find the settings in the common variables. The export path is set to artifacts/ currently in the locals but I plan to make that configurable.

Ryan Johnson
Senior Staff Solutions Architect | Product Engineering @ VMware, Inc.

@Kennochas
Copy link
Author

Awesome, that's about what I figured it looked like. I was trying to see if I could figure it out myself, and wasn't too far off. Interesting the way packer has you do a for_each, even with a binary value like that.

Thank you, this along with the other ansible_user fix are enough that they let me move to your code base instead of customization's I quickly tossed in.

@tenthirtyam
Copy link
Contributor

Thanks for the both the bug report and enhancement request - glad to see the updates being a help to you.

If you've not yet done so, consider starring ⭐️ the project in GitHub. It really helps.

Ryan Johnson
Senior Staff Solutions Architect | Product Engineering @ VMware, Inc.

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 19, 2022
charkssmith pushed a commit to charkssmith/packer-examples-for-vsphere that referenced this issue Aug 28, 2023
…ples#226)

Adds a common option to export machine image artifacts (`.ovf`,`.vmdk`, and `.mf`) to an output path.

Resolves vmware-samples#217

Signed-off-by: Ryan Johnson <[email protected]>
@tenthirtyam tenthirtyam removed the status/planned Planned label Sep 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority/high High Priority sev/low Low type/enhancement Enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants