跳转到主内容

更新 Appveyor Azure 镜像

Windows 上的 Electron CI 使用 AppVeyor, 后者则使用 Azure VM 镜像运行。 有时,由于 Chromium 要求发生变化,这些 VM 镜像需要更新。 为了更新,您将需要 PowerShellAzure PowerShell 模块

由于Chromium的更改或其他杂项构建要求更改,我们偶尔需要更新这些图像。

实例使用:

* 我们需要安装`VS15.9`或者我们已安装好`VS15.7`;然后可能会请求我们去更新Azure镜像
  1. 确定您要修改的图像。

    • appveyor.yml文件中,镜像通过该文件来识别 镜像 配置。
      • “images”该命名被对应用来定义云构建,例如:libcc-20 cloud
    • 找到你希望去修改构建在云端的镜像并且注意镜像的 VHD Blob Path(标签),它是对应键值对的值
      • 您需要这个URI路径来复制到一个新映像中。
    • 同时需要的的存储账号名,在AppVeyor中被标记为 Disk Storage Account Name
  2. Get the Azure storage account key

    • Log into Azure using credentials stored in LastPass (under Azure Enterprise) and then find the storage account corresponding to the name found in AppVeyor.
      • Example, for appveyorlibccbuilds Disk Storage Account Name you'd look for appveyorlibccbuilds in the list of storage accounts @ Home < Storage Accounts
        • Click into it and look for Access Keys, and then you can use any of the keys present in the list.
  3. Get the full virtual machine image URI from Azure

    • Navigate to Home < Storage Accounts < $ACCT_NAME < Blobs < Images
      • In the following list, look for the VHD path name you got from Appveyor and then click on it.
        • Copy the whole URL from the top of the subsequent window.
  4. Copy the image using the Copy Master Image PowerShell script.

    • It is essential to copy the VM because if you spin up a VM against an image that image cannot at the same time be used by AppVeyor.
    • Use the storage account name, key, and URI obtained from Azure to run this script.
      • See Step 3 for URI & when prompted, press enter to use same storage account as destination.
      • Use default destination container name (images)
      • Also, when naming the copy, use a name that indicates what the new image will contain (if that has changed) and date stamp.
        • Ex. libcc-20core-vs2017-15.9-2019-04-15.vhd
    • Go into Azure and get the URI for the newly created image as described in a previous step
  5. Spin up a new VM using the Create Master VM from VHD PowerShell.

    • From PowerShell, execute ps1 file with ./create_master_vm_from_vhd.ps1
    • 你将需要 AppVeyor 生成云定义中提供的凭据信息。
      • 这包括:
        • 客户端 ID
        • 客户端密钥
        • Tenant ID
        • 订阅 ID
        • 资源组
        • 虚拟网络
    • 您还需要指定
      • 主虚拟机名称 - 只需识别临时虚拟机的唯一名称
      • 主虚拟机大小 - 使用 Standard_F32s_v2
      • Master VHD URI - 使用 URI 获得了前一步的 @ 结束
      • 位置使用 East US
  6. Log back into Azure and find the VM you just created in Home < Virtual Machines < $YOUR_NEW_VM

    • You can download a RDP (Remote Desktop) file to access the VM.
  7. Using Microsoft Remote Desktop, click Connect to connect to the VM.

    • Credentials for logging into the VM are found in LastPass under the AppVeyor Enterprise master VM credentials.
  8. Modify the VM as required.

  9. Shut down the VM and then delete it in Azure.

  10. Add the new image to the Appveyor Cloud settings or modify an existing image to point to the new VHD.