Add packer template file with qemu plugin

This commit is contained in:
Ravi Khadiwala 2024-06-10 16:09:22 -05:00 committed by ravi-signal
parent 0b1501e8de
commit 6747e012e4
3 changed files with 31 additions and 1 deletions

22
trustedimage/README.md Normal file
View File

@ -0,0 +1,22 @@
Generate and build AMD-SEV-SNP attestable VM disk images for GCP or Azure
## Dependencies
To run build and upload disk images, you'll need
- [packer](https://developer.hashicorp.com/packer/tutorials/docker-get-started/get-started-install-cli)
- [gcloud](https://cloud.google.com/sdk/docs/install-sdk) (to make GCP disk images)
- [az](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) (to make Azure disk images)
Then you'll also need to install the `qemu` plugin for packer, run
```
packer init template.pkr.hcl
```
Finally, you'll have to configure credentials and projects for the cloud provider you want to build
disk images on. See azure_config.example or gcp_config.example.
## Building
`make build/gcp_version` will create a GCP disk image
`make build/azure_version` will create an Azure disk image
`make` will default to the GCP version

View File

@ -25,7 +25,7 @@ function rm_blob() {
}
trap rm_blob EXIT
$GCLOUD storage cp ../host/main gs://$GCP_BUCKET/svr3-$VERSION
tar --transform="s/$(basename $FROM)/disk.raw/" --format=oldgnu -cvf - -C $(dirname $FROM) $(basename $FROM) | pv -f | pigz >gcp.tar.gz
tar --transform="s/$(basename $FROM)/disk.raw/" --format=oldgnu -cvf - -C $(dirname $FROM) $(basename $FROM) | pigz >gcp.tar.gz
if [ -z "$GCP_JUMPHOST" ]; then
$GCLOUD storage cp ./gcp.tar.gz $BLOB
else

View File

@ -0,0 +1,8 @@
packer {
required_plugins {
qemu = {
version = "~> 1"
source = "github.com/hashicorp/qemu"
}
}
}