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

Makefile: Build OVA packages and include them in repos #1428

Merged
merged 2 commits into from
Apr 1, 2021

Conversation

zmrow
Copy link
Contributor

@zmrow zmrow commented Mar 30, 2021

Issue number:
Fixes #1415

Description of changes:

Makefile: Add `build-ova` target
    
This change adds a new `build-ova` target that will build OVA packages
for variants that build VMDK images.  The OVA packages are named
identically to our images and end up in a new directory `build/ovas`. To
support the building of OVA packages, a new OVF template is included in
`variants/vmware-dev/template.ovf`.  When building an OVA package, the
current values are substituted into the template and it is included in
the final OVA package.
Makefile: Ensure OVAs are included in repositories

This change updates the `build-archives` target to depend on the `build-ova`
target.  This ensures that OVAs are built if necessary when building new
repos.  If the current variant is `vmware-*`, we ensure that the OVA is
included in the repository, similar to the way we include `kmod_kit`.

OVA packages allow for single file Bottlerocket VM deployment. The OVA includes the disk images for the current Bottlerocket build, an OVF file that defines the makeup of the VM including hardware, and a manifest file that includes the hashes of the previously mentioned artifacts.

The OVA is named just like our other images, signed and included in the Bottlerocket TUF repo alongside our other artifacts: bottlerocket-vmware-dev-x86_64-1.0.7-a5a8edcc.ova

$ ls -lah build/repos/default/bottlerocket-1.0.7-a5a8edcc/targets/
...
<long sha>.bottlerocket-vmware-dev-x86_64-1.0.7-a5a8edcc.ova -> /<my dir>/build/ovas/bottlerocket-vmware-dev-x86_64-1.0.7-a5a8edcc.ova
...

Testing done:

  • Build a vmware-dev OVA and run it in VMWare (yay!)
  • Build a vmware-dev repo and ensure that the OVA is included
  • Remove the template from vmware-dev directory, run the build-ova target and ensure that we are warned that VMDK artifacts exist but a template does not
  • Delete the VMDK artifacts, run the build-ova target to ensure it properly exits with an error
  • Attempt to build a repo without the build-archives dependency (just to make sure this works) and ensure it fails because there is no OVA.
  • Run the build-ova step multiple times to ensure it doesn't attempt to rebuild an OVA if the current one is newer than the VMDKs
  • touch the VMDKs, and re-run the build-ova step to ensure it rebuilds the OVA
  • Build an aws-k8s-1.18 image and repo, and ensure that OVAs aren't built or included in the repository (also see that a message is logged that we aren't building an OVA because OVF/VMDK doesn't exist)

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

@zmrow zmrow requested review from tjkirch, bcressey and webern March 30, 2021 21:02
variants/vmware_template.ovf Outdated Show resolved Hide resolved
Makefile.toml Outdated Show resolved Hide resolved
Makefile.toml Outdated Show resolved Hide resolved
Makefile.toml Show resolved Hide resolved
Makefile.toml Outdated Show resolved Hide resolved
Makefile.toml Outdated Show resolved Hide resolved
variants/vmware_template.ovf Outdated Show resolved Hide resolved
variants/vmware_template.ovf Outdated Show resolved Hide resolved
variants/vmware_template.ovf Outdated Show resolved Hide resolved
@zmrow
Copy link
Contributor Author

zmrow commented Mar 31, 2021

^ addressed @bcressey 's comments

Also updated the commit messages, PR description, and testing done to reflect the changes.

Makefile.toml Outdated Show resolved Hide resolved
zmrow added 2 commits April 1, 2021 15:38
This change adds a new `build-ova` target that will build OVA packages
for variants that build VMDK images.  The OVA packages are named
identically to our images and end up in a new directory `build/ovas`. To
support the building of OVA packages, a new OVF template is included in
`variants/vmware-dev/template.ovf`.  When building an OVA package, the
current values are substituted into the template and it is included in
the final OVA package.
This change updates the `build-archives` target to depend on the
`build-ova` target.  This ensures that OVAs are built if necessary when
building new repos.  If the current variant is `vmware-*`, we ensure
that the OVA is included in the repository, similar to the way we
include `kmod_kit`.
@zmrow
Copy link
Contributor Author

zmrow commented Apr 1, 2021

^ Removed the SCSI controller and updated the test in the repo step of the Makefile

@zmrow zmrow merged commit c7dbf1f into bottlerocket-os:develop Apr 1, 2021
@zmrow zmrow deleted the make_ova branch April 1, 2021 19:53
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.

Add support for building OVA
3 participants