Call: az_sku(<default>);
when PUBLIC_CLOUD_AZURE_SKU undefined, the default from input is used:
when <default> is undefined too, hardcoded string used; i.e. az_sku(), default = 'gen2';
my $json_obj = decode_azure_json($str);
Helper function to decode json string, retrieved from az
, into a json object. Due to https://github.com/Azure/azure-cli/issues/9903 we need to strip all color codes from that string first.
$self->resource_group_exist();
Checks if the Azure resource group exists and returns boolean
Finds the image blob in Azure
* Requires image name parameter, e.g. 'SLES15-SP5-BYOS.aarch64-1.0.0-Azure-Build1.68.xz'
* Returns 0 if the image blob has not been found or 1 if the image blob has ben found.
Finds the image version in Azure
Returns the image version id or undef if not found.
Return example: '/subscriptions/SMTHNG-XYZ-123/resourceGroups/openqa-upload/providers/Microsoft.Compute/galleries/test_image_gallery/images/SLE-15-SP5-AZURE-BYOS-X64-GEN2/versions/1.64.100'
my $image_id = $self->find_img($name);
Requires the image name: * The variable may also be URL and the name will be extracted from it. * The name is then used to search for the image blob.
Does the following steps: 1) Checks if the image blob exists 2) Checks if the image version exists
* If the image definition does not exist the image version does not either.
Return example: '/subscriptions/SMTHNG-XYZ-123/resourceGroups/openqa-upload/providers/Microsoft.Compute/galleries/test_image_gallery/images/SLE-15-SP5-AZURE-BYOS-X64-GEN2/versions/1.64.100' If either blob or the image version were not found then the default empty list or undef in the scalar context is returned.
my $definition = $self->generate_azure_image_definition();
Generates the Azure Image name from the job settings. If PUBLIC_CLOUD_AZURE_IMAGE_DEFINITION defined, its content is returned; otherwise, image definition name based on distri, version, flavor and SKU returned.
Note: Image definitions shall be distinct names and can only serve one architecture!
Example: 'SLE-MICRO-5.4-BYOS-AZURE-X86_64-GEN2'
B<return> a string with the image full name distri-version-flavor-arch-sku
Calculate the image (blob) name
from the file name used in SUSE download server (usually PUBLIC_CLOUD_IMAGE_LOCATION)
B<return> a string with the image name
Calculate the image URI in the Azure Blob Server
from the file name used in SUSE download server (usually PUBLIC_CLOUD_IMAGE_LOCATION)
PUBLIC_CLOUD_STORAGE_ACCOUNT setting is used to compose the url
B<return> a string with the image uri on the blob server
1) Create resources 2) Upload the image blob 3) Create image definition 4) Create new image version for that definition. Use the link to the uploaded blob to create this version
Extract resource group and vm name from full instance id which looks like /subscriptions/c011786b-59d7-4817-880c-7cd8a6ca4b19/resourceGroups/openqa-suse-de-1ec3f5a05b7c0712/providers/Microsoft.Compute/virtualMachines/openqa-suse-de-1ec3f5a05b7c0712