content/appendix-build-agent.md: update for latest iteration

This commit is contained in:
Peter Williams 2022-03-30 23:28:39 -04:00
Родитель 735f1f04c4
Коммит cc0475edcb
1 изменённых файлов: 61 добавлений и 46 удалений

Просмотреть файл

@ -14,11 +14,6 @@ how such an agent is set up.
[MSI]: https://en.wikipedia.org/wiki/Windows_Installer
[ms-agents]: https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/agents#microsoft-hosted-agents
{% warning() %}
These instructions are likely to get out of date quickly. The hope is that
theyll remain helpful even if theyre not precisely accurate.
{% end %}
# References
@ -39,12 +34,13 @@ It doesnt seem that there's any good way to set up the VM image
automatically. So, the first step is to create a cloud VM and set it all up by
hand.
1. Install Azure command line tool `az`.
1. `az login` if needed to log in to the WWT Azure subscription.
1. `az account list -o table` to list logged-in subscriptions
1. `az account set -s $SUBSCRIPTION_ID` to set the default subscription
1. `az group create --location westus --name devops-support` to create a
containing Resource Group.
1. First-time setup steps, if needed:
1. Install Azure command line tool `az`.
1. `az login` if needed to log in to the WWT Azure subscription.
1. `az account list -o table` to list logged-in subscriptions
1. `az account set -s $SUBSCRIPTION_ID` to set the default subscription
1. `az group create --location westus --name devops-support` to create a
containing Resource Group.
1. Create the VM:
```
az vm create \
@ -57,8 +53,8 @@ hand.
```
The password must be at least twelve characters, one upper/lower/number/special.
The machine name cannot be more than 15 characters. For the setup phase, its
nice to use a beefier machine image. (It can be resized later.)
1. Once the machine is created, locate in in the Azure Portal and check parameters.
nice to use a beefier machine image.
1. Note the public IP address that is printed out by the creation step.
It should now be possible to RDP into the machine. On Linux, something like:
@ -66,15 +62,27 @@ It should now be possible to RDP into the machine. On Linux, something like:
xfreerdp /u:wwt /v:$IP_ADDR:3389 /size:1280x960
```
Now the graphical setup can begin:
or, if you're on a HiDPI display, perhaps with:
1. Turn off network discoverability when prompted upon login
```
... /size:2560x1600 /scale:180
```
In one instance it looked like the program hung, but I just needed to hit Enter
(?). Now the graphical setup can begin:
1. If prompted upon login, turn off network discoverability.
1. In the Server Manager, go to "Local Server", then click on "IE Enhanced
Security Configuration". Turn the settings to off. Otherwise, IE literally
won't allow you to download files without jumping through a lot of hoops.
([Ref][ie-esc]).
1. Navigate to the [Visual Studio Community][vs-community] downloads page.
(Note: copy-paste of links into the RDP screen should work!)
1. It seems to now be necessary to install Microsoft Edge in order to download
VS2019. Go to the [Microsoft Edge download page][ms-edge] and install it.
(Note: copy-paste of links into the RDP screen should work!) Select "Don't
use" when IE prompts about adopting recommended security policies.
1. Now use Edge to navigate to the [Visual Studio 2019 Community][vs-community]
downloads page. Login to a Microsoft account will be necessary; password
copy-paste out of the host machine FTW.
1. Download the `vs_community_*.exe` installer stub.
1. Rename that file to just `vs_community.exe` (just to make copy-paste easier
in the next step).
@ -97,38 +105,18 @@ Now the graphical setup can begin:
1. Reboot the machine after the install. (Not 100% sure but I strongly suspect
this is necessary.)
1. Download the [Microsoft Visual Studio Installer Projects][ms-vdproj] Visual
Studio extension, using the IE Trusted website trick again. The file is
downloaded with a `.zip` extension but can be treated as a `.vsix`.
1. Install the extension from the command line, as guided by [this post][vsix-post]:
Studio extension. If you download with IE instead of Edge, it lands with a
`.zip` extension rather than `.vsix`.
1. Install the extension from the command line:
```
&"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\VSIXInstaller.exe" InstallerProjects.zip
&"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\VSIXInstaller.exe" InstallerProjects.vsix
```
[vs-community]: https://visualstudio.microsoft.com/vs/community/
[ms-edge]: https://www.microsoft.com/en-us/edge/business/download
[vs-community]: https://visualstudio.microsoft.com/vs/older-downloads/
[ms-vdproj]: https://marketplace.visualstudio.com/items?itemName=VisualStudioClient.MicrosoftVisualStudio2017InstallerProjects
[vsix-post]: https://developercommunity.visualstudio.com/content/problem/596629/vsixinstaller-from-vs-2019-closing-with-runfromeng.html
[ie-esc]: https://medium.com/tensult/disable-internet-explorer-enhanced-security-configuration-in-windows-server-2019-a9cf5528be65
If you want to do a test build at this juncture, youll need to apply [the fix
for the HRESULT = 8000000A error][hresult-error]:
```
cd "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\VSI\DisableOutOfProcBuild"
.\DisableOutOfProcBuild.exe
```
[hresult-error]: https://stackoverflow.com/a/41788791/3760486
We need to apply the same fix on-the-fly in the VMs since the fix is
user-specific and the Azure provisioning uses a different user.
If you want the VM to to act as an Azure Pipelines build agent on its own,
follow the [Microsoft self-hosted agent docs][ms-selfhosted-docs]. However,
were setting up the image to run in a VM scale set, in which case the agent
will automatically be provisioned upon VM boot. So for the main workflow you
should **not** install the agent.
# Convert the VM to work in a scale set
Now we start following the [Microsoft VM scale set agent docs][ms-vmss-docs].
@ -172,6 +160,33 @@ Now we start following the [Microsoft VM scale set agent docs][ms-vmss-docs].
Note: I'd like to use the `Standard_D2_v3` VM SKU, which doesn't call for
fancy "premium disk", but when I tried that I got an error about it being
required anyway.
1. If setting up from scratch, now follow the rest of [the
instructions][ms-vmss-docs] to wire up the scale set to Azure Pipelines. The
agent pool is currently called "Custom Windows".
1. Finally, delete the VM:
```
az vm delete -g devops-support -n hostedagentbox
```
# Older Notes
If you want to do a test build in the VM, youll need to apply [the fix for the
HRESULT = 8000000A error][hresult-error]:
```
cd "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\VSI\DisableOutOfProcBuild"
.\DisableOutOfProcBuild.exe
```
[hresult-error]: https://stackoverflow.com/a/41788791/3760486
We need to apply the same fix on-the-fly in the VMs since the fix is
user-specific and the Azure provisioning uses a different user.
If you want the VM to to act as an Azure Pipelines build agent on its own,
follow the [Microsoft self-hosted agent docs][ms-selfhosted-docs]. However,
were setting up the image to run in a VM scale set, in which case the agent
will automatically be provisioned upon VM boot. So for the main workflow you
should **not** install the agent.
If setting up from scratch, after creating the scale set you need to follow the
rest of [the instructions][ms-vmss-docs] to wire it up to Azure Pipelines. The
agent pool is currently called "Custom Windows".