Azure / azure-init

A minimal provisioning agent designed for Azure Linux VMs.
MIT License
10 stars 11 forks source link

improve image_creation script #88

Closed dongsupark closed 3 months ago

dongsupark commented 3 months ago

Improve image_creation.sh script.

How to run with custom parameters.

RG="my-test-azinit" LOCATION="westeurope" VM_SIZE="Standard_D2ds_v5" BASE_IMAGE="Debian:debian-11:11-backports-gen2:latest" demo/image_creation.sh

Testing done

Done testing with a couple of possible variables.

dongsupark commented 3 months ago

I tried this out with RG="jcline-azinit-test2" LOCATION="eastus2" BASE_IMAGE="Debian:debian-11:11-backports-gen2:latest" demo/image_creation.sh and the VM failed configuration with

[   33.134147] cloud-init[918]: /var/log/azure/image/setup.sh: line 14: /etc/netplan/eth0.yaml: No such file or directory

I assume /etc/netplan/ doesn't exist on that image.

I cannot reproduce it myself, but anyway pushed a fix for that in customdata_template.yml.

Since you're not touching the customdata_template.yml this is just an existing issue from what I can tell. The changes themselves look good good to me. You might want to point ShellCheck at it, but all those were pre-existing so we can do that separately as well.

anhvoms commented 3 months ago

The image creation script was used with Ubuntu 20.04/22.04. It assumed that netplan was used for networking and a lot of code written was based on that assumption. See issue #90

dongsupark commented 3 months ago

Added an automated creation of image definition before creating image version. Addressed warnings and infos when running shellcheck.