Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-59752

Add support for ephemeral OS disk

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Minor Minor
    • _unsorted
    • None
    • 1.3.0

      Recently, Microsoft introduced the concept of Ephemeral OS disk for certain types of VMs.  An Ephemeral OS disk is stored on local storage and is therefore faster and free, but it is not persistent.  It is therefore only used in situations where the VM is based on an image and every time it is started the OS disk will get “regenerated” from the generalized image and any changes made to the OS disk (C: ) will be lost if the VM moves to another host or is reallocated.   

      https://docs.microsoft.com/en-us/azure/virtual-machines/linux/ephemeral-os-disks

       
      This would be super helpful for ephemeral Jenkins agents to have the best performance like the temporary disk (D: ) and have no cost for this disk.

      What I can see it's only a small change in the json. The diffDiskSettings with option Local seems to be the key.
      Machine sizes must be big enough to carry the disk image (127 GB for Windows from Marketplace) in their cache. Or use one of the smalldisk images (30 GB) and set the diskSizeGB to 100 GB for a Standard_D4s_v3.

      {
          "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
          "contentVersion": "1.0.0.0",
          "parameters": {
              "virtualMachines_redacted_name": {
                  "defaultValue": "redacted",
                  "type": "String"
              },
              "redacted_externalid": {
                  "defaultValue": "/subscriptions/redacted/resourceGroups/PackerImages/providers/Microsoft.Compute/images/redacted",
                  "type": "String"
              },
              "disks_redacted_disk1_externalid": {
                  "defaultValue": "/subscriptions/redacted/resourceGroups/redacted/providers/Microsoft.Compute/disks/redacted",
                  "type": "String"
              },
              "networkInterfaces_redacted41_externalid": {
                  "defaultValue": "/subscriptions/redacted/resourceGroups/redacted/providers/Microsoft.Network/networkInterfaces/redacted",
                  "type": "String"
              }
          },
          "variables": {},
          "resources": [
              {
                  "type": "Microsoft.Compute/virtualMachines",
                  "apiVersion": "2019-03-01",
                  "name": "[parameters('virtualMachines_redacted_name')]",
                  "location": "westus",
                  "properties": {
                      "hardwareProfile": {
                          "vmSize": "Standard_D4s_v3"
                      },
                      "storageProfile": {
                          "imageReference": {
                              "id": "[parameters('redacted_externalid')]"
                          },
                          "osDisk": {
                              "osType": "Windows",
                              "diffDiskSettings": {
                                  "option": "Local"
                              },
                              "name": "[concat(parameters('virtualMachines_redacted_name'), '_disk1_')]",
                              "createOption": "FromImage",
                              "caching": "ReadOnly",
                              "managedDisk": {
                                  "storageAccountType": "Standard_LRS",
                                  "id": "[parameters('disks_redacted_disk_externalid')]"
                              },
                              "diskSizeGB": 30
                          },
                          "dataDisks": []
                      },
                      "osProfile": {
                          "computerName": "[parameters('virtualMachines_redacted_name')]",
                          "adminUsername": "adminuser",
                          "windowsConfiguration": {
                              "provisionVMAgent": true,
                              "enableAutomaticUpdates": true
                          },
                          "secrets": [],
                          "allowExtensionOperations": true
                      },
                      "networkProfile": {
                          "networkInterfaces": [
                              {
                                  "id": "[parameters('networkInterfaces_redacted41_externalid')]"
                              }
                          ]
                      },
                      "diagnosticsProfile": {
                          "bootDiagnostics": {
                              "enabled": true,
                              "storageUri": "https://redacted.blob.core.windows.net/"
                          }
                      }
                  }
              }
          ]
      }
      

       

            bwangia Bradley Wangia
            stefanscherer Stefan Scherer
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: