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

Add support for ephemeral OS disk

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Done
    • Component/s: _unsorted
    • Labels:
      None
    • Similar Issues:
    • Released As:
      1.3.0

      Description

      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/"
                          }
                      }
                  }
              }
          ]
      }
      

       

        Attachments

          Activity

          Hide
          stefanscherer Stefan Scherer added a comment -

          Bradley Wangia that fork is useful to see how to do it, but for general use it should be extended to all json templates.
          I'm not currently working on it, so if you have time, feel free to draft a PR.
          But I'm still interested in that feature, just in my backlog for things to do...

          Show
          stefanscherer Stefan Scherer added a comment - Bradley Wangia that fork is useful to see how to do it, but for general use it should be extended to all json templates. I'm not currently working on it, so if you have time, feel free to draft a PR. But I'm still interested in that feature, just in my backlog for things to do...
          Hide
          bwangia Bradley Wangia added a comment -
          Show
          bwangia Bradley Wangia added a comment - Stefan Scherer Jie Shen can I get review on the PR for this?  https://github.com/jenkinsci/azure-vm-agents-plugin/pull/173
          Hide
          bwangia Bradley Wangia added a comment -

          Jie Shen  I saw you approved/merged my PR into dev ...

          • Is there a release process/schedule?
          • Anything I need to do to this ticket to get it into the next release?
          Show
          bwangia Bradley Wangia added a comment - Jie Shen   I saw you approved/merged my PR into dev ... Is there a release process/schedule? Anything I need to do to this ticket to get it into the next release?
          Hide
          jieshe Jie Shen added a comment -

          Bradley Wangia thanks for your contribution here! I have released this feature in the version of 1.3.0.

          Show
          jieshe Jie Shen added a comment - Bradley Wangia thanks for your contribution here! I have released this feature in the version of 1.3.0.
          Hide
          stefanscherer Stefan Scherer added a comment -

          Thanks Bradley Wangia for your PR. And thanks Jie Shen for the new release. I planned to compile it and run some tests, but now it's even simpler to give this feature a try today.

          Show
          stefanscherer Stefan Scherer added a comment - Thanks Bradley Wangia for your PR. And thanks Jie Shen for the new release. I planned to compile it and run some tests, but now it's even simpler to give this feature a try today.

            People

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

              Dates

              Created:
              Updated:
              Resolved: