1
0
Fork 0

improved windows agent creation

This commit is contained in:
Christian Kühnel 2020-05-08 12:55:40 +02:00
parent 21abbbcd59
commit 4c48379707
2 changed files with 9 additions and 5 deletions

View file

@ -116,17 +116,18 @@ powershell .\build_deploy.ps1 <container-folder>
To spawn a new windows agent: To spawn a new windows agent:
1. Go to the [GCP page](https://pantheon.corp.google.com/compute/instances?project=llvm-premerge-checks&instancessize=50) and pick a new number for the agent. 1. Go to the [GCP page](https://pantheon.corp.google.com/compute/instances?project=llvm-premerge-checks&instancessize=50) and pick a new number for the agent.
1. Update the machine name in `kubernetes/windows_agent_create.sh`. 1. Run `kubernetes/windows_agent_create.sh agent-windows-<number>`
1. Run `kubernetes/windows_agent_create.sh`
1. Go to the [GCP page](https://pantheon.corp.google.com/compute/instances?project=llvm-premerge-checks&instancessize=50) again 1. Go to the [GCP page](https://pantheon.corp.google.com/compute/instances?project=llvm-premerge-checks&instancessize=50) again
1. login to the new machine via RDP (you probably need to set the i). 1. login to the new machine via RDP (you probably need to set the i).
1. In the RDP session: run these commands in the CMD window to start the docker container: 1. In the RDP session: run these commands in the CMD window to bootstrap the Windows machine:
```powershell ```powershell
Invoke-WebRequest -uri 'https://raw.githubusercontent.com/google/llvm-premerge-checks/master/scripts/windows_agent_bootstrap.ps1' -OutFile windows_agent_bootstrap.ps1 Invoke-WebRequest -uri 'https://raw.githubusercontent.com/google/llvm-premerge-checks/master/scripts/windows_agent_bootstrap.ps1' -OutFile windows_agent_bootstrap.ps1
.\windows_agent_bootstrap.ps1 .\windows_agent_bootstrap.ps1
``` ```
1. Ignore the pop-up to format the new disk.
1. Wait for the machine to reboot, then copy the credendials from `windows-agent-2` in `c:\credentials` to the new machine to `c:\credentials`. You can do that by mounting a folder of your host machine via RDP into the Windows VMs. 1. Wait for the machine to reboot, then copy the credendials from `windows-agent-2` in `c:\credentials` to the new machine to `c:\credentials`. You can do that by mounting a folder of your host machine via RDP into the Windows VMs.
1. run this script to start containers: 1: Copy the credientals to `C:\credentials` from another Windows agent.
1. Run this script to start the container:
```powershell ```powershell
Invoke-WebRequest -uri 'https://raw.githubusercontent.com/google/llvm-premerge-checks/master/scripts/windows_agent_start.ps1' -OutFile windows_agent_start.ps1 Invoke-WebRequest -uri 'https://raw.githubusercontent.com/google/llvm-premerge-checks/master/scripts/windows_agent_start.ps1' -OutFile windows_agent_start.ps1
.\windows_agent_start.ps1 jenkins .\windows_agent_start.ps1 jenkins

View file

@ -34,11 +34,14 @@ choco install -y git
New-Item -Path "D:\" -Name "Docker" -ItemType "directory" New-Item -Path "D:\" -Name "Docker" -ItemType "directory"
cmd /C "mklink /j C:\ProgramData\Docker D:\docker" cmd /C "mklink /j C:\ProgramData\Docker D:\docker"
# create folder for credentials
New-Item -Path "C:\" -Name "credentials" -ItemType "directory"
# install Docker # install Docker
Install-PackageProvider -Name NuGet -Force Install-PackageProvider -Name NuGet -Force
Install-Module -Name DockerMsftProvider -Repository PSGallery -Force Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
Install-Package -Name docker -ProviderName DockerMsftProvider -Force Install-Package -Name docker -ProviderName DockerMsftProvider -Force
Set-Service -Name docker -StartupType AutomaticDelayedStart sc.exe config docker start=delayed-auto
# install gcloud and authenticate access to gcr.io registry # install gcloud and authenticate access to gcr.io registry
# TODO: find a better way to install the Google Cloud SDK, avoid ingoring the checksum # TODO: find a better way to install the Google Cloud SDK, avoid ingoring the checksum