Hi,
For CI/CD we rely on the Azure Managed Image name captured in the manifest post-process while creating the Azure managed image using packer.
Most of the time the Output image matches the name captured in manifest (and the build name), whereas occasionally the image name does not match with name captured in manifest or the build name, the image name is +1 sec of the build number or name captured in manifest.
-------------------------------------
# Packer image name snippet
"managed_image_resource_group_name" : "{{user `managed_image_resource_group_name`}}",
"managed_image_name": "my_image_name-{{timestamp}}",
-------------------------------------
####### Log output with imagename and build name
[1;32m==> my_image_name-1544456216: -> Image Name : 'my_image_name-1544456217'[0m
[1;32m==> my_image_name-1544456216: -> Image Location : 'eastus'[0m
[1;32m==> my_image_name-1544456216: Deleting resource group ...[0m
[1;32m==> my_image_name-1544456216: -> ResourceGroupName : 'packerrg'[0m
[1;32m==> my_image_name-1544456216:
==> my_image_name-1544456216: The resource group was not created by Packer, only deleting individual resources ...[0m
[1;32m==> my_image_name-1544456216: -> Microsoft.Compute/virtualMachines : 'my_image_name-packer'[0m
[1;32m==> my_image_name-1544456216: -> Microsoft.Network/networkInterfaces : 'pkrni0deo42b543'[0m
[1;32m==> my_image_name-1544456216: Deleting the temporary OS disk ...[0m
[1;32m==> my_image_name-1544456216: -> OS Disk : '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/packerrg/providers/Microsoft.Compute/disks/pkros0deo42b543'[0m
[1;32m==> my_image_name-1544456216: Deleting the temporary Additional disk ...[0m
[1;32m==> my_image_name-1544456216: Running post-processor: manifest[0m
[1;32mBuild 'my_image_name-1544456216' finished.[0m
==> Builds finished. The artifacts of successful builds are:
--> my_image_name-1544456216: Azure.ResourceManagement.VMImage:
OSType: Linux
ManagedImageResourceGroupName: image-rg
ManagedImageName: my_image_name-1544456217
ManagedImageId: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/image-rg/providers/Microsoft.Compute/images/my_image_name-1544456217
ManagedImageLocation: eastus
--> my_image_name-1544456216:
-------------------------------------
cat manifest.json
{
"builds": [
{
"name": "my_image_name-1544456216",
"builder_type": "azure-arm",
"build_time": 1544457091,
"files": null,
"artifact_id": "",
"packer_run_uuid": "1c1076aa-5af8-1089-6db6-ddd9cf619118"
}
],
"last_run_uuid": "1c1076aa-5af8-1089-6db6-ddd9cf619118"
}
-------------------------------------
This break the CI/CD flow, is there any issue with packer azure manifest post-processors?
Thanks,
Dhinesh